Table of Contents

Class TlumachViewLocalizer

Namespace
Tlumach.AspNetCore.Mvc
Assembly
Tlumach.AspNetCore.Mvc.dll

An IViewLocalizer backed by Tlumach. A key is looked up with the prefix of the view (ViewKeyPrefix, e.g. "Views.Home.Index.Title") and then without it ("Title"), so that views can share texts. Partial views and layouts use their own prefix. The encoding rules are those of TlumachHtmlLocalizer.

public sealed class TlumachViewLocalizer : IViewLocalizer, IHtmlLocalizer, IViewContextAware
Inheritance
TlumachViewLocalizer
Implements
Inherited Members

Constructors

TlumachViewLocalizer(IHtmlLocalizerFactory)

Initializes a new instance of the TlumachViewLocalizer class.

public TlumachViewLocalizer(IHtmlLocalizerFactory factory)

Parameters

factory IHtmlLocalizerFactory

The factory registered by AddTlumachViewLocalization(IMvcBuilder, Action<TlumachViewLocalizationOptions>?).

Properties

this[string]

Gets the string resource with the given name.

public LocalizedHtmlString this[string name] { get; }

Parameters

name string

The 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

name string

The name of the string resource.

arguments object[]

The values to format the string with.

Property Value

LocalizedHtmlString

The formatted string resource as a LocalizedHtmlString.

Methods

Contextualize(ViewContext)

Contextualizes the instance with the specified viewContext.

public void Contextualize(ViewContext viewContext)

Parameters

viewContext ViewContext

The ViewContext.

GetAllStrings(bool)

Gets all string resources.

public IEnumerable<LocalizedString> GetAllStrings(bool includeParentCultures)

Parameters

includeParentCultures bool

A bool indicating whether to include strings from parent cultures.

Returns

IEnumerable<LocalizedString>

The strings.

GetString(string)

Gets the string resource with the given name.

public LocalizedString GetString(string name)

Parameters

name string

The 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

name string

The name of the string resource.

arguments object[]

The values to format the string with.

Returns

LocalizedString

The formatted string resource as a LocalizedString.