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