dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.66k stars 1.06k forks source link

`dotnet test` fails for Norwegian resources on Ubuntu 20.04 #12139

Open fjukstad opened 4 years ago

fjukstad commented 4 years ago

Hi,

Running dotnet test in this example project fails for Norwegian resources on Linux, but works fine on Windows. The tests succeed for French and German. I have noticed that dotnet build only produces a bin/Debug/netcoreapp3.1/no/xUnitCulture.resources.dll output file when running on Windows. Is there anything I'm missing?

Possibly related issues:

Thanks, Bjørn

fjukstad commented 4 years ago

I have added detailed msbuild logs for Windows and Ubuntu in the example project now. It looks like the CoreGenerateSatelliteAssemblies target is missing for Norwegian on Ubuntu while it is present in the Windows logs. (Maybe this should be an issue at microsoft/msbuild?)

fjukstad commented 4 years ago

Renaming the resource file from Resource.no.resx to Resource.nb.resx results in a nb/ output directory, and makes the tests in the example repository pass on Ubuntu. We can access the resources with CultureInfo("nb") or CultureInfo("nb-NO"). On Windows we do not have to rename the resource file, and we can access the resources with CultureInfo("no"), CultureInfo("nb"), or CultureInfo("nb-NO"). In summary, renaming the resource file and accessing it with nb or nb-NO is a solution, but it would be interesting to know why Resource.no.resx and CultureInfo("no") works on Windows, but not Ubuntu.

PiotrKarczmarz commented 4 years ago

I see the same behavior when build is run on MacOS. Norwegian resource dll is never included in the output folder as @fjukstad mentioned. Build works fine on Windows - folder and dll is created at /no/{resourceName}.resources.dll path without any problems.

tisis2 commented 1 year ago

see #66379

it seems microsoft included the ICU libraries and use them for the cultures with dotnet instead of NLS since NLS was platform specific library of microsoft and ICU is a platform independent library that is also used by linux and mac. microsoft did set this library as the default starting with the May Update in 2019 (https://learn.microsoft.com/en-us/dotnet/core/extensions/globalization-icu). for any reason "no" is not listed in that library when you enumerate all cultures until version 69 (which is not included in windows as far as i can see).

i also faced issues with the norwegian culture today... i also figured out that when i build through Visual Studio that my "no" resource dll files are compiled but not when i build with dotnet build. so currently it seems that the only reliable solution that should always work is to drop "no" resources completely and use "nb" instead.

marcpopMSFT commented 1 year ago

@rainersigwald didn't Ben fix this for the no locale?

rainersigwald commented 1 year ago

I don't recall a specific fix for no in MSBuild; looking I saw https://github.com/dotnet/msbuild/pull/7853 (match .NET runtime behavior more closely) and https://github.com/dotnet/msbuild/pull/8011 (specific to pseudo-loc).

RajeshwarMs commented 2 weeks ago

So, How did you mitigate the issue to support the Norwegian Culture in localization?? @fjukstad @PiotrKarczmarz @rainersigwald @marcpopMSFT