nullalbe with support 70 languages

This commit is contained in:
kechankrisna
2021-03-09 02:44:04 +07:00
parent 0fe203e8ff
commit 057bb77d34
77 changed files with 17718 additions and 2116 deletions
+74 -12
View File
@@ -8,7 +8,7 @@ class CountryLocalizations {
CountryLocalizations(this.locale);
static CountryLocalizations of(BuildContext context) {
static CountryLocalizations? of(BuildContext context) {
return Localizations.of<CountryLocalizations>(
context,
CountryLocalizations,
@@ -18,7 +18,7 @@ class CountryLocalizations {
static const LocalizationsDelegate<CountryLocalizations> delegate =
_CountryLocalizationsDelegate();
Map<String, String> _localizedStrings;
late Map<String, String> _localizedStrings;
Future<bool> load() async {
print('locale.languageCode: ${locale.languageCode}');
@@ -33,8 +33,8 @@ class CountryLocalizations {
return true;
}
String translate(String key) {
return _localizedStrings[key];
String? translate(String? key) {
return _localizedStrings[key!];
}
}
@@ -45,14 +45,76 @@ class _CountryLocalizationsDelegate
@override
bool isSupported(Locale locale) {
return [
'en',
'it',
'fr',
'es',
'de',
'pt',
'ko',
'zh',
"af",
"am",
"ar",
"az",
"be",
"bg",
"bn",
"bs",
"ca",
"cs",
"da",
"de",
"el",
"en",
"es",
"et",
"fa",
"fi",
"fr",
"gl",
"ha",
"he",
"hi",
"hr",
"hu",
"hy",
"id",
"is",
"it",
"ja",
"ka",
"kk",
"km",
"ko",
"ku",
"ky",
"lt",
"lv",
"mk",
"ml",
"mn",
"ms",
"nb",
"nl",
"nn",
"no",
"pl",
"ps",
"pt",
"ro",
"ru",
"sd",
"sk",
"sl",
"so",
"sq",
"sr",
"sv",
"ta",
"tg",
"th",
"tk",
"tr",
"tt",
"uk",
"ug",
"ur",
"uz",
"vi",
"zh",
].contains(locale.languageCode);
}