-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Cultureinfo for Norwegian is not working in blazor webassembly .net5 #53239
Comments
Have you configured your app to include all localization data: https://docs.microsoft.com/en-us/aspnet/core/blazor/globalization-localization?view=aspnetcore-5.0#blazor-webassembly? |
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate. See our Issue Management Policies for more information. |
Yes, and it works for other cultures like “sv-se”, “de”, “fr”, “en-US” and "da-DK”. The configuration is included in the attachment: GlobalizationProblem.zip |
Any chance this issue will be re-investigate, or do I have to register a new issue? |
Tagging subscribers to this area: @tarekgh, @safern Issue DetailsThis issue has been moved from a ticket on Developer Community. [severity:It's more difficult to complete my work] Edit the Index.razor file: @using System.Globalization Problems with Globalization@foreach (var language in languageCodes)
@code{ } For the values "no", "nb", "nb-NO" and "nn" it does not seem to load the correct CultureInfo, and the days of the week have English names and the name of the months are displayed as the letter "M" followed by the number of the month. [GlobalizationProblem.zip] (https://aka.ms/dc/file?name=B088da46e4652449ab05cf37260b79151637495230874692982_GlobalizationProblem.zip&tid=088da46e4652449ab05cf37260b79151637495230874692982) Original CommentsFeedback Bot on 2/21/2021, 11:28 PM:We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps. Original Solutions(no solutions)
|
@lewing FYI |
Tagging subscribers to 'arch-wasm': @lewing Issue DetailsThis issue has been moved from a ticket on Developer Community. [severity:It's more difficult to complete my work] Edit the Index.razor file: @using System.Globalization Problems with Globalization@foreach (var language in languageCodes)
@code{ } For the values "no", "nb", "nb-NO" and "nn" it does not seem to load the correct CultureInfo, and the days of the week have English names and the name of the months are displayed as the letter "M" followed by the number of the month. [GlobalizationProblem.zip] (https://aka.ms/dc/file?name=B088da46e4652449ab05cf37260b79151637495230874692982_GlobalizationProblem.zip&tid=088da46e4652449ab05cf37260b79151637495230874692982) Original CommentsFeedback Bot on 2/21/2021, 11:28 PM:We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps. Original Solutions(no solutions)
|
Which version of .NET are you testing, is this still a problem in .NET 6 preview 6? |
@lewing please help answering @solbster and @catfiadhaich |
@lewing , when will this be fixed? |
I just reported what seems to be the same issue yesterday, didn't see this one before today. |
@tarekgh: Is it intentional that this won't be fixed before 7.0? If so that is unfortunate, since 7.0 isn't an LTS which in practice means that many might have to wait for 8.0 to get this fixed. |
While I appreciate that there's a lot of work going on for version 7, the lack of even a comment about this issue from Mr. Ewing is disappointing. I'm sure there are bigger and more interesting fixes in progress for the next major release, but I think it's clear that this is a problem for a number on non-English culture configs. |
The culture info we is use is produced from the dotnet/icu repository (a github fork of the standard ICU repo) and loaded by the browser runtime. Because we have to load all the information across the network (and it is very large we split) we have chosen to remove some information from the culture info and made a best effort at trading features for size. No choice to remove data is perfect and some kinds of applications are impacted more than others. Browsers themselves do something similar when shipping icu data. Display names are a good example of something that increase the data size dramatically and are rarely used in most web apps so they are not currently included in our icu data bundle. https://unicode-org.github.io/icu/userguide/icu_data/buildtool.html#file-slicing-coarse-grained-features has a breakdown of the size impact of various parts of the data, and is part of the documentation for the tool we use to shape the data in the dotnet/icu build. The good news is that for the most part if you bundle your application with a full icu data bundle all the missing features and data will just work (there are a couple of exceptions that would be relatively easy to fix). The bad news there isn't currently a pre-built mechanism to do this. We started work in .NET 6 to offer much finer grained control over the data bundle but it stalled and hasn't yet been restarted. I'll reopen discussion around this work internally but clear information about what data your applications need and why would be quite helpful in prioritizing work here. |
Thank you for updating us on this, Larry. I can only speak for myself, obviously. I'm not blocked by this issue, but I would be interested in knowing more about the workaround that you mentioned because I really would like to use Blazor. it might take me a wee while to wrap my head around it, but I can figure its out and it might let me move on with using Blazor for my application. I think others on this thread are affected way more than me... :) In my case, I was concentrating mostly on Celtic languages (Irish Gaelige, Scottish Gaelic in particular) and my need is mostly for the correct formatting of dates, etc.and the ability to switch my UI between languages. The application is intended for education and (kinda) social media. While I could move to using another method for my presentation layer, Blazor seemed like the ideal solution for me. |
@lewing asked:
In our case the most important thing will be correctly localized names (for all the Nordic countries) on months and days of the week, for use in formatted datetime strings. |
@lewing Similar case here. We have an app that app that supports |
Thank you @catfiadhaich, your problem falls under this issue: #44739. The reasons for shortening the names is provided there and is still under discussion. |
I had tested and found out a breaking change of Cultureinfo for Norwegian between .NetFW and .NetCore/.Net. Here is a simple test and the results on dotnetfiddle.net, you guys can try it with other .Net version using System;
using System.Globalization;
public class Program
{
public static void Main()
{
ShowLanguageInheritance(new CultureInfo("nb-NO"));
}
public static void ShowLanguageInheritance(CultureInfo language)
{
if (IsNullOrHasNoParent(language))
{
return;
}
Console.WriteLine(language.Name);
ShowLanguageInheritance(language.Parent);
}
public static bool IsNullOrHasNoParent(CultureInfo language)
{
return language == null || language.Name == language.Parent.Name;
}
} |
@vinhch this was issue on CLDR (which ICU using that Unicode Standard data from). unicode-org/cldr#1031. It is matter of picking a new ICU version. |
There are 4 different issues actually.
|
Thanks for the reply! I understand the need to cut down in size. Is there a way for us to include |
There is a way to build your own, custom ICU data bundle. I will send you a custom one with all the locales + lb_LU on the email you pinned to your GH account. That's a screenshot of how it works for me: In case anyone wants to build it themselves, here are the steps:
for all Mobiles (not only Android and not only x64, you can use this configuration, it's the same) run the script:
|
Success! To get your custom To do that, add this to your main <!-- AFAIK there is no need to hook into the publish process, that should work automatically but I have not tested it -->
<Target Name="_ReplaceICU" AfterTargets="ResolveRuntimePackAssets">
<Message Text="Replacing 'icudt.dat' file..." Importance="High" />
<ItemGroup>
<!-- Generate an item to match the item we need to remove from "ReferenceCopyLocalPaths" -->
<ToRemove Include="toRemove">
<DestinationSubPath>icudt.dat</DestinationSubPath>
</ToRemove>
<!-- Use said item to match against the real item we want to remove -->
<ReferenceCopyLocalPaths Remove="@(ToRemove)"
MatchOnMetadata="DestinationSubPath"/>
<!-- Now add the custom "icudt.dat" file -->
<ReferenceCopyLocalPaths Include="$(MSBuildThisFileDirectory)icudt.dat"
DestinationSubPath="icudt.dat" />
</ItemGroup>
</Target> There might be a simpler way to achieve the same result but this is the best I could come up with given my limited knowledge of the msbuild processes. Here's a working sample: https://github.com/igotinfected/test-icudt-blazor-wasm @ilonatommy thank you for the file, and @javiercn thank you for pointing me in the right direction! 😊 |
This issue has been moved from a ticket on Developer Community.
[severity:It's more difficult to complete my work]
Create a Blazor WebAssembly targeting .net5 and add edit the csproj to include true
Edit the Index.razor file:
@using System.Globalization
@page "/"
Problems with Globalization
@foreach (var language in languageCodes)
}{
var culture = CultureInfo.CreateSpecificCulture(language);
var today = DateTime.Now.ToString("dddd, dd MMM yyyy", CultureInfo.GetCultureInfo(language));
@code{
List languageCodes = new List { "no", "nb", "nb-NO", "nn", "sv-se", "de", "fr", "en-US", "da-DK" };
}
For the values "no", "nb", "nb-NO" and "nn" it does not seem to load the correct CultureInfo, and the days of the week have English names and the name of the months are displayed as the letter "M" followed by the number of the month.
[GlobalizationProblem.zip] (https://aka.ms/dc/file?name=B088da46e4652449ab05cf37260b79151637495230874692982_GlobalizationProblem.zip&tid=088da46e4652449ab05cf37260b79151637495230874692982)
Original Comments
Feedback Bot on 2/21/2021, 11:28 PM:
We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.
Original Solutions
(no solutions)
The text was updated successfully, but these errors were encountered: