Bug 26642 - Different language reported in simulator and on device
Summary: Different language reported in simulator and on device
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: XI 8.6.0
Hardware: PC Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2015-02-02 12:05 UTC by Randall Schmidt
Modified: 2015-02-04 18:36 UTC (History)
3 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 on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Randall Schmidt 2015-02-02 12:05:53 UTC
In a new solution, stick this somewhere:


In the iOS 8.1 simulator, change the language to German (Deutsch) and the region to United States (Vereinigte Staaten).

The writeline prints: "en"

Now run on an iPad running iOS 8.1.2 with the same language and region settings

The writeline prints: "de"
Comment 1 Udham Singh 2015-02-03 05:48:12 UTC
I have checked this issue with the help of code given bug and able to reproduce this issue. To reproduce this issue I have followed the steps below : 

1. Create a simple iPhone app (Unified API - Single View)
2. Add below code in method ViewDidLoad()
3. Change the language to German (Deutsch) and the region to United States (Vereinigte Staaten) of simulator iPhone 4S (iOS 8.1) and iOS device iPhone 4S(iOS 8.2).
4. Run the app on simulator and device one by one and observed that we are getting different output in both cases.

Output : "en" (For iOS Simulator - iPhone 4S 8.1)
Output : "de" (For iOS device - iPhone 4S 8.2)

Screencast : http://www.screencast.com/t/y541W7Q2

Environment Info :

=== Xamarin Studio ===

Version 5.7.1 (build 16)
Installation UUID: ce927b2a-2c07-44c5-b186-09cfdafba6dc
	Mono 3.12.0 ((detached/a813491)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312000068

=== Apple Developer Tools ===

Xcode 6.1.1 (6611)
Build 6A2008a

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: 1ee873c
Build date: 2015-01-31 17:42:21-0500

=== Build Information ===

Release ID: 507010016
Git revision: f12fcaf4707ab436bee2df6263eb5333197b262c
Build date: 2015-02-01 21:06:05-05
Xamarin addins: f7b7d34419c9ec24501bfa7c658e80a6305613e0

=== Operating System ===

Mac OS X 10.9.5
Darwin Xamarin76s-Mac-mini.local 13.4.0 Darwin Kernel Version 13.4.0
    Sun Aug 17 19:50:11 PDT 2014
    root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64
Comment 2 Rolf Bjarne Kvinge [MSFT] 2015-02-04 12:52:01 UTC
System.Globalization.CultureInfo.CurrentUICulture uses NSLocale.CurrentLocale.

And effectively NSLocale.CurrentLocale differs between simulator and device as well:

> Console.WriteLine (NSLocale.CurrentLocale.Identifier);

prints "en_US" in the simulator and "es_US" on the device (with Spanish as the language instead of German, since I don't speak German).

In other words this is just one (of several) differences between iOS Simulators and iOS Devices.
Comment 3 Randall Schmidt 2015-02-04 13:37:56 UTC
Rolf, why is CurrentUICulture being informed by NSLocal.CurrentLocale.Identifier rather than NSLocale.PreferredLanguages[0]?

I am not surprised that NSLocale.CurrentLocale.Identifier is en_US on both simulator and device in this scenario, because the region is set to United States. If you change the region to, say, Denmark, then you will get da_DK on both simulator and device.

If the language is set to German, then NSLocale.PreferredLanguages[0] is "de" on both simulator and device. Shouldn't that be reflected by CultureInfo.CurrentUICulture.TwoLetterISOLanguageName (which is "en" on simulator and "de" on device)?

CurrentUICulture is, after all, what you're supposed to query to get the language your UI should be in in .NET. Shouldn't it then reflect the value of NSLocale.PreferredLanguages[0]?

I would expect CurrentCulture (no "UI" in there) on the other hand to reflect the value of NSLocal.CurrentLocale.Identifier.
Comment 4 Rolf Bjarne Kvinge [MSFT] 2015-02-04 13:41:52 UTC
@Randall, historical reasons, and something we can't change now. See also bug #24956 for a bit more information about the same topic.
Comment 5 Randall Schmidt 2015-02-04 13:48:40 UTC
Okay I understand, I misread some of your comment too (I read "es_US" as "en_US"). You are right that there appears to be a difference between NSLocale.CurrentLocale.Identifier on simulator and device.

That looks like an iOS bug then (I didn't have this problem before
upgrading build dependencies and it doesn't seem like something that would be
different on purpose in the simulator).

Thank you for your response
Comment 6 Randall Schmidt 2015-02-04 18:36:35 UTC
FYI for anyone stumbling upon this report.

Looks like a bug in the iOS 8 simulator.

See https://devforums.apple.com/message/1062623#1062623