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 for Bug 37733 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
In special cases on GitHub you might also want the comments:
GitHub Markdown with public comments
Created attachment 14601 [details]
Reproduction case (only reproduces on certain iPads)
See the forum thread for pretty formatting: https://forums.xamarin.com/discussion/59203/app-launches-with-wrong-culture-settings-on-certain-ipads
I attached a reproduction case but it only reproduces on certain iPads.
Version 5.9.8 (build 0)
Installation UUID: 76cd4550-0ba3-46c2-9700-950d32dbe636
Mono 4.0.5 ((detached/1d8d582)
GTK+ 2.24.23 (Raleigh theme)
Package version: 400050001
Xamarin Android Player
Apple Developer Tools
Xcode 7.1 (9079)
Version: 220.127.116.11 (Business Edition)
Build date: 2015-10-27 18:59:21-0400
Release ID: 509080000
Git revision: cc5f6e5658589ca7f46210c57fad947e75f30abd
Build date: 2015-10-21 19:27:41-04
Xamarin addins: d77f191bd7d3451adf837b85b38f2b7c60004400
Mac OS X 10.10.5
Darwin blushweaver.amer.corp.natinst.com 14.5.0 Darwin Kernel Version 14.5.0
Wed Jul 29 02:26:53 PDT 2015
Created attachment 14602 [details]
Screenshot of issue occurring
Created attachment 14603 [details]
iPad settings at time of occurance
Initialization of the CultureInfo can be tricky as it's not possible to perfectly match iOS/OSX and .NET cultures information as their design differs.
iOS sees cultures as a language and a region, both distinct, e.g. en-DE is fine because both 'en' and 'DE' exists, while .NET see this as a single item (en-DE is not valid).
The mono runtime (see mono/metadata/locales.c) initialize the CultureInfo using CFLocaleCopyCurrent and then query the kCFLocaleLanguageCode and kCFLocaleCountryCode. It will fallback to use CFLocaleGetIdentifier if the first values did not produce a match.
Those API _should_ return the same values as iOS settings shows, if not then it the resulting CultureInfo will not match (partially or globally) what you expect.
Can you get the output of those API on the devices that shows the problem ?
Note: Xamarin.iOS will also query `NSLocale.CurrentLocale` to set the default .NET RegionInfo to match the same country code. But that does not sounds like it's the issue you're seeing.
Thanks for the response Sebastien.
I discovered the problem. Under "Region Formats" in settings, there is an "Advanced" row. In there, there is a setting for language which is separate from the overall language setting, and that was set to Bulgarian. This setting apparently should only apply to "dates, times, and numbers" :)
But this is apparently the setting that Xamarin uses for setting the CultureInfo. Is that a bug or is there some reason why it should be that way?
The output with CFLocale:
> This setting apparently should only apply to "dates, times, and numbers"
A bit confusing, the recent (iOS) UI text says (at least in French) that it's used for dates, times, and numbers but it does not say it's _only_ used for them. However changing this value does not change iOS UI language.
That make it sounds like it should be used for `CurrentCulture` but not for `CurrentUICulture` even if it's not really what the API / constant is documented to do .
I'll have a look for the API that would return us the UI culture.
Specifies the locale language code.
The corresponding value is a CFString containing an ISO 639-x/IETF BCP 47 language identifier, such as “ja”.
Available in iOS 2.0 and later.