Table of Contents

Class TlumachViewLocalizationOptions

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

Options of the Tlumach view localization, set with AddTlumachViewLocalization(IMvcBuilder, Action<TlumachViewLocalizationOptions>?).

The options are read when a view is first localized; change them only while the application starts.

public sealed class TlumachViewLocalizationOptions
Inheritance
TlumachViewLocalizationOptions
Inherited Members

Properties

ViewKeyPrefix

Gets or sets the function that returns the key prefix of a view from its path (e.g. "/Views/Home/Index.cshtml" → "Views.Home.Index."). A key of the view is looked up with the prefix first and then without it. Returning null or an empty string disables the prefix.

The prefix without its trailing dot is also the context, for which the options of AddTlumachLocalization are requested, so a view can use its own translation file.

public Func<string, string?> ViewKeyPrefix { get; set; }

Property Value

Func<string, string>

ViewLocationExpanderFormat

Gets or sets the format of the culture-specific view files that LanguageViewLocationExpander finds (e.g. "Index.de.cshtml"), or null to not add the expander. The default is Suffix.

public LanguageViewLocationExpanderFormat? ViewLocationExpanderFormat { get; set; }

Property Value

LanguageViewLocationExpanderFormat?

Methods

DefaultViewKeyPrefix(string)

Returns the default key prefix of a view: the path without the leading slash and the extension, with slashes replaced by dots, followed by a dot.

public static string? DefaultViewKeyPrefix(string viewPath)

Parameters

viewPath string

The application-relative path of the view, e.g. "/Pages/Privacy.cshtml".

Returns

string

The prefix, e.g. "Pages.Privacy.", or null for an empty path.