Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blazor webassembly on DotNet 5 rc2 missing globalization for Bosnian month names #43398

Closed
adopilot opened this issue Oct 14, 2020 · 17 comments
Closed
Assignees
Labels
Milestone

Comments

@adopilot
Copy link

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

@mkArtakMSFT mkArtakMSFT transferred this issue from dotnet/aspnetcore Oct 14, 2020
@mkArtakMSFT
Copy link
Member

@lewing FYI

@lewing lewing added arch-wasm WebAssembly architecture area-System.Globalization labels Oct 14, 2020
@ghost
Copy link

ghost commented Oct 14, 2020

Tagging subscribers to this area: @tarekgh, @safern, @krwq
See info in area-owners.md if you want to be subscribed.

@lewing
Copy link
Member

lewing commented Oct 14, 2020

/cc @EgorBo @steveisok

@EgorBo
Copy link
Member

EgorBo commented Oct 14, 2020

@lewing what is the strategy to address such issues? Just add the missing locales?
bs is not presented in the list of locales we support (and neither in https://developer.chrome.com/webstore/i18n)

@lewing
Copy link
Member

lewing commented Oct 14, 2020

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

@lewing
Copy link
Member

lewing commented Oct 14, 2020

@EgorBo I think we may just need to document things

@adopilot
Copy link
Author

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

I apologies,I did delete my comment.

@EgorBo
Copy link
Member

EgorBo commented Oct 14, 2020

@lewing it's documented here https://docs.microsoft.com/en-us/dotnet/standard/globalization-localization/globalization-icu#icu-on-webassembly (has a link to list of supported locales)

@pranavkm
Copy link
Contributor

Yeah, I didn't realize the app was initializing a new culture. We should probably call that out in our docs.

@maryamariyan maryamariyan added the untriaged New issue has not been triaged by the area owner label Oct 14, 2020
@safern
Copy link
Member

safern commented Oct 14, 2020

@lewing it's documented here https://docs.microsoft.com/en-us/dotnet/standard/globalization-localization/globalization-icu#icu-on-webassembly (has a link to list of supported locales)

I think we should add a more detailed description on the options to enable a full globalization experience, like the MSBuild property that @lewing pointed out here, does that make sense?

@cornem
Copy link

cornem commented Oct 15, 2020

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.

@lewing
Copy link
Member

lewing commented Oct 15, 2020

@cornem is that with <BlazorWebAssemblyLoadAllGlobalizationData>true</BlazorWebAssemblyLoadAllGlobalizationData> in your .csproj and what language is your browser set to?

@cornem
Copy link

cornem commented Oct 15, 2020 via email

@lewing
Copy link
Member

lewing commented Oct 15, 2020

@cornem by default Blazor loads a small subset of culture data based on the browser's current language setting. That option tells blazor to load a larger subset of cultures that is intended to mirror the cultures the browser supports.

@lewing lewing added this to the 6.0.0 milestone Oct 15, 2020
@lewing lewing removed the untriaged New issue has not been triaged by the area owner label Oct 15, 2020
@pranavkm
Copy link
Contributor

pranavkm commented Oct 15, 2020

Btw, I've added a note about this in our docs:https://docs.microsoft.com/en-us/aspnet/core/blazor/globalization-localization?view=aspnetcore-5.0#blazor-webassembly. It should take another day for the website to update.

@CoffeeStainJo
Copy link

I'm having the same issue for Norwegian, Bokmål (Norway)” (nb-NO).

To Reproduce:
Create a Blazor WebAssembly hosted app (.net5.0) -- ASP.NET Core version: 5.0.102
image
Is set in Program.cs

image
Is configured in .csproj

image
Is added in index.html

image
Does not include the norwegian codes nb-no and DateTime.Now.ToString() returns
image
image

@maryamariyan maryamariyan added this to the 6.0.0 milestone Jul 23, 2021
@ghost ghost moved this from Untriaged to 6.0.0 in ML, Extensions, Globalization, etc, POD. Jul 23, 2021
@lewing lewing modified the milestones: 6.0.0, 7.0.0 Jul 31, 2021
@ghost ghost moved this from 6.0.0 to Untriaged in ML, Extensions, Globalization, etc, POD. Jul 31, 2021
@ghost ghost moved this from Untriaged to 7.0.0 in ML, Extensions, Globalization, etc, POD. Jul 31, 2021
@ilonatommy
Copy link
Member

ilonatommy commented Jun 13, 2022

Merging with issue for Norwegian: #53239. It turns out that on the current whitelist all the locales reported in both issues are missing, so it looks like a duplicate.

@ilonatommy ilonatommy self-assigned this Jun 13, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Jul 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

10 participants