Jonny Borges
Committed by GitHub

Update root_widget.dart

@@ -261,6 +261,7 @@ abstract class Translations { @@ -261,6 +261,7 @@ abstract class Translations {
261 Map<String, Map<String, String>> get keys; 261 Map<String, Map<String, String>> get keys;
262 } 262 }
263 263
  264 +
264 extension Trans on String { 265 extension Trans on String {
265 String get tr { 266 String get tr {
266 // Returns the key if locale is null. 267 // Returns the key if locale is null.
@@ -279,9 +280,8 @@ extension Trans on String { @@ -279,9 +280,8 @@ extension Trans on String {
279 Get.translations[Get.locale.languageCode].containsKey(this)) { 280 Get.translations[Get.locale.languageCode].containsKey(this)) {
280 return Get.translations[Get.locale.languageCode][this]; 281 return Get.translations[Get.locale.languageCode][this];
281 // If there is no corresponding language or corresponding key, return the key. 282 // If there is no corresponding language or corresponding key, return the key.
282 - } else if (Get.fallbackLocale == null) {  
283 - return this;  
284 - } else if (Get.translations.containsKey( 283 + } else if (Get.fallbackLocale != null) {
  284 + if (Get.translations.containsKey(
285 "${Get.fallbackLocale.languageCode}_${Get.fallbackLocale.countryCode}") && 285 "${Get.fallbackLocale.languageCode}_${Get.fallbackLocale.countryCode}") &&
286 Get.translations[ 286 Get.translations[
287 "${Get.fallbackLocale.languageCode}_${Get.fallbackLocale.countryCode}"] 287 "${Get.fallbackLocale.languageCode}_${Get.fallbackLocale.countryCode}"]
@@ -289,11 +289,11 @@ extension Trans on String { @@ -289,11 +289,11 @@ extension Trans on String {
289 return Get.translations[ 289 return Get.translations[
290 "${Get.fallbackLocale.languageCode}_${Get.fallbackLocale.countryCode}"] 290 "${Get.fallbackLocale.languageCode}_${Get.fallbackLocale.countryCode}"]
291 [this]; 291 [this];
292 -  
293 - // Checks if there is a callback language in the absence of the specific country, and if it contains that key.  
294 - } else if (Get.translations.containsKey(Get.fallbackLocale.languageCode) && 292 + }
  293 + if (Get.translations.containsKey(Get.fallbackLocale.languageCode) &&
295 Get.translations[Get.fallbackLocale.languageCode].containsKey(this)) { 294 Get.translations[Get.fallbackLocale.languageCode].containsKey(this)) {
296 return Get.translations[Get.fallbackLocale.languageCode][this]; 295 return Get.translations[Get.fallbackLocale.languageCode][this];
  296 + }
297 } else { 297 } else {
298 return this; 298 return this;
299 } 299 }