Remove Special Handling of Norwegian Locales (#63034)

* Regenerate _no.arb and _nb.arb from scratch

* Revert no <--> nb synonym logic
This commit is contained in:
Shi-Hao Hong
2020-08-12 07:29:17 +08:00
committed by GitHub
parent 787e567de3
commit c36b75e45b
10 changed files with 540 additions and 113 deletions

View File

@@ -173,13 +173,6 @@ Set<String> _supportedLocales() {
supportedLocales.add(filenameRE.firstMatch(filePath)[1]);
}
// See https://github.com/flutter/flutter/issues/53036 for context on why
// 'no' is being used as a synonym for 'nb'. It only uses this synonym
// if 'nb' is not detected as a valid arb file.
if (supportedLocales.contains('no') && !supportedLocales.contains('nb')) {
supportedLocales.add('nb');
}
return supportedLocales;
}

View File

@@ -78,11 +78,6 @@ String generateArbBasedLocalizationSubclasses({
assert(supportedLanguagesConstant.isNotEmpty);
assert(supportedLanguagesDocMacro.isNotEmpty);
// See https://github.com/flutter/flutter/issues/53036 for context on why
// 'no' is being used as a synonym for 'nb'. It only uses this synonym
// if 'nb' is not detected as a valid arb file.
bool isNbSynonymOfNo = false;
final StringBuffer output = StringBuffer();
output.writeln(generateHeader('dart dev/tools/localization/bin/gen_localizations.dart --overwrite'));
@@ -108,12 +103,6 @@ String generateArbBasedLocalizationSubclasses({
allResourceIdentifiers.addAll(localeToResources[locale].keys.toList()..sort());
}
if (languageToLocales['no'] != null && languageToLocales['nb'] == null) {
languageToLocales['nb'] ??= <LocaleInfo>[];
languageToLocales['nb'].add(LocaleInfo.fromString('nb'));
isNbSynonymOfNo = true;
}
// We generate one class per supported language (e.g.
// `MaterialLocalizationEn`). These implement everything that is needed by the
// superclass (e.g. GlobalMaterialLocalizations).
@@ -144,21 +133,6 @@ String generateArbBasedLocalizationSubclasses({
for (final String languageName in languageCodes) {
final LocaleInfo languageLocale = LocaleInfo.fromString(languageName);
// See https://github.com/flutter/flutter/issues/53036 for context on why
// 'no' is being used as a synonym for 'nb'. It only uses this synonym
// if 'nb' is not detected as a valid arb file.
if (languageName == 'nb' && isNbSynonymOfNo) {
output.writeln(generateClassDeclaration(
languageLocale,
generatedClassPrefix,
'${generatedClassPrefix}No'),
);
output.writeln(generateConstructor(languageLocale));
output.writeln('}');
supportedLocales.writeln('/// * `$languageName` - ${describeLocale(languageName)}, which, in this library, is a synonym of `no`');
continue;
}
output.writeln(generateClassDeclaration(languageLocale, generatedClassPrefix, baseClass));
output.writeln(generateConstructor(languageLocale));