Class LocalizedString
- Namespace
- Sportradar.LiveData.Sdk.Common.Types
- Assembly
- Sportradar.LiveData.Sdk.dll
Localized string container where a string is represented by its international value and a collection of translations to other languages.
[Serializable]
public class LocalizedString : IEquatable<LocalizedString>
- Inheritance
-
LocalizedString
- Implements
- Inherited Members
- Extension Methods
Constructors
LocalizedString(string)
Constructs a new localized string.
public LocalizedString(string international_value)
Parameters
international_valuestringInternational value
Properties
AvailableTranslationLanguages
Available language codes this instance is translated to. For instance "de", "en" and so on.
public string[] AvailableTranslationLanguages { get; }
Property Value
- string[]
Remarks
Might be empty, then you still have the international name
International
Returns international string.
public string International { get; }
Property Value
Methods
AddTranslation(string, string)
Adds a new translation to the string. Overrides the previous language translations if existed.
public void AddTranslation(string lang, string translation)
Parameters
Equals(LocalizedString)
Check for equality.
public bool Equals(LocalizedString other)
Parameters
otherLocalizedStringother object
Returns
- bool
true when equal; false else
Remarks
Compares by the international value only.
Equals(object)
Check for equality.
public override bool Equals(object obj)
Parameters
objobjectother object
Returns
- bool
true when equal; false else
GetHashCode()
Serves as a hash function for a particular type.
public override int GetHashCode()
Returns
- int
Hash for current object
GetTranslation(string)
Returns translation for the specified language. Falls back to international string if translation does not exist.
public string GetTranslation(string lang)
Parameters
langstringLanguage code (null for international string)
Returns
- string
Translation for the specified language.
ToString()
Returns international string
public override string ToString()
Returns
- string
International string
Operators
operator ==(LocalizedString, LocalizedString)
Check for equality.
public static bool operator ==(LocalizedString x, LocalizedString y)
Parameters
xLocalizedStringFirst object
yLocalizedStringSecond object
Returns
- bool
true when equal; false else
Remarks
Compares by the international value only.
operator !=(LocalizedString, LocalizedString)
Check for non-equality.
public static bool operator !=(LocalizedString x, LocalizedString y)
Parameters
xLocalizedStringFirst object
yLocalizedStringSecond object
Returns
- bool
true when not equal; false else
Remarks
Compares by the international value only.