LocalizeTagHelper Class

Summary

Adds support to localize the everything with the localize tag.
graph BT Type-->Base0["GenericLocalizeTagHelper"] click Base0 "/Localization.AspNetCore.TagHelpers/api/Localization.AspNetCore.TagHelpers/GenericLocalizeTagHelper" Base0-->Base1["TagHelper"] Type["LocalizeTagHelper"] class Type type-node

Syntax

[HtmlTargetElement(LOCALIZE_TAG_NAME)]
public class LocalizeTagHelper : GenericLocalizeTagHelper

Examples

<localize>
To text to localize goes here
</localize>

Attributes

Type Description
HtmlTargetElement

Constructors

Properties

Name Value Summary
IsHtml bool
Gets or sets a value indicating whether the inner text should be treated as HTML (no encoding).
Localizer IHtmlLocalizer
Gets or sets the localizer to use when resolving the specified strings.
Name string
Gets or sets the name to optionally override the name/path of the resource file. If the name is empty it resolves to the current path and name of the view. i.e the view located at "~/Views/Home/About.cshtml" passes the following name to the html localizer as Views/Home/About.
NewLineHandling NewLineHandling
Gets or sets the new line handing method.
SupportsParameters bool
Gets a value indicating whether this localizer tag helper supports parameters.
TrimEachLine bool
Gets or sets a value indicating whether to trim whitespace on each line. If enabled, this will override the .
TrimWhitespace bool
Gets or sets a value indicating whether beginning and ending whitespace.
Type Type
Gets or sets the type to use when looking up the resource file.
ViewContext ViewContext
Gets or sets the view context (automatically set when using razor views).

Methods

Name Value Summary
GetContentAsync(TagHelperContext, TagHelperOutput) Task<string>
Gets the content/text that are to be localized.
GetParameters(TagHelperContext) IEnumerable<object>
Gets the parameters to use when localizing the text.
Init(TagHelperContext) void
Initializes this Localize Tag Helpers, setting the html localizer and creating a stack list for child tag helpers to add parameters to.
ProcessAsync(TagHelperContext, TagHelperOutput) Task
This function first calls the base ProcessAsync method, then removes the tag name.
SetContent(TagHelperContext, TagHelperContent, string) void
Sets the localized content back to where the original content was.
SetHtmlContent(TagHelperContext, TagHelperContent, IHtmlContent) void
Sets the localized content without encoding it back to where the original content was.

See Also