Table of Contents

Class TlumachTextTagHelper

Namespace
Tlumach.AspNetCore.Mvc
Assembly
Tlumach.AspNetCore.Mvc.dll

Renders a translation without a wrapping element: <tlumach-text key="Welcome" />. Attributes: key, unit, args, arg-*, culture; the rules are those of TlumachKeyTagHelper: a key is looked up with the prefix of the file that is being executed, then with the prefix of the main view (a @section runs in the context of the layout), then without a prefix. An invalid culture name throws CultureNotFoundException.

[HtmlTargetElement("tlumach-text")]
public sealed class TlumachTextTagHelper : TagHelper, ITagHelper, ITagHelperComponent
Inheritance
TlumachTextTagHelper
Implements
Inherited Members

Constructors

TlumachTextTagHelper(IHtmlLocalizerFactory)

Initializes a new instance of the TlumachTextTagHelper class.

public TlumachTextTagHelper(IHtmlLocalizerFactory factory)

Parameters

factory IHtmlLocalizerFactory

The factory registered by AddTlumachViewLocalization(IMvcBuilder, Action<TlumachViewLocalizationOptions>?).

Properties

Args

Gets or sets the positional placeholder values.

[HtmlAttributeName("args")]
public IReadOnlyList<object?>? Args { get; set; }

Property Value

IReadOnlyList<object>

Culture

Gets or sets the name of the culture to use instead of the culture of the request.

[HtmlAttributeName("culture")]
public string? Culture { get; set; }

Property Value

string

Key

Gets or sets the key of the translation.

[HtmlAttributeName("key")]
public string? Key { get; set; }

Property Value

string

NamedArgs

Gets or sets the named placeholder values, set with arg-{name} attributes.

[HtmlAttributeName("all-args", DictionaryAttributePrefix = "arg-")]
public IDictionary<string, object?> NamedArgs { get; set; }

Property Value

IDictionary<string, object>

Unit

Gets or sets the translation unit, e.g. a unit of a class created by Tlumach Generator.

[HtmlAttributeName("unit")]
public BaseTranslationUnit? Unit { get; set; }

Property Value

BaseTranslationUnit

ViewContext

Gets or sets the context of the view; set by Razor.

[ViewContext]
[HtmlAttributeNotBound]
public ViewContext ViewContext { get; set; }

Property Value

ViewContext

Methods

Process(TagHelperContext, TagHelperOutput)

Synchronously executes the TagHelper with the given context and output.

public override void Process(TagHelperContext context, TagHelperOutput output)

Parameters

context TagHelperContext

Contains information associated with the current HTML tag.

output TagHelperOutput

A stateful HTML element used to generate an HTML tag.