-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Ios Maui sample app uses Chinese Simplified when Chinese Traditional is set in phone preferences #102560
Comments
Hi I'm an AI powered bot that finds similar issues based off the issue title. Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you! Open similar issues:
Closed similar issues:
|
This comment was marked as outdated.
This comment was marked as outdated.
I can reproduce this. Adding the following in the managed Main method: Console.WriteLine ($"CurrentCulture: {Thread.CurrentThread.CurrentCulture.Name}");
Console.WriteLine ($"CurrentUICulture: {Thread.CurrentThread.CurrentUICulture.Name}");
Console.WriteLine ($"NSLocale.CurrentLocale.LocaleIdentifier: {NSLocale.CurrentLocale.LocaleIdentifier}");
Console.WriteLine ($"NSLocale.CurrentLocale.CountryCode: {NSLocale.CurrentLocale.CountryCode}");
Console.WriteLine ($"NSLocale.CurrentLocale.LanguageCode: {NSLocale.CurrentLocale.LanguageCode}");
Console.WriteLine ($"NSLocale.CurrentLocale.ScriptCode: {NSLocale.CurrentLocale.ScriptCode}"); prints:
Debugging a bit it seems we hit this code path: runtime/src/native/libs/System.Globalization.Native/pal_locale.m Lines 27 to 30 in 994a410
which means the current (ui) culture is determined using the current locale's LanguageCode-CountryCode (which results in "zh-CN"), not the locale's LocaleIdentifier, nor taking into account the ScriptCode value (which both contain "Hant"). |
Tagging subscribers to this area: @dotnet/area-system-globalization |
CC @steveisok |
/cc @vitek-karas |
cc @mkhamoyan |
/cc @matouskozak |
Can confirm that the issue is reproducible with .NET 8. Works as expected with .NET 9. |
Is the issue how we construct the icu locale in net8.0 or the fact that we've potentially removed the required information from the icu bundle we produce for size reasons? |
I'm unsure, I have thought that we have full ICU when hybrid globalization is not enabled on .NET 8 (do you know @mkhamoyan ?). I did some digging and the correct language can be set using |
@matouskozak We have whitelisted locales for ICU in net8.0 https://github.com/dotnet/icu/blob/dotnet/main/icu-filters/icudt_mobile.json#L8-L194 and I don't see here
|
Hey, this:
Is applied only if there are more than 1 preferedLanguages selected. For single one it can be still evaluated as |
@sowacx, The check |
Fixed in #102748, should be part of next servicing release (8.0.8). |
Description
Created new maui project. Created Strings.resx, Strings.zh.resx, Strings.zh-Hans.resx, and Strings.zh-Hant.resx files with below values of SampleText:

On MainPage.xaml added label that will display proper text according to current language:

And now, when setting Iphone Region to "China mainland" and language to "Chinese Traditional", the SampleText is taken from Chinese, Simplified, but should be taken from Chinese, Traditional:

Steps to Reproduce
Link to public reproduction project repository
https://github.com/Czapek83/Chinese_LanguageIssue
Version with bug
8.0.21 SR4.1
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
IOS 16.7.7, IOS 17.4.1
Did you find any workaround?
Unfortunatelly, not at all.
Relevant log output
No response
The text was updated successfully, but these errors were encountered: