LocalizedString class

A potentially localized (multilingual) string.

The translations are indexed by a BCP 47 language tag.

Mixed in types
  • JSONable

Properties

defaultTranslation Translation
The default translation for this localized string.
no setter
hashCode int
The hash code for this object.
no setterinherited
props List
The list of properties that will be used to determine whether two instances are equal.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
string String
The default translation string for this localized string. This is a shortcut for apps.
no setter
stringify bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited
translations Map<String?, Translation>
final

Methods

copy({Map<String?, Translation>? translations}) LocalizedString
copyWithString(String language, String string) LocalizedString
Returns a new LocalizedString after adding (or replacing) the translation with the given language.
getOrFallback(String? language) Translation?
Returns the first translation for the given language BCP–47 tag. If not found, then fallback:
mapLanguages(String transform(String?, Translation)) LocalizedString
Returns a new LocalizedString after applying the transform function to each language.
mapTranslations(Translation transform(String?, Translation)) LocalizedString
Returns a new LocalizedString after applying the transform function to each translation.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, String>
Serializes a LocalizedString to its RWPM JSON representation.
override
toString() String
A string representation of this object.
override

Operators

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

Static Methods

fromJson(dynamic json) LocalizedString?
Parses a LocalizedString from its RWPM JSON representation. If the localized string can't be parsed, a warning will be logged with warnings.
fromString(String string) LocalizedString
fromStrings(Map<String?, String> strings) LocalizedString

Constants

undefinedLanguage → const String
BCP-47 tag for an undefined language.