Translation class

Inheritance

Properties

autoTranslateEnable bool
getter/setter pair
connected bool
no setterinherited
defaultLocale Locale
getter/setter pair
defaultLocaleOrNull Locale?
getter/setter pair
delegate TranslationDelegate?
no setterinherited
fallbackLocale Locale
no setter
fallbackLocaleOrNull Locale?
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
isAutoTranslatedMode bool
no setter
loading bool
no setterinherited
locale Locale
getter/setter pair
localeOrNull Locale?
getter/setter pair
name String
no setterinherited
paths Set<String>
no setterinherited
props Map
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
separator String
getter/setter pair
showLogs bool
no setterinherited
supportedLocales Iterable<Locale>
getter/setter pair

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
cancelSubscriptions() Future<void>
inherited
changeConnection(bool value) Future<void>
inherited
dispose() → void
Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener will throw after the object is disposed).
override
initialize({required String name, TranslationDelegate? delegate, Set<String>? paths, Set<String>? symmetricPaths, bool connected = false, bool listening = true, bool showLogs = true, VoidCallback? onReady}) Future<void>
inherited
log(Object? msg) → void
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
reload({bool showLoading = false, bool notifiable = true}) Future<void>
inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
resubscribes() Future<void>
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

i Translation
no setter
languageCode String
no setter
textDirection TextDirection
no setter

Static Methods

changeDefaultLocale(Object? value) → void
changeLocale(Object? value) → void
changeSupportedLocales(Iterable value) → void
get<T extends Object?>({String? key, String? path, String? name, T? defaultValue, bool applyTranslator = true, List<String> autoTranslatorFields = const [], T? parser(Object?)?}) → T?
gets<T extends Object?>({String? key, String? path, String? name, List<T>? defaultValue, bool applyTranslator = true, List<String> autoTranslatorFields = const [], T? parser(Object?)?}) List<T>
init({String? name, TranslationDelegate? delegate, TranslatorDelegate? translator, Set<String>? paths, Set<String>? symmetricPaths, bool connected = false, bool listening = true, bool showLogs = true, bool autoTranslateMode = true, VoidCallback? onReady, String defaultPath = kDefaultTranslationPath, Object? locale, Object? defaultLocale, Object? fallbackLocale, Iterable? supportedLocales}) Future<void>
localize(String key, {String? name, String? defaultValue, bool applyNumber = false, bool applyRtl = false, bool applyTranslator = true, String replace(String)?, Map<String, Object?>? args}) String
final inp1 = "There {NUMBER > 1 ? \"are NUMBER items\" : \"is an item\"} in stock"; Translation.lt("key", defaultValue: inp1, args: {'NUMBER': 1}); // There is an item in stock Translation.lt("key", defaultValue: inp1, args: {'NUMBER': 2}); // There are 2 items in stock final inp2 = "Status: {STATUS == active ? \"activated!\" : \"canceled!\"}"; Translation.lt("key", defaultValue: inp2, args: {'STATUS': "active"}); // Status: activated! Translation.lt("key", defaultValue: inp2, args: {'STATUS': "inactive"}); // Status: canceled! final inp3 = "Status: {IS_ACTIVATED ? \"activated!\" : \"inactivated!\"}"; Translation.lt("key", defaultValue: inp3, args: {'IS_ACTIVATED': true}); // Status: activated! Translation.lt("key", defaultValue: inp3, args: {'IS_ACTIVATED': false}); // Status: inactivated! final inp4 = "Last seen: {TIME: {a:now, b:3 min ago}}"; Translation.lt("key", defaultValue: inp4, args: {"TIME": "a"}); // Last seen: now Translation.lt("key", defaultValue: inp4, args: {"TIME": "b"}); // Last seen: 3 min ago
localizes(String key, {String? name, List<String>? defaultValue, bool applyNumber = false, bool applyRtl = false, bool applyTranslator = true, String replace(String)?, Map<String, Object?>? args}) List<String>
parseLocale(Object? locale) Locale?
parseLocales(Iterable? values) Iterable<Locale>
selectLocale(BuildContext context, [String? reason]) → void
showLocales(BuildContext context, [String? reason]) Future<Locale?>
tr(String value) String
trNum(String value, {bool applyRtl = false}) String