Class StringLocalizer
class representing a localized string.
Inheritance
Inherited Members
Namespace: TimeCockpit.Data.Localization.Default
Assembly: TimeCockpit.Data.dll
Syntax
public class StringLocalizer : IEnumerable<LocalizedString>, IEnumerable
Constructors
StringLocalizer(String)
Initializes a new instance of the StringLocalizer class.
Declaration
public StringLocalizer(string technicalName)
Parameters
Type | Name | Description |
---|---|---|
System.String | technicalName | The technical name of the string localizer. |
StringLocalizer(StringLocalizer)
Initializes a new instance of the StringLocalizer class.
Declaration
public StringLocalizer(StringLocalizer source)
Parameters
Type | Name | Description |
---|---|---|
StringLocalizer | source | the source to copy from. |
Properties
Cultures
Gets an enumerable over all cultures stored in the string localizer.
Declaration
public IEnumerable<string> Cultures { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.String> |
DeletedCultures
Gets the deleted cultures.
Declaration
public IEnumerable<string> DeletedCultures { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.String> |
Item[String]
The indexer by culture.
Declaration
public string this[string culture] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.String | culture | the culture of the name. |
Property Value
Type | Description |
---|---|
System.String | Returns the localized string. |
TechnicalName
Gets the technical name of the localizer.
Declaration
public string TechnicalName { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
ClearDirtyFlag()
Clears the dirty flag for the localizer as well as nested items.
Declaration
public void ClearDirtyFlag()
ContainsCulture(String)
Returns true if the culture is set, false otherwise.
Declaration
public bool ContainsCulture(string culture)
Parameters
Type | Name | Description |
---|---|---|
System.String | culture | the culture to check. |
Returns
Type | Description |
---|---|
System.Boolean | returns true if the culture exists, false otherwise. |
Get(String)
Gets the localized string for the given culture.
Declaration
public LocalizedString Get(string culture)
Parameters
Type | Name | Description |
---|---|---|
System.String | culture | the culture to get a LocalizedString for. |
Returns
Type | Description |
---|---|
LocalizedString | Returns the LocalizedString. |
GetEnumerator()
Get an enumerator over all localized strings.
Declaration
public IEnumerator<LocalizedString> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<LocalizedString> | Returns the enumerator across all localizations. |
Implements
MergeFrom(StringLocalizer)
Merges changes from the source to this instance.
Declaration
public void MergeFrom(StringLocalizer source)
Parameters
Type | Name | Description |
---|---|---|
StringLocalizer | source | the source to retrieve updates from. |
OnValueChanged()
Calls the ValueChanged event.
Declaration
protected void OnValueChanged()
RemoveAllCultures()
removes all cultures.
Declaration
public void RemoveAllCultures()
RemoveCulture(String)
removes the culture from the localized string.
Declaration
public void RemoveCulture(string culture)
Parameters
Type | Name | Description |
---|---|---|
System.String | culture | the culture to remove. |
TryGetLocalization(String, out LocalizedString)
Tries to retireve a localized string from the localizations backing collection.
Declaration
public bool TryGetLocalization(string culture, out LocalizedString localizedString)
Parameters
Type | Name | Description |
---|---|---|
System.String | culture | the culture to retrieve. |
LocalizedString | localizedString | the resulting localized string. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if a value was retrieved, false otherwise. |
Update(IEnumerable<KeyValuePair<Object, Object>>)
Helper update method for python ease-of-use.
Declaration
public void Update(IEnumerable<KeyValuePair<object, object>> localizations)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.Object, System.Object>> | localizations | the localizations to update. |
Update(IEnumerable<LocalizedString>)
Updates the localizations.
Declaration
public void Update(IEnumerable<LocalizedString> localizations)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<LocalizedString> | localizations | the localizations to update. |
Update(String, String)
helper to update a single instance.
Declaration
public void Update(string culture, string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | culture | the culture to update for. |
System.String | text | the text of the culture. |
Update(LocalizedString)
Updates the string for a specific culture.
Declaration
public void Update(LocalizedString localization)
Parameters
Type | Name | Description |
---|---|---|
LocalizedString | localization | the localization to update. |
Events
ValueChanged
Event fired when a new generic key is added.
Declaration
public event EventHandler ValueChanged
Event Type
Type | Description |
---|---|
System.EventHandler |
Explicit Interface Implementations
IEnumerable.GetEnumerator()
Get an enumerator over all localized strings.
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator | Returns the enumerator across all localizations. |