Skip to content

Commit

Permalink
add localization for no_country text
Browse files Browse the repository at this point in the history
  • Loading branch information
imtoori committed Jun 19, 2021
1 parent 66bc5ee commit 3dca758
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
1 change: 0 additions & 1 deletion lib/country_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion lib/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -264,5 +264,6 @@
"RS": "Serbia",
"SX": "Sint Maarten (Dutch part)",
"SS": "South Sudan",
"XK": "Kosovo"
"XK": "Kosovo",
"no_country": "No country found"
}
3 changes: 2 additions & 1 deletion lib/i18n/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,5 +248,6 @@
"ZA": "Sudafrica",
"ZM": "Zambia",
"ZW": "Zimbabwe",
"XK": "Kosovo"
"XK": "Kosovo",
"no_country": "Nessun paese trovato"
}
4 changes: 3 additions & 1 deletion lib/selection_dialog.dart
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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'),
);
}

Expand Down

0 comments on commit 3dca758

Please sign in to comment.