Class LocalizedString
java.lang.Object
com.sportradar.livedata.sdk.feed.common.entities.LocalizedString
- All Implemented Interfaces:
Serializable
Localized string container where a string is represented by its international value and
a collection of translations to other languages.
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedFor SerializableLocalizedString(String internationalValue) Constructs a new localized string. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTranslation(String lang, String translation) Adds a new translation to the string.booleanequals(LocalizedString other) Check for equality.booleanCheck for equality.Available language codes this instance is translated to.Returns international string.getTranslation(String lang) Returns translation for the specified language.inthashCode()Serves as a hash function for a particular type.toString()Returns international string, if available.
-
Constructor Details
-
LocalizedString
Constructs a new localized string.- Parameters:
internationalValue- International value
-
LocalizedString
protected LocalizedString()For Serializable
-
-
Method Details
-
addTranslation
Adds a new translation to the string. Overrides the previous language translations if existed.- Parameters:
lang- Language codetranslation- Translation for this language
-
equals
Check for equality.Note : Compares by the international value only.
- Parameters:
other- other object- Returns:
- true when equal; false else
-
getAvailableTranslationLanguages
Available language codes this instance is translated to. For instance "de", "en" and so on.Note: Might be empty, then you still have the international name
- Returns:
- all available language codes
-
getInternational
Returns international string.- Returns:
- international value
-
getTranslation
Returns translation for the specified language. Falls back to international string if translation does not exist.- Parameters:
lang- Language code (null for international string)- Returns:
- Translation for the specified language.
-
hashCode
public int hashCode()Serves as a hash function for a particular type. -
equals
Check for equality. -
toString
Returns international string, if available.
-