Class TlumachStringLocalizer
- Namespace
- Tlumach.Extensions.Localization
- Assembly
- Tlumach.Extensions.Localization.dll
The class that provides localization functionality.
public class TlumachStringLocalizer : IStringLocalizer
- Inheritance
-
TlumachStringLocalizer
- Implements
- Inherited Members
Properties
this[string]
Gets the localized string with the given name (key).
If the string contains placeholders, they are replaced with the placeholder names. To provide values for placeholders, use the this[string, object[]] property.
public LocalizedString this[string name] { get; }
Parameters
namestringThe name (key) of the string to return.
Property Value
- LocalizedString
The value of the string with an indicator of whether the localized string was found (if the resource was not found, the value from the default translation is returned).
this[string, object[]]
Gets the localized string with the given name (key).
If the string contains placeholders, they are replaced with the placeholder values provided in the arguments parameter.
public LocalizedString this[string name, params object[] arguments] { get; }
Parameters
namestringThe name (key) of the string to return.
argumentsobject[]The list of values to use to replace placeholders.
Property Value
- LocalizedString
The value of the string with an indicator of whether the localized string was found (if the resource was not found, the value from the default translation is returned).
Methods
GetAllStrings(bool)
Returns all localized strings contained in the translation for the given culture and, optionally, its parent cultures.
public IEnumerable<LocalizedString> GetAllStrings(bool includeParentCultures)
Parameters
includeParentCulturesboolIndicates whether the strings from the parent cultures should be returned.
Returns
- IEnumerable<LocalizedString>
The list of the localized strings. If the values from multiple cultures are returned, the string keys may overlap (Tlumach does not reduce the list to just unique keys).
WithCulture(CultureInfo)
Switches the culture, used by the localizer object when retrieving localized text.
public IStringLocalizer WithCulture(CultureInfo culture)
Parameters
cultureCultureInfoThe new culture to use.
Returns
- IStringLocalizer
The object, whose method was called.
WithTextProcessingMode(TextFormat)
Switches the text processing mode, used by the localizer object when processing text which contains placeholders.
public IStringLocalizer WithTextProcessingMode(TextFormat textProcessingMode)
Parameters
textProcessingModeTextFormatThe mode to use.
Returns
- IStringLocalizer
The object, whose method was called.