LocalizeAttributeTagHelper Class

Summary

Adds support for localizing html attributes, when using a localize-[attribute].
Namespace
Localization.AspNetCore.TagHelpers
Base Types
  • TagHelper
graph BT Type-->Base0["TagHelper"] Type["LocalizeAttributeTagHelper"] class Type type-node

Syntax

[HtmlTargetElement(Attributes = LOCALIZE_ATTRIBUTE_PREFIX + "*")]
public class LocalizeAttributeTagHelper : TagHelper

Examples

<abbr localize-title="This will be localized">This will not</abbr>
<abbr localize-title="This will be localized. {0}" params-title="This will not, but will be inserted as a parameter for title">This will not</abbr>

Attributes

Type Description
HtmlTargetElement

Constructors

Properties

Name Value Summary
AttributeValues IDictionary<string, string>
Gets or sets all the attribute values that are to be localized.
ParameterValues IDictionary<string, string>
Gets or sets the parameter values that are to be formatted into the localized attributes.
ViewContext ViewContext
Gets or sets the view context (automatically set when using razor views).

Methods

Name Value Summary
Init(TagHelperContext) void
Initializes the html localizer to use when localizing attributes.
Process(TagHelperContext, TagHelperOutput) void
Synchronously executes the TagHelper with the given context and output. This is the method responsible for localizing the html attributes.

See Also

  • Microsoft.AspNetCore.Razor.TagHelpers.TagHelper