tr property
String
get
tr
Implementation
String get tr {
// print('language');
// print(Fatima.locale!.languageCode);
// print('contains');
// print(Fatima.translations.containsKey(Fatima.locale!.languageCode));
// print(Fatima.translations.keys);
// Returns the key if locale is null.
if (Fatima.locale?.languageCode == null) return this;
if (_fullLocaleAndKey) {
return Fatima.translations[
"${Fatima.locale!.languageCode}_${Fatima.locale!.countryCode}"]![
this]!;
}
final similarTranslation = _getSimilarLanguageTranslation;
if (similarTranslation != null && similarTranslation.containsKey(this)) {
return similarTranslation[this]!;
// If there is no corresponding language or corresponding key, return
// the key.
} else if (Fatima.fallbackLocale != null) {
final fallback = Fatima.fallbackLocale!;
final key = "${fallback.languageCode}_${fallback.countryCode}";
if (Fatima.translations.containsKey(key) &&
Fatima.translations[key]!.containsKey(this)) {
return Fatima.translations[key]![this]!;
}
if (Fatima.translations.containsKey(fallback.languageCode) &&
Fatima.translations[fallback.languageCode]!.containsKey(this)) {
return Fatima.translations[fallback.languageCode]![this]!;
}
return this;
} else {
return this;
}
}