Closed IngoManthey closed 2 years ago
You need to specify all cultures, i.e.
new CultureInfo("en-US"),
new CultureInfo("en-ZA"),
new CultureInfo("en-CA"),
new CultureInfo("en-NZ"),
new CultureInfo("pt-BR"),
new CultureInfo("pt-PT"),
new CultureInfo("de-DE"),
new CultureInfo("de-CH"),
new CultureInfo("de-AT"),
new CultureInfo("cs-CZ"),
Also, to make things clear. If you use only the Blazor.WebAssembly.DynamicCulture.Loader
then you have to specify it here:
await host.LoadSatelliteCultureAssembliesCultureAsync(cultureList);
if you using it together with Blazor.WebAssembly.DynamicCulture
then its enough to define it here
builder.Services.AddLocalizationDynamic(options =>
{
options.SetDefaultCulture("en-US");
options.AddSupportedCultures(list of your cultures);
options.AddSupportedUICultures(list of your ui cultures, usually the same as cultures);
});
Currently making sample with comments to make some things more clear.
Pushed a sample with Blazor.WebAssembly.DynamicCulture
Not sure if there is need for a sample with just the Blazor.WebAssembly.DynamicCulture.Loader
since it simply loads all the language resources, the rest is up to the user on how to handle this resources, how to switch language, how to call StateHasChanged() for page etc.
Thank you for this great project.
I have 4 language resources: new CultureInfo("en") new CultureInfo("pt") new CultureInfo("de") new CultureInfo("cs") I use the following cultures: new CultureInfo("en-US"), new CultureInfo("en-ZA"), new CultureInfo("en-CA"), new CultureInfo("en-NZ"), new CultureInfo("pt-BR"), new CultureInfo("pt-PT"), new CultureInfo("de-DE"), new CultureInfo("de-CH"), new CultureInfo("de-AT"), new CultureInfo("cs-CZ"), Do I now have to specify all cultures in LoadSatelliteCultureAssembliesCultureAsync or is it sufficient that the languages are set?