Bug 52334 - CultureInfo.CurrentUICulture does not return the correct language code
Summary: CultureInfo.CurrentUICulture does not return the correct language code
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Library (Xamarin.Mac.dll) ()
Version: Master
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Manuel de la Peña [MSFT]
: 59415 ()
Depends on:
Reported: 2017-02-06 19:11 UTC by Yvonne Du
Modified: 2017-09-13 16:13 UTC (History)
5 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 52334 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Yvonne Du 2017-02-06 19:11:07 UTC
On OS 10.12, I set the language to Chinese Traditional Taiwan, the API CultureInfo.CurrentUICulture returns zh-HK.

While native Apple API NSLocale can return correct value as zh-Hant-TW
Comment 1 Manuel de la Peña [MSFT] 2017-02-08 09:37:05 UTC
Do you have a simple way to test this? Would be nice to reproduce this in a testable manner?
Comment 2 Timothy Risi 2017-03-13 19:02:11 UTC
I was able to test this by changing the language on the siulator and calling the specified APIS:

Console.WriteLine (CultureInfo.CurrentUICulture);
Console.WriteLine (NSLocale.CurrentLocale.LocaleIdentifier);

The same difference occurs for Traditional Chinese (Hong Kong), CurrentUICulture simply shows zh-HK same as traditional Taiwan (can't actually test taiwan as it doesn't appear to be an option in my simulator).
Comment 3 Timothy Risi 2017-03-13 19:39:13 UTC
Whoops, just realized this was a mac bug and I tested on iOS.  Tested on mac now (set machine to traditional chinese taiwan) and saw the same error there.

So looks like it affects both iOS and mac.
Comment 4 Alex Soto [MSFT] 2017-09-13 16:13:37 UTC
*** Bug 59415 has been marked as a duplicate of this bug. ***