TranslatorInMemory class

A Translator with a inn-memory set of translations.

  • Useful for unit tests.
Inheritance

Constructors

TranslatorInMemory({String keyNormalizer(String key)?, TranslatorLogger? logger})

Properties

cache TranslatorCache?
Optional Translator cache.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
keyNormalizer ↔ (String Function(String key)?)
Optional translation key normalizer.
getter/setter pair
logger TranslatorLogger?
Optional logger.
finalinherited
maxBlockLength int
Returns the maximum length of a block. See splitBlocks.
no setteroverride
maxParallelTranslations int
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
translateBlocksInParallel bool
finalinherited

Methods

addAllTranslations(Map<IntlLocale, Map<IntlLocale, Map<String, Map<String, String>>>> translations) → void
Adds all translations in translations Map. See addTranslations;
addTranslation(IntlLocale fromLocale, IntlLocale toLocale, String key, String message, String translation) → void
Adds a translation to the in-memory set.
addTranslations(IntlLocale fromLocale, IntlLocale toLocale, Map<String, Map<String, String>> translations) → void
Add all entries in translations to the in-memory set. See addTranslation.
cacheEntries(Map<String, String> entries, Map<String, String> translations, IntlLocale fromLocale, IntlLocale toLocale) FutureOr<List<bool>?>
Cache translated entries (if cache is provided).
inherited
clearTranslations() → void
Clears the in-memory set of translations.
getCachedEntries(Map<String, String> entries, IntlLocale fromLocale, IntlLocale toLocale) FutureOr<Map<String, String>?>
Returns the cached translations for entries (if cache is provided).
inherited
log(Object o) → void
Logs o calling logger.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolveLocaleName(IntlLocale locale) String
Resolves locale to the language name.
inherited
splitBlocks(List<MapEntry<String, String>> entries) List<List<MapEntry<String, String>>>
Split entries into blocks.
inherited
toString() String
A string representation of this object.
inherited
translate(Map<String, String> entries, IntlLocale fromLocale, IntlLocale toLocale, {bool confirm = true}) FutureOr<Map<String, String>?>
Translates entries to locale.
inherited
translateBlock(Map<String, String> entries, IntlLocale fromLocale, IntlLocale toLocale, String fromLanguage, String toLanguage, bool confirm) FutureOr<Map<String, String>?>
Translates an entries block. Called by translate.
override
translateEntry(IntlLocale fromLocale, IntlLocale toLocale, String key, String message) String

Operators

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