I created a Blazor server application using localization as described in the documentation. This works fine overall but unfortunately, I use fr-CH locales which uses controversial decimal and group separators (see this thread).
When using static localization, the following trick works just fine when overriding default thread in program.cs as follows:
CultureInfo ci = CultureInfo.CreateSpecificCulture("fr-CH");ci.NumberFormat.NumberGroupSeparator = "'";ci.NumberFormat.NumberDecimalSeparator = ".";// --- set default thread culture to override localesCultureInfo.DefaultThreadCurrentCulture = ci;CultureInfo.DefaultThreadCurrentUICulture = ci;// --- works only if defined before request localization...app.UseRequestLocalization(new RequestLocalizationOptions() .AddSupportedCultures(new[] { "fr-CH" }) .AddSupportedUICultures(new[] { "fr-CH" }));app.Run();Now the problem is that when I implement dynamic languages, the hack no longer works when overriding the DefaultThreadCurrentCulture and DefaultThreadCurrentUICulture when switching cultures.
I tried to set them when loading the app with the logged user's selected language and also in the CultureController from the documentation. If testing right after setting the culture works, the original locales are displayed when loading a control.
I also tried to register a middleware to set the locales - none of these solutions seem to work.
My last resort solution would be to change the OS locale (on the local docker script if at all possible) - but there must be another solution, is there?