WT1.1.2 build 32 login error messages fixes

This commit is contained in:
bossanyit
2020-11-20 15:32:06 +01:00
parent 3ce32434bf
commit ed8760f8e8
13 changed files with 90 additions and 97 deletions
+6 -10
View File
@@ -17,8 +17,7 @@ class AppLocalizations {
}
// Static member to have a simple access to the delegate from the MaterialApp
static const LocalizationsDelegate<AppLocalizations> delegate =
AppLocalizationsDelegate();
static const LocalizationsDelegate<AppLocalizations> delegate = AppLocalizationsDelegate();
Map<String, String> _localizedStrings;
@@ -29,8 +28,7 @@ class AppLocalizations {
Future<bool> load() async {
// Load the language JSON file from the "lang" folder
print(" -- load language pieces " + locale.languageCode);
String jsonString =
await rootBundle.loadString('i18n/${locale.languageCode}.json');
String jsonString = await rootBundle.loadString('i18n/${locale.languageCode}.json');
Map<String, dynamic> jsonMap = json.decode(jsonString);
_localizedStrings = jsonMap.map((key, value) {
@@ -47,13 +45,12 @@ class AppLocalizations {
// This method will be called from every widget which needs a localized text
String translate(String key) {
if (isTest) return key;
return _localizedStrings[key];
String translated = _localizedStrings[key];
return translated != null ? translated : key;
}
}
class AppLocalizationsDelegate
extends LocalizationsDelegate<AppLocalizations> {
class AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations> {
final bool isTest;
// This delegate instance will never change (it doesn't even have fields!)
// It can provide a constant constructor.
@@ -77,7 +74,6 @@ class AppLocalizationsDelegate
return localizations;
}
@override
bool shouldReload(AppLocalizationsDelegate old) => false;
}
}