Table of Contents

Class BlazorWasmAspNetCoreCultureCookieProvider

Namespace
Dmnk.Blazor.Cookies
Assembly
Dmnk.Blazor.Cookies.dll
public static class BlazorWasmAspNetCoreCultureCookieProvider
Inheritance
BlazorWasmAspNetCoreCultureCookieProvider
Inherited Members

Methods

Configure(IServiceProvider, string, string, Action<Exception>?)

Set blazor wasm culture to ASP.NET Core culture from cookie.

Example (in Program.cs)

builder.Services...

const string defaultCulture = "de";

CultureInfo.DefaultThreadCurrentCulture = new CultureInfo(defaultCulture);
CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo(defaultCulture);

var host = builder.Build();

await BlazorAspNetCoreCultureCookieProvider.Configure(host.Services, defaultCulture);

await host.RunAsync();
public static Task Configure(IServiceProvider container, string defaultCulture, string cookieName = ".AspNetCore.Culture", Action<Exception>? onError = null)

Parameters

container IServiceProvider
defaultCulture string
cookieName string
onError Action<Exception>

Returns

Task