IStringLocalizer Interface

Represents a service that provides localized strings.

Namespace
Microsoft.Extensions.Localization
Assemblies
  • Microsoft.Extensions.Localization.Abstractions

Syntax

public interface IStringLocalizer
interface Microsoft.Extensions.Localization.IStringLocalizer

Methods

GetAllStrings(System.Boolean)

Gets all string resources.

Arguments:includeParentCultures (System.Boolean) – A System.Boolean indicating whether to include strings from parent cultures.
Return type:System.Collections.Generic.IEnumerable<Microsoft.Extensions.Localization.LocalizedString>
Returns:The strings.
IEnumerable<LocalizedString> GetAllStrings(bool includeParentCultures)
WithCulture(System.Globalization.CultureInfo)

Creates a new Microsoft.Extensions.Localization.IStringLocalizer for a specific System.Globalization.CultureInfo.

Arguments:culture (System.Globalization.CultureInfo) – The System.Globalization.CultureInfo to use.
Return type:Microsoft.Extensions.Localization.IStringLocalizer
Returns:A culture-specific Microsoft.Extensions.Localization.IStringLocalizer.
IStringLocalizer WithCulture(CultureInfo culture)

Properties

Microsoft.Extensions.Localization.IStringLocalizer.Item[System.String]

Gets the string resource with the given name.

Arguments:name (System.String) – The name of the string resource.
Return type:Microsoft.Extensions.Localization.LocalizedString
Returns:The string resource as a Microsoft.Extensions.Localization.LocalizedString.
LocalizedString this[string name] { get; }
Microsoft.Extensions.Localization.IStringLocalizer.Item[System.String, System.Object[]]

Gets the string resource with the given name and formatted with the supplied arguments.

Arguments:
  • name (System.String) – The name of the string resource.
  • arguments (System.Object<System.Object>[]) – The values to format the string with.
Return type:

Microsoft.Extensions.Localization.LocalizedString

Returns:

The formatted string resource as a Microsoft.Extensions.Localization.LocalizedString.

LocalizedString this[string name, params object[] arguments] { get; }