ViewLocalizer Class

An Microsoft.AspNetCore.Mvc.Localization.IViewLocalizer implementation that derives the resource location from the executing view’s file path.

Namespace
Microsoft.AspNetCore.Mvc.Localization
Assemblies
  • Microsoft.AspNetCore.Mvc.Localization

Syntax

public class ViewLocalizer : IViewLocalizer, IHtmlLocalizer, IViewContextAware
class Microsoft.AspNetCore.Mvc.Localization.ViewLocalizer

Constructors

ViewLocalizer(Microsoft.AspNetCore.Mvc.Localization.IHtmlLocalizerFactory, Microsoft.AspNetCore.Hosting.IHostingEnvironment)

Creates a new Microsoft.AspNetCore.Mvc.Localization.ViewLocalizer.

Arguments:
public ViewLocalizer(IHtmlLocalizerFactory localizerFactory, IHostingEnvironment hostingEnvironment)

Methods

Contextualize(Microsoft.AspNetCore.Mvc.Rendering.ViewContext)

Apply the specified Microsoft.AspNetCore.Mvc.Rendering.ViewContext.

Arguments:viewContext (Microsoft.AspNetCore.Mvc.Rendering.ViewContext) – The Microsoft.AspNetCore.Mvc.Rendering.ViewContext.
public void Contextualize(ViewContext viewContext)
GetAllStrings(System.Boolean)
Return type:System.Collections.Generic.IEnumerable<Microsoft.Extensions.Localization.LocalizedString>
public IEnumerable<LocalizedString> GetAllStrings(bool includeParentCultures)
GetString(System.String)
Return type:Microsoft.Extensions.Localization.LocalizedString
public LocalizedString GetString(string name)
GetString(System.String, System.Object[])
Return type:Microsoft.Extensions.Localization.LocalizedString
public LocalizedString GetString(string name, params object[] values)
WithCulture(System.Globalization.CultureInfo)
Return type:Microsoft.AspNetCore.Mvc.Localization.IHtmlLocalizer
public IHtmlLocalizer WithCulture(CultureInfo culture)

Properties

Microsoft.AspNetCore.Mvc.Localization.ViewLocalizer.Item[System.String]
Return type:Microsoft.AspNetCore.Mvc.Localization.LocalizedHtmlString
public virtual LocalizedHtmlString this[string key] { get; }
Microsoft.AspNetCore.Mvc.Localization.ViewLocalizer.Item[System.String, System.Object[]]
Return type:Microsoft.AspNetCore.Mvc.Localization.LocalizedHtmlString
public virtual LocalizedHtmlString this[string key, params object[] arguments] { get; }