Showing
1 changed file
with
6 additions
and
5 deletions
@@ -258,14 +258,15 @@ abstract class Translations { | @@ -258,14 +258,15 @@ abstract class Translations { | ||
258 | extension Trans on String { | 258 | extension Trans on String { |
259 | String get tr { | 259 | String get tr { |
260 | if (Get.locale?.languageCode == null) return this; | 260 | if (Get.locale?.languageCode == null) return this; |
261 | - if (Get.translations | ||
262 | - .containsKey("${Get.locale.languageCode}_${Get.locale.countryCode}")) { | 261 | + if (Get.translations.containsKey( |
262 | + "${Get.locale.languageCode}_${Get.locale.countryCode}") && | ||
263 | + Get.translations["${Get.locale.languageCode}_${Get.locale.countryCode}"] | ||
264 | + .containsKey(this)) { | ||
263 | return Get.translations[ | 265 | return Get.translations[ |
264 | "${Get.locale.languageCode}_${Get.locale.countryCode}"][this]; | 266 | "${Get.locale.languageCode}_${Get.locale.countryCode}"][this]; |
265 | - } else if (Get.translations.containsKey(Get.locale.languageCode)) { | 267 | + } else if (Get.translations.containsKey(Get.locale.languageCode) && |
268 | + Get.translations[Get.locale.languageCode].containsKey(this)) { | ||
266 | return Get.translations[Get.locale.languageCode][this]; | 269 | return Get.translations[Get.locale.languageCode][this]; |
267 | - } else if (Get.translations.isNotEmpty) { | ||
268 | - return Get.translations.values.first[this]; | ||
269 | } else { | 270 | } else { |
270 | return this; | 271 | return this; |
271 | } | 272 | } |
-
Please register or login to post a comment