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