dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.32k stars 4.74k forks source link

Language 'Norwegian' missing from drop-down in designer properties #66379

Closed codebolt closed 2 years ago

codebolt commented 2 years ago

Problem description:

Working in with the WinForms Designer in .NET Framework, I created several localizable Forms/User Controls where I used two languages: English (default) and Norwegian (language code 'no'). When I open these forms in VS 2022/.NET 6 (after using the migration tool), I can no longer find "Norwegian" in the language list. I can only find Norwegian Bokmål ('nb') and Norwegian Bokmål Norway ('nb-NO'):

image

I see that the (...).no.resx file is there, but because Norwegian is not in the language list I am unable to use it:

image

Expected behavior:

Expected behavior is to select Norwegian (code 'no') in the list and see/edit the translated control.

Minimal repro:

To reproduce you would need to:

RussKie commented 2 years ago

.NET does not have a culture with code "no". The issue can be easily reproduced by the following code (copied from https://github.com/dotnet/runtime/blob/main/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/CultureInfoConverter.cs):

CultureInfo?[] installedCultures = CultureInfo.GetCultures(CultureTypes.SpecificCultures | CultureTypes.NeutralCultures);
var no = installedCultures.Where(c => c.Name.StartsWith("n")).Select(c => c);
foreach (var c in no)
{
    Debug.WriteLine(c);
}
.NET 6 .NET Framework 4.7.2
naq
naq-NA
nb
nb-NO
nb-SJ
nd
nd-ZW
nds
nds-DE
nds-NL
ne
ne-IN
ne-NP
nl
nl-AW
nl-BE
nl-BQ
nl-CW
nl-NL
nl-SR
nl-SX
nmg
nmg-CM
nn
nn-NO
nnh
nnh-CM
nqo
nqo-GN
nr
nr-ZA
nso
nso-ZA
nus
nus-SS
nyn
nyn-UG

naq
naq-NA
nb
nb-NO
nb-SJ
nd
nd-ZW
nds
nds-DE
nds-NL
ne
ne-IN
ne-NP
nl
nl-AW
nl-BE
nl-BQ
nl-CW
nl-NL
nl-SR
nl-SX
nmg
nmg-CM
nn
nn-NO
nnh
nnh-CM
no
nqo
nqo-GN
nr
nr-ZA
nso
nso-ZA
nus
nus-SS
nyn
nyn-UG

You may also find this SO question useful: https://stackoverflow.com/q/13159969/2338036.

This is a .NET runtime issue, which I guess is by design, though I let the area owners to confirm this.

dotnet-issue-labeler[bot] commented 2 years ago

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

codebolt commented 2 years ago

This is a .NET runtime issue, which I guess is by design, though I let the area owners to confirm this.

Thanks for following up. If it is by design, then I would assume the problem of missing translations in Forms and other localizable resources after migration from .NET Framework is an unintended consequence. Would be very happy if I could at least get a workaround. I tried to simply rename the (...).no.resx file to .nb.resx but it didn't seem to work (still saw English texts in designer after switching to Norwegian Bokmål).

jeffschwMSFT commented 2 years ago

@RussKie thoughts on an area label? I was about to transfer to winforms, but I see you transferred it to runtime

RussKie commented 2 years ago

@jeffschwMSFT my guess would be something to do with "CultureInfo" or how system languages are enumerated. The Windows Forms and VS are calling into https://github.com/dotnet/runtime/blob/main/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/CultureInfoConverter.cs.

ghost commented 2 years ago

Tagging subscribers to this area: @dotnet/area-system-componentmodel See info in area-owners.md if you want to be subscribed.

Issue Details
* .NET Core Version: 6.0.200 * Have you experienced this same bug with .NET Framework?: No **Problem description:** Working in with the WinForms Designer in .NET Framework, I created several localizable Forms/User Controls where I used two languages: English (default) and Norwegian (language code 'no'). When I open these forms in VS 2022/.NET 6 (after using the migration tool), I can no longer find "Norwegian" in the language list. I can only find Norwegian Bokmål ('nb') and Norwegian Bokmål Norway ('nb-NO'): ![image](https://user-images.githubusercontent.com/1541670/157229760-8dd67867-78da-4bc9-bc5a-b8ded5ac204c.png) I see that the (...).no.resx file is there, but because Norwegian is not in the language list I am unable to use it: ![image](https://user-images.githubusercontent.com/1541670/157229298-11de1eb8-fd2a-4576-9b6a-adac7f0a80e0.png) **Expected behavior:** Expected behavior is to select Norwegian (code 'no') in the list and see/edit the translated control. **Minimal repro:** To reproduce you would need to: * Create a Forms application with a form in an old Visual Studio (.NET Framework) * Create a translation with Language=Norwegian * Convert the application to .NET 6 (using e.g. the migration tool) * Load the form in VS2022 * You can no longer access the Norwegian translation in the designer
Author: codebolt
Assignees: -
Labels: `area-System.ComponentModel`, `untriaged`
Milestone: -
tarekgh commented 2 years ago

@RussKie Culture enumerations depends on the underlying globalization libraries. It is the decision of the Unicode Standard through ICU to not enumerate the "no" culture. The current enumerated Norwgian cultures are

nb ... Norwegian Bokmål
nb-NO ... Norwegian Bokmål (Norway)
nb-SJ ... Norwegian Bokmål (Svalbard & Jan Mayen)
nn ... Norwegian Nynorsk
nn-NO ... Norwegian Nynorsk (Norway)

Which I believe covers all cases for that language. right?

https://en.wikipedia.org/wiki/Norwegian_language

Today there are two official forms of written Norwegian, [Bokmål](https://en.wikipedia.org/wiki/Bokm%C3%A5l) (literally 'book tongue') and [Nynorsk](https://en.wikipedia.org/wiki/Nynorsk) ('new Norwegian'),

The .NET prefers to stick with whatever the Unicode Standard decides for parity and consistency. If WinForm or VS want to include the "no" in their list for any compatibility reasons, they can do that as we still allow creating no culture if you do that manually. Like CultureInfo.GetCultureInfo("no"). This will work fine.

In general, depending on the enumerated cultures and assume, will never change is a wrong assumption and no one should depend on that.

tarekgh commented 2 years ago

@jefgen looking at https://github.com/unicode-org/cldr/pull/1031, what ICU version will have this change? Why is the ICU version on Windows not having this change? running with ICU version 68.2.0.6 having nb and nn with invariant parent.

jefgen commented 2 years ago

The changes for that PR were done for CLDR-14493, which was integrated into ICU 69.

It makes "no" become a parent locale for both "nb" and "nn", instead of "nb" being deprecated and aliasing to "no". This change matches with now NLS handles the locales. However, IIRC, in ICU 68, "no" is aliased to "nb", so it wouldn't be enumerated.

The Windows ICU version hasn't yet been updated to pick up a newer version of public ICU yet.

tarekgh commented 2 years ago

The Windows ICU version hasn't yet been updated to pick up a newer version of public ICU yet.

Thanks @jefgen, is it scheduled yet when the ICU will get updated?

tarekgh commented 2 years ago

I am closing this issue as the ICU update should fix this issue. @jefgen may inform us when this will happen.