DataWeb
Search Results for

    Show / Hide Table of Contents

    Class Localizer

    Provides localized string resources for an application.

    Inheritance
    object
    Localizer
    Implements
    IStringLocalizer
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: DataWeb.Localization
    Assembly: DataWeb.Core.dll
    Syntax
    public sealed class Localizer : IStringLocalizer
    Remarks

    Initializes a new instance of the Localizer class.

    Constructors

    Localizer(ILocalizationService, IHttpContextAccessor)

    Provides localized string resources for an application.

    Declaration
    public Localizer(ILocalizationService localizationService, IHttpContextAccessor httpContextAccessor)
    Parameters
    Type Name Description
    ILocalizationService localizationService

    The ILocalizationService implementation to use.

    IHttpContextAccessor httpContextAccessor
    Remarks

    Initializes a new instance of the Localizer class.

    Fields

    Culture

    Declaration
    public string Culture
    Field Value
    Type Description
    string

    Properties

    this[string]

    Gets the localized string for the specified name.

    Declaration
    public LocalizedString this[string name] { get; }
    Parameters
    Type Name Description
    string name

    The name of the resource.

    Property Value
    Type Description
    LocalizedString

    The localized string for the specified name.

    this[string, object[]]

    Gets the localized string for the specified name and formats it with the specified arguments.

    Declaration
    public LocalizedString this[string name, params object[] arguments] { get; }
    Parameters
    Type Name Description
    string name

    The name of the resource.

    object[] arguments

    The arguments to format the string.

    Property Value
    Type Description
    LocalizedString

    The formatted localized string for the specified name.

    Methods

    GetAllStrings(bool)

    Gets all the localized strings for this localizer instance.

    Declaration
    public IEnumerable<LocalizedString> GetAllStrings(bool includeParentCultures)
    Parameters
    Type Name Description
    bool includeParentCultures

    True to include localized strings from parent cultures, false otherwise.

    Returns
    Type Description
    IEnumerable<LocalizedString>

    All the localized strings for this localizer instance.

    WithCulture(string)

    Gets a new localizer instance with the specified culture.

    Declaration
    public IStringLocalizer WithCulture(string culture)
    Parameters
    Type Name Description
    string culture

    The culture for the new localizer instance.

    Returns
    Type Description
    IStringLocalizer

    A new localizer instance with the specified culture.

    Implements

    IStringLocalizer
    In this article
    Back to top Generated by DocFX