IHtmlLocalizer Interface¶
Represents a type that that does HTML-aware localization of strings, by HTML encoding arguments that are formatted in the resource string.
- Namespace
Microsoft.AspNetCore.Mvc.Localization
- Assemblies
- Microsoft.AspNetCore.Mvc.Localization
Syntax¶
public interface IHtmlLocalizer
-
interface
Microsoft.AspNetCore.Mvc.Localization.
IHtmlLocalizer
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)
-
GetString
(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 GetString(string name)
-
GetString
(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: Returns: The formatted string resource as a
Microsoft.Extensions.Localization.LocalizedString
.LocalizedString GetString(string name, params object[] arguments)
-
WithCulture
(System.Globalization.CultureInfo)¶ Creates a new
Microsoft.AspNetCore.Mvc.Localization.IHtmlLocalizer
for a specificSystem.Globalization.CultureInfo
.Arguments: culture (System.Globalization.CultureInfo) – The System.Globalization.CultureInfo
to use.Return type: Microsoft.AspNetCore.Mvc.Localization.IHtmlLocalizer Returns: A culture-specific Microsoft.AspNetCore.Mvc.Localization.IHtmlLocalizer
.IHtmlLocalizer WithCulture(CultureInfo culture)
-
Properties¶
-
Microsoft.AspNetCore.Mvc.Localization.IHtmlLocalizer.
Item[System.String]
¶ Gets the string resource with the given name.
Arguments: name (System.String) – The name of the string resource. Return type: Microsoft.AspNetCore.Mvc.Localization.LocalizedHtmlString Returns: The string resource as a Microsoft.AspNetCore.Mvc.Localization.LocalizedHtmlString
.LocalizedHtmlString this[string name] { get; }
-
Microsoft.AspNetCore.Mvc.Localization.IHtmlLocalizer.Item[System.String, System.Object[]]
Gets the string resource with the given name and formatted with the supplied arguments. The arguments will be HTML encoded.
Arguments: - name (System.String) – The name of the string resource.
- arguments (System.Object<System.Object>[]) – The values to format the string with.
Return type: Returns: The formatted string resource as a
Microsoft.AspNetCore.Mvc.Localization.LocalizedHtmlString
.LocalizedHtmlString this[string name, params object[] arguments] { get; }
-