Bug 25112 - CurrentCulture value not updating correctly on iOS7.1
Summary: CurrentCulture value not updating correctly on iOS7.1
Status: RESOLVED UPSTREAM
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: XI 8.4.0
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-12-05 12:45 UTC by Glenn Wester
Modified: 2014-12-05 14:43 UTC (History)
2 users (show)

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


Attachments
Sample project that shows CurrentCulture on labels (9.51 KB, application/zip)
2014-12-05 12:45 UTC, Glenn Wester
Details


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:
Status:
RESOLVED UPSTREAM

Description Glenn Wester 2014-12-05 12:45:21 UTC
Created attachment 8981 [details]
Sample project that shows CurrentCulture on labels

The CurrentCulture property is returning the incorrect value on iOS7.1 devices. If you set the device Language from English to German it will still return a English value. 

I have attached a simple sample project which verifies this behavior.

Steps to reproduce:
1. Grab a device running iOS7.1
2. Go to Settings -> General -> Language & Region -> Language. Change to Deutsch (German)
3. Run the sample code
4. Confirm that the following code is returning "en-US" instead of "de-DE"
Thread.CurrentThread.CurrentUICulture.ToString();
Thread.CurrentThread.CurrentCulture.ToString();
NSLocale.CurrentLocale.Identifier
Comment 1 Sebastien Pouliot 2014-12-05 14:15:54 UTC
> 2. Go to Settings -> General -> Language & Region -> Language. 

That does not sound right. In iOS 7.1 you have:

> Settings -> General -> International -> Language

What you're showing looks like iOS 8.x options.


But I do see

en-US
en-US
en_US

if I run this in a German iOS 7.1 device.

The first two (.net) properties are build from the value returned from iOS' `NSLocale.CurrentLocale`. If iOS returns an incorrect value then the .net values will be wrong.

I'll confirm with an ObjC app but it really looks like an iOS issue.

note: 99% of our bindings are direct mapping to iOS API, i.e. there's no version checks or alterations of results.
Comment 2 Sebastien Pouliot 2014-12-05 14:43:37 UTC
sim:

2014-12-05 14:30:23.440 culture25112[7969:607] Cannot find executable for CFBundle 0x7b770d30 </Applications/Xcode62-beta1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/System/Library/AccessibilityBundles/CertUIFramework.axbundle> (not loaded)
2014-12-05 14:30:23.587 culture25112[7969:607] Language: en_US

device:

2014-12-05 14:36:59.270 culture25112[8246:60b] Language: en_CA <- that's because of how my country, not language is set


I get the same issue with Xcode/ObjC (both using the simulator and on device), i.e. it's an iOS issue. 


Possible workaround:

It seems that only the collation is being set to "de", not the rest of the properties. That could be used as a workaround, i.e. check the collation and then switch the Thread.CurrentThread.CurrentCulture to match.