Class DictionaryLocalizer
- Namespace
- Icy.Localization
- Assembly
- IcyUI.dll
Localized strings added from code, per culture. Also a safety net at the end of a CompositeLocalizer.
public sealed class DictionaryLocalizer : ILocalizer, IEnumerable
- Inheritance
-
DictionaryLocalizer
- Implements
- Inherited Members
- Extension Methods
Remarks
A lookup tries the culture, its parents (ru-RU, then ru), then the strings added without a culture.
Supports collection initializers: new DictionaryLocalizer { { ru, "Menu.Play", "Играть" } }.
Methods
Add(CultureInfo, string, string)
Adds or replaces the string for key in culture.
public void Add(CultureInfo culture, string key, string value)
Parameters
cultureCultureInfoThe language of
value.keystringThe key.
valuestringThe localized string.
Add(string, string)
Adds or replaces the string for key used when no culture-specific one exists.
public void Add(string key, string value)
Parameters
Localize(string, CultureInfo)
Gets the string for key in culture.
public string? Localize(string key, CultureInfo culture)
Parameters
keystringThe key. A key with a context is
context + '\u0004' + key, as gettext stores it.cultureCultureInfoThe language to localize into.