Add gen_l10n sorting tests (#46247)
* Add tests for sorting arbPathString, supportedLocales and supportedLanguageCodes alphabetically * Plural arbPathStrings * Factor out singleZhMessageArbFileString * Make translations more accurate and generic
This commit is contained in:
@@ -92,7 +92,7 @@ Future<void> main(List<String> arguments) async {
|
||||
'--output-dir=${localizationsGenerator.l10nDirectory.path}',
|
||||
'--no-use-deferred-loading',
|
||||
localizationsGenerator.outputFile.path,
|
||||
...localizationsGenerator.arbFilenames,
|
||||
...localizationsGenerator.arbPathStrings,
|
||||
]);
|
||||
if (generateFromArbResult.exitCode != 0) {
|
||||
stderr.write(generateFromArbResult.stderr);
|
||||
|
||||
@@ -359,8 +359,8 @@ class LocalizationsGenerator {
|
||||
/// Sets the [className] for the localizations and localizations delegate
|
||||
/// classes.
|
||||
|
||||
/// The list of all arb files in [l10nDirectory].
|
||||
final List<String> arbFilenames = <String>[];
|
||||
/// The list of all arb path strings in [l10nDirectory].
|
||||
final List<String> arbPathStrings = <String>[];
|
||||
|
||||
/// The supported language codes as found in the arb files located in
|
||||
/// [l10nDirectory].
|
||||
@@ -477,7 +477,7 @@ class LocalizationsGenerator {
|
||||
localeString = arbFilenameLocaleRE.firstMatch(filePath)[1];
|
||||
}
|
||||
|
||||
arbFilenames.add(filePath);
|
||||
arbPathStrings.add(filePath);
|
||||
final LocaleInfo localeInfo = LocaleInfo.fromString(localeString);
|
||||
if (localeInfoList.contains(localeInfo))
|
||||
throw L10nException(
|
||||
@@ -488,6 +488,7 @@ class LocalizationsGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
arbPathStrings.sort();
|
||||
localeInfoList.sort();
|
||||
supportedLocales.addAll(localeInfoList);
|
||||
supportedLanguageCodes.addAll(localeInfoList.map((LocaleInfo localeInfo) {
|
||||
|
||||
Reference in New Issue
Block a user