tr method
Returns the translated string for the given key and optional locale.
If translation is not immediately available, returns key and translates in background.
Implementation
String tr(String key, [Locale? locale]) {
locale ??= _currentLocale;
final localeCache = _cache[locale.toString()] ?? {};
if (localeCache.containsKey(key)) return localeCache[key] ?? key;
if (_fallbackLanguage != locale) _cache[locale.toString()] = localeCache;
_translateInBackground(key, locale);
return key;
}