Table of Contents

Class TwLocalizationOptions

Namespace
TwBlazor.Configuration
Assembly
TwBlazor.dll

Configures the language and the date and time formats TwBlazor components render with. It is read once, when AddTwBlazor is called, and is shared by the whole application.

public class TwLocalizationOptions
Inheritance
TwLocalizationOptions
Inherited Members

Constructors

TwLocalizationOptions()

public TwLocalizationOptions()

Properties

Culture

Gets or sets the culture every component uses for its text and its date, time and number formatting.

public CultureInfo? Culture { get; set; }

Property Value

CultureInfo

Remarks

Leave unset to follow the application: text follows CurrentUICulture and formatting follows CurrentCulture, which is what Blazor's own localization sets.

Direction

Gets or sets the direction every component lays itself out in.

public TextDirection? Direction { get; set; }

Property Value

TextDirection?

Remarks

Leave unset to follow the language: right to left for a culture such as Arabic or Hebrew, left to right otherwise. The page has to agree, so set dir on the html element to the same direction or wrap the application in a TwDirectionProvider.

Formats

Gets or sets the date and time formats. Anything left unset comes from the resource files, then from the culture.

public TwDateTimeFormatOptions Formats { get; set; }

Property Value

TwDateTimeFormatOptions

Resources

Gets the resource files that are searched, last added first, before TwBlazor's built in strings.

public IList<ResourceManager> Resources { get; }

Property Value

IList<ResourceManager>

Remarks

Each one is a .resx family in your own project (for example TwBlazorStrings.resx, TwBlazorStrings.de.resx, TwBlazorStrings.fr.resx) whose names are the TwStrings keys. Only the keys you want to change need to be present.

Methods

AddResource(ResourceManager)

Adds a resource file family to Resources.

public TwLocalizationOptions AddResource(ResourceManager resourceManager)

Parameters

resourceManager ResourceManager

The resource manager of the .resx family, for example MyStrings.ResourceManager.

Returns

TwLocalizationOptions

These options, so calls can be chained.

AddResource<TResource>()

Adds the resource file family that TResource names to Resources.

public TwLocalizationOptions AddResource<TResource>()

Returns

TwLocalizationOptions

These options, so calls can be chained.

Type Parameters

TResource

A class with the same name and namespace as the neutral .resx file, in the same assembly: the designer class Visual Studio generates, or an empty marker class.