Table of Contents

Class TlumachLocalizationOptions

Namespace
Tlumach.Extensions.Localization
Assembly
Tlumach.Extensions.Localization.dll

The options that tell the localizers where to take the translations from: an existing TranslationManager, a TranslationConfiguration, or a default translation file embedded into an assembly.

The default options are set in the callback passed to AddTlumachLocalization(IServiceCollection, Action<TlumachLocalizationOptions>, Action<TlumachSettingsProvider>?), and the options of a context are returned by GetOptionsFor(string).

public sealed class TlumachLocalizationOptions
Inheritance
TlumachLocalizationOptions
Inherited Members

Properties

Assembly

Gets or sets the optional reference to the assembly that contains the DefaultFile and the translation files as embedded resources.

The value of this property is used when both TranslationManager and Configuration are null. If it is not set, the files are loaded from the entry assembly of the process, i.e. the application. This rule is the same for the string localizers and for the HTML and view localizers, model binding messages, and display names of Tlumach.AspNetCore.Mvc. A library whose translation files are embedded into the library itself must set this property, e.g. to typeof(SomeTypeOfTheLibrary).Assembly.

public Assembly? Assembly { get; set; }

Property Value

Assembly

Configuration

Gets or sets the configuration that should be used to retrieve localized strings.

A new instance of TranslationManager is created using this configuration.

This property has priority unless TranslationManager is set.

public TranslationConfiguration? Configuration { get; set; }

Property Value

TranslationConfiguration

DefaultFile

Gets or sets the optional name of the default translation file.

The value of this property must be provided when both TranslationManager and Configuration are null because it is used to access localized strings.

public string? DefaultFile { get; set; }

Property Value

string

DefaultFileLocale

Gets or sets an optional indicator of the locale of the strings in the DefaultFile translation file.

public string? DefaultFileLocale { get; set; }

Property Value

string

TextProcessingMode

Gets or sets the text processing mode that should be used when processing the strings in the default file for the purpose of determining if they contain placeholders.

If this property is not set, the value is derived from the format of the file.

public TextFormat? TextProcessingMode { get; set; }

Property Value

TextFormat?

TranslationManager

Gets or sets the manager that should be used to retrieve localized strings.

This value if set has the highest priority, and other properties are ignored.

public TranslationManager? TranslationManager { get; set; }

Property Value

TranslationManager