runtime: Blazor webassembly on DotNet 5 rc2 missing globalization for Bosnian month names

I upgraded my Blazor webassembly project to .Net5 RC2 (from .Net5 RC1) and I did notice that month names for my (Bosnian) ui culture are wrong.

Here is steps to reporduce:

In Main metoh of Program class I do set cultures to Bosninan

            CultureInfo.CurrentCulture = new CultureInfo("bs");
            CultureInfo.CurrentUICulture = new CultureInfo("bs");
            CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("bs");
            CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo("bs");

On any razor page when I try to get long date:

<p>Current UI Culture: <strong>@CultureInfo.CurrentUICulture.DisplayName</strong></p>
<p>Current Culture: <strong>@CultureInfo.CurrentCulture.DisplayName</strong></p>
<p>Sada je  @DateTime.Now.ToLongDateString() </p>

image

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 17 (13 by maintainers)

Most upvoted comments

I’m experiencing the same after upgrading to RC2. However, the culture I’m using is nl, which is listed in the icu/optimal.json file. However, it’s doesn’t appear to be loaded.

What I’m doing: DateTime.Today.ToString("dddd d MMMM yyyy", CultureInfo.CreateSpecificCulture("nl")), which prints Thursday 15 October 2020 instead of the localized version.

That is a different issue. The culture data is split up to save space so you can’t just load any culture at runtime and expect it to work. You should be able to enable that full culture list by setting <BlazorWebAssemblyLoadAllGlobalizationData>true</BlazorWebAssemblyLoadAllGlobalizationData> in your csproj

/cc @pranavkm