add localization for no_country text

This commit is contained in:
Salvatore Giordano
2021-06-19 12:35:01 +02:00
parent 66bc5ee5a9
commit 3dca7580a8
4 changed files with 7 additions and 4 deletions

View File

@@ -21,7 +21,6 @@ class CountryLocalizations {
late Map<String, String> _localizedStrings;
Future<bool> load() async {
print('locale.languageCode: ${locale.languageCode}');
String jsonString = await rootBundle.loadString(
'packages/country_code_picker/i18n/${locale.languageCode}.json');
Map<String, dynamic> jsonMap = json.decode(jsonString);

View File

@@ -264,5 +264,6 @@
"RS": "Serbia",
"SX": "Sint Maarten (Dutch part)",
"SS": "South Sudan",
"XK": "Kosovo"
"XK": "Kosovo",
"no_country": "No country found"
}

View File

@@ -248,5 +248,6 @@
"ZA": "Sudafrica",
"ZM": "Zambia",
"ZW": "Zimbabwe",
"XK": "Kosovo"
"XK": "Kosovo",
"no_country": "Nessun paese trovato"
}

View File

@@ -1,4 +1,5 @@
import 'package:country_code_picker/country_code.dart';
import 'package:country_code_picker/country_localizations.dart';
import 'package:flutter/material.dart';
/// selection dialog used for selection of the country code
@@ -176,7 +177,8 @@ class _SelectionDialogState extends State<SelectionDialog> {
}
return Center(
child: Text('No country found'),
child: Text(CountryLocalizations.of(context)?.translate('no_country') ??
'No country found'),
);
}