-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Labels
Pillar: Technical Debtarea-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.feature-blazor-wasmThis issue is related to and / or impacts Blazor WebAssemblyThis issue is related to and / or impacts Blazor WebAssemblyfeature-localization
Milestone
Description
Repro:
- Create a Blazor WebAssembly application
- Update
Program.cs
to contain:
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.DefaultThreadCurrentUICulture =
Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture = new CultureInfo("ja-JP");
// ... and now everything that was already there
var builder = WebAssemblyHostBuilder.CreateDefault(args);
// ... etc
- If you want, also test displaying something in this culture by adding to
Index.razor
the output@((123.45).ToString("c"))
Expected:
- On startup, should give the error Blazor detected a change in the application's culture that is not supported with the current project configuration. To change culture dynamically during startup, set true in the application's project file.
- Actual, no error, and the value
@((123.45).ToString("c"))
is rendered as123 JPY
(i.e., no¥
symbol)
This is a regression since 5.0. If you do the same with the 5.0 SDK, it will produce the error.
However, if you modify the order of the source code to this:
var builder = WebAssemblyHostBuilder.CreateDefault(args);
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.DefaultThreadCurrentUICulture =
Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture = new CultureInfo("ja-JP");
// ... and now everything that was already there
... then it does produce the correct error on 6.0. So it seems we've changed how the culture change detection works and made it less robust.
Metadata
Metadata
Assignees
Labels
Pillar: Technical Debtarea-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.feature-blazor-wasmThis issue is related to and / or impacts Blazor WebAssemblyThis issue is related to and / or impacts Blazor WebAssemblyfeature-localization