Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
eb185d73
Unverified
Commit
eb185d73
authored
Sep 16, 2021
by
Ahmed Ashour
Committed by
GitHub
Sep 16, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
internationalization: fix select with incorrect message (#90096)
parent
cd1892f0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
0 deletions
+45
-0
gen_l10n.dart
packages/flutter_tools/lib/src/localizations/gen_l10n.dart
+5
-0
generate_localizations_test.dart
...tools/test/general.shard/generate_localizations_test.dart
+40
-0
No files found.
packages/flutter_tools/lib/src/localizations/gen_l10n.dart
View file @
eb185d73
...
...
@@ -300,6 +300,11 @@ String _generateSelectMethod(Message message, String translationForMessage) {
);
}
}
}
else
{
throw
L10nException
(
'Incorrect select message format for:
${message.resourceId}
.
\n
'
'Check to see if the select message is in the proper ICU syntax format.'
);
}
final
List
<
String
>
parameters
=
message
.
placeholders
.
map
((
Placeholder
placeholder
)
{
...
...
packages/flutter_tools/test/general.shard/generate_localizations_test.dart
View file @
eb185d73
...
...
@@ -1909,6 +1909,46 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e
)),
);
});
testWithoutContext('should throw attempting to generate a select message with an incorrect message', () {
const String selectMessageWithoutPlaceholdersAttribute = '''
{
"
genderSelect
": "
{
gender
,
select
,}
",
"
@genderSelect
": {
"
placeholders
": {
"
gender
": {}
}
}
}''';
final Directory l10nDirectory = fs.currentDirectory.childDirectory('lib').childDirectory('l10n')
..createSync(recursive: true);
l10nDirectory.childFile(defaultTemplateArbFileName)
.writeAsStringSync(selectMessageWithoutPlaceholdersAttribute);
expect(
() {
LocalizationsGenerator(
fileSystem: fs,
inputPathString: defaultL10nPathString,
outputPathString: defaultL10nPathString,
templateArbFileName: defaultTemplateArbFileName,
outputFileString: defaultOutputFileString,
classNameString: defaultClassNameString,
)
..loadResources()
..writeOutputFiles(BufferLogger.test());
},
throwsA(isA<L10nException>().having(
(L10nException e) => e.message,
'message',
allOf(
contains('Incorrect select message format for'),
contains('Check to see if the select message is in the proper ICU syntax format.'),
),
)),
);
});
});
testWithoutContext('intl package import should be omitted in subclass files when no plurals are included', () {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment