From 624e67e529564996077e7e651540e5d2b3b1ad40 Mon Sep 17 00:00:00 2001 From: Albert221 Date: Mon, 22 Jun 2020 18:40:45 +0200 Subject: [PATCH] Fix l10n.dart generator for country only langs --- lib/src/generator/l10n_dart_generator.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/src/generator/l10n_dart_generator.dart b/lib/src/generator/l10n_dart_generator.dart index 500a67f..126e387 100644 --- a/lib/src/generator/l10n_dart_generator.dart +++ b/lib/src/generator/l10n_dart_generator.dart @@ -76,8 +76,7 @@ class S { static const delegate = ArbifyLocalizationsDelegate(); static Future load(Locale locale) { - final name = locale.countryCode.isEmpty ? locale.languageCode : locale.toString(); - final localeName = Intl.canonicalizedLocale(name); + final localeName = Intl.canonicalizedLocale(locale.toString()); return initializeMessages(localeName).then((_) { Intl.defaultLocale = localeName; @@ -114,7 +113,8 @@ $supportedLocales ]; final languageCode = "languageCode: '${locale.language}'"; final scriptCode = locale.script == null ? '' : ", scriptCode: '${locale.script}'"; - final countryCode = ", countryCode: '${locale.region ?? ''}'"; + final countryCode = + locale.script == null ? '' : ", countryCode: '${locale.region}'"; supportedLocales.writeln( ' Locale.fromSubtags($languageCode$scriptCode$countryCode),');