Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
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"
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)
=== Xamarin.iOS ===
Version: 18.104.22.168 (Business Edition)
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
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.
Rolf, why is CurrentUICulture being informed by NSLocal.CurrentLocale.Identifier rather than NSLocale.PreferredLanguages?
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 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?
I would expect CurrentCulture (no "UI" in there) on the other hand to reflect the value of NSLocal.CurrentLocale.Identifier.
@Randall, historical reasons, and something we can't change now. See also bug #24956 for a bit more information about the same topic.
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
FYI for anyone stumbling upon this report.
Looks like a bug in the iOS 8 simulator.