Class TlumachHtmlLocalizer
- Namespace
- Tlumach.AspNetCore.Mvc
- Assembly
- Tlumach.AspNetCore.Mvc.dll
An IHtmlLocalizer backed by a Tlumach translation manager.
The translation is trusted HTML and is not encoded; the values of its placeholders are HTML-encoded, except IHtmlContent values,
which are inserted as they are. All Tlumach placeholders are supported: {0}, {name}, ICU plural and select, dates, and numbers.
A single IReadOnlyDictionary<TKey, TValue> argument supplies named values. WebEncodeValues does not affect the HTML.
The braces of the rendered HTML are doubled in Value, which MVC treats as a format string; WriteTo(TextWriter, HtmlEncoder) writes the HTML exactly.
public sealed class TlumachHtmlLocalizer : IHtmlLocalizer
- Inheritance
-
TlumachHtmlLocalizer
- Implements
- Inherited Members
Properties
this[string]
Gets the string resource with the given name.
public LocalizedHtmlString this[string name] { get; }
Parameters
namestringThe name of the string resource.
Property Value
- LocalizedHtmlString
The string resource as a LocalizedHtmlString.
this[string, object[]]
Gets the string resource with the given name and formatted with the supplied arguments. The arguments will be HTML encoded.
public LocalizedHtmlString this[string name, params object[] arguments] { get; }
Parameters
namestringThe name of the string resource.
argumentsobject[]The values to format the string with.
Property Value
- LocalizedHtmlString
The formatted string resource as a LocalizedHtmlString.
Methods
GetAllStrings(bool)
Gets all string resources.
public IEnumerable<LocalizedString> GetAllStrings(bool includeParentCultures)
Parameters
Returns
- IEnumerable<LocalizedString>
The strings.
GetString(string)
Gets the string resource with the given name.
public LocalizedString GetString(string name)
Parameters
namestringThe name of the string resource.
Returns
- LocalizedString
The string resource as a LocalizedString.
GetString(string, params object[])
Gets the string resource with the given name and formatted with the supplied arguments.
public LocalizedString GetString(string name, params object[] arguments)
Parameters
namestringThe name of the string resource.
argumentsobject[]The values to format the string with.
Returns
- LocalizedString
The formatted string resource as a LocalizedString.