Class LocalizedString
Represents a collection of culture-annotated strings.
Inheritance
Implements
Inherited Members
Namespace: Sdl.LanguagePlatform.Core.Segmentation
Assembly: Sdl.LanguagePlatform.Core.dll
Syntax
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 |
---|---|---|
System.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 |
---|---|
System.Int32 |
InvariantText
Accesses the localized text which is compatible with the invariant culture.
Declaration
public string InvariantText { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Text
Accesses the localized text which is compatible with the current UI culture.
Declaration
public string Text { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Methods
Add(Object)
Only used for XML deserialization.
Declaration
public void Add(object o)
Parameters
Type | Name | Description |
---|---|---|
System.Object | o |
Clone()
Declaration
public object Clone()
Returns
Type | Description |
---|---|
System.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 |
---|---|---|
Sdl.Core.Globalization.CultureCode | culture | The culture |
DeleteText(CultureCode, Boolean)
Deletes the text for the provided culture.
Declaration
public void DeleteText(CultureCode culture, bool mayFallback)
Parameters
Type | Name | Description |
---|---|---|
Sdl.Core.Globalization.CultureCode | culture | The culture |
System.Boolean | 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 |
---|---|
System.Collections.Generic.IEnumerator<CultureString> | An enumerator |
GetText(CultureCode)
Returns the text compatible with the provided culture.
Declaration
public string GetText(CultureCode culture)
Parameters
Type | Name | Description |
---|---|---|
Sdl.Core.Globalization.CultureCode | culture |
Returns
Type | Description |
---|---|
System.String |
GetText(CultureCode, Boolean)
Returns the text for the provided culture.
Declaration
public string GetText(CultureCode culture, bool mayFallback)
Parameters
Type | Name | Description |
---|---|---|
Sdl.Core.Globalization.CultureCode | culture | The culture (non-null) |
System.Boolean | 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 |
---|---|
System.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 |
---|---|---|
Sdl.Core.Globalization.CultureCode | culture | The culture (non-null) |
System.String | text | The text |
SetText(CultureCode, String, Boolean)
Sets the text for the provided culture.
Declaration
public void SetText(CultureCode culture, string text, bool mayFallback)
Parameters
Type | Name | Description |
---|---|---|
Sdl.Core.Globalization.CultureCode | culture | The culture (non-null) |
System.String | text | The text |
System.Boolean | 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 |
---|---|
System.String | A string representation of the object, for display purposes. |
Overrides
Explicit Interface Implementations
IEnumerable.GetEnumerator()
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator |