Class LocalizedString
Represents a collection of culture-annotated strings.
Inherited Members
Namespace: SdlSdl.LanguagePlatformCoreSegmentation
Assembly: Sdl.LanguagePlatform.Core.dll
Syntax
[DataContract]
public class LocalizedString : IEnumerable<CultureString>, IEnumerable, ICloneable
Constructors
LocalizedString()
Initializes a new instance with default values.
Declaration
public LocalizedString()
LocalizedString(LocalizedString)
Initializes a new instance with the values of another instance, creating a deep copy.
Declaration
public LocalizedString(LocalizedString other)
Parameters
Type | Name | Description |
---|---|---|
LocalizedString | other | The other instance |
LocalizedString(string)
Creates a new instance with the InvariantText set to the provided text.
Declaration
public LocalizedString(string text)
Parameters
Type | Name | Description |
---|---|---|
string | text | The text to use for the invariant culture |
Properties
Count
Returns the number of localized versions of the string.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
int |
InvariantText
Accesses the localized text which is compatible with the invariant culture.
Declaration
public string InvariantText { get; set; }
Property Value
Type | Description |
---|---|
string |
Text
Accesses the localized text which is compatible with the current UI culture.
Declaration
public string Text { get; set; }
Property Value
Type | Description |
---|---|
string |
Methods
Add(object)
Only used for XML deserialization.
Declaration
public void Add(object o)
Parameters
Type | Name | Description |
---|---|---|
object | o |
Clone()
Declaration
public object Clone()
Returns
Type | Description |
---|---|
object | A new object that is a deep copy of this instance. |
DeleteText(CultureCode)
Deletes the text compatible with the provided culture.
Declaration
public void DeleteText(CultureCode culture)
Parameters
Type | Name | Description |
---|---|---|
CultureCode | culture | The culture |
DeleteText(CultureCode, bool)
Deletes the text for the provided culture.
Declaration
public void DeleteText(CultureCode culture, bool mayFallback)
Parameters
Type | Name | Description |
---|---|---|
CultureCode | culture | The culture |
bool | mayFallback | If false, the culture of the text and the provided culture must match exactly. Otherwise, it is sufficient if the cultures are compatible. If an exact match for the culture is available, it will still be preferred. |
GetEnumerator()
Returns an enumerator which is used to enumerate the encapsulated culture-annotated strings.
Declaration
public IEnumerator<CultureString> GetEnumerator()
Returns
Type | Description |
---|---|
IEnumeratorCultureString | An enumerator |
GetText(CultureCode)
Returns the text compatible with the provided culture.
Declaration
public string GetText(CultureCode culture)
Parameters
Type | Name | Description |
---|---|---|
CultureCode | culture |
Returns
Type | Description |
---|---|
string |
GetText(CultureCode, bool)
Returns the text for the provided culture.
Declaration
public string GetText(CultureCode culture, bool mayFallback)
Parameters
Type | Name | Description |
---|---|---|
CultureCode | culture | The culture (non-null) |
bool | mayFallback | If false, the culture of the text and the provided culture must match exactly. Otherwise, it is sufficient if the cultures are compatible. If an exact match for the culture is available, it will still be preferred. |
Returns
Type | Description |
---|---|
string |
SetText(CultureCode, string)
Sets (adds or overwrites) the text compatible with the provided culture.
Declaration
public void SetText(CultureCode culture, string text)
Parameters
Type | Name | Description |
---|---|---|
CultureCode | culture | The culture (non-null) |
string | text | The text |
SetText(CultureCode, string, bool)
Sets the text for the provided culture.
Declaration
public void SetText(CultureCode culture, string text, bool mayFallback)
Parameters
Type | Name | Description |
---|---|---|
CultureCode | culture | The culture (non-null) |
string | text | The text |
bool | mayFallback | If false, the culture of the text and the provided culture must match exactly. Otherwise, it is sufficient if the cultures are compatible. If an exact match for the culture is available, it will still be preferred. |
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string representation of the object, for display purposes. |