Translations class
- Inheritance
-
- Object
- ITranslations
- Translations
Constructors
- Translations(String defaultLocaleStr)
- The default Translations constructor builds an empty translations object, that can be filled with translations with the + operator. For example:
-
Translations.from(String defaultLocaleStr, Map<
String, Map< translations)String, String> > -
The Translations.from constructor allows you to define the translations
as a const object, all at once. This not only is a little bit more
efficient, but it's also better for "hot reload", since a const variable
will respond to hot reloads, while final variables will not.
const
Properties
- defaultLanguageStr → String
-
no setterinherited
- defaultLocaleStr → String
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- length → int
-
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
translations
→ Map<
String, Map< String, String> > -
final
Methods
-
addTranslation(
{required String locale, required String key, required String translatedString}) → void -
Add a
key
/translatedString
pair to the translations. You must provide non-emptylocale
andkey
, but thetranslatedString
may be empty (for the case when some text shouldn't be displayed in some language). -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator *(
ITranslations translationsByLocale) → Translations - Combine this translation with another translation.
-
operator +(
Map< String, String> translations) → Translations -
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
String key) → Map< String, String> ? -
inherited
Static Properties
- missingKeyCallback ↔ void Function(String, String)
-
Replace this to log missing keys.
getter/setter pair
-
missingKeys
↔ Set<
TranslatedString> -
All missing keys and translations will be put here.
This may be used in tests to make sure no translations are missing.
getter/setter pair
- missingTranslationCallback ↔ void Function(String, String)
-
Replace this to log missing translations.
getter/setter pair
-
missingTranslations
↔ Set<
TranslatedString> -
getter/setter pair
- recordMissingKeys ↔ bool
-
getter/setter pair
- recordMissingTranslations ↔ bool
-
getter/setter pair