Table of Contents

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

culture CultureInfo

The language of value.

key string

The key.

value string

The 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

key string

The key.

value string

The string.

Localize(string, CultureInfo)

Gets the string for key in culture.

public string? Localize(string key, CultureInfo culture)

Parameters

key string

The key. A key with a context is context + '\u0004' + key, as gettext stores it.

culture CultureInfo

The language to localize into.

Returns

string

The string, or null when this localizer has none: the caller decides what to show. Implementations try culture's parents (ru-RU, then ru) when their source supports it.