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
factoryIHtmlLocalizerFactoryThe 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
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
Contextualize(ViewContext)
Contextualizes the instance with the specified viewContext.
public void Contextualize(ViewContext viewContext)
Parameters
viewContextViewContextThe ViewContext.
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.