Table of Contents

Class LocalStorageCultureStore

Namespace
Tlumach.Blazor
Assembly
Tlumach.Blazor.dll

Stores the culture in the local storage of the browser. Used by standalone Blazor WebAssembly and Blazor Hybrid applications.

public sealed class LocalStorageCultureStore : ITlumachCultureStore
Inheritance
LocalStorageCultureStore
Implements
Inherited Members

Constructors

LocalStorageCultureStore(IJSRuntime, TlumachBlazorOptions)

Initializes a new instance of the LocalStorageCultureStore class.

public LocalStorageCultureStore(IJSRuntime jsRuntime, TlumachBlazorOptions options)

Parameters

jsRuntime IJSRuntime

The JavaScript runtime.

options TlumachBlazorOptions

The options, which supply the storage key.

Methods

LoadAsync(CancellationToken)

Loads the name of the stored culture.

public ValueTask<string?> LoadAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A token to cancel the operation.

Returns

ValueTask<string>

The culture name, or null if nothing is stored.

SaveAsync(CultureInfo, CancellationToken)

Stores the culture.

public ValueTask SaveAsync(CultureInfo culture, CancellationToken cancellationToken = default)

Parameters

culture CultureInfo

The culture to store.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

ValueTask

A task that completes when the culture is stored.