Bug 24956 - Region format advanced settings language sets CultureInfo incorrectly
Summary: Region format advanced settings language sets CultureInfo incorrectly
Status: RESOLVED ANSWERED
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: XI 8.4.0
Hardware: PC Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-12-01 10:59 UTC by Sami M. Kallio
Modified: 2015-01-05 07:51 UTC (History)
3 users (show)

Tags:
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:
Status:
RESOLVED ANSWERED

Description Sami M. Kallio 2014-12-01 10:59:10 UTC
When one changes the advanced language option to something else than primary language the CultureInfo is now set to that language. To reproduce:

1) Set the primary language to A (for example to English)
2) Set the Advanced options:
   - Automatic OFF
   - Language to f.e. Finnish (this is for dates, times & numbers only)

At runtime print out culture info:

            System.Diagnostics.Debug.WriteLine(
                System.Globalization.CultureInfo.CurrentCulture);

            System.Diagnostics.Debug.WriteLine(
                System.Globalization.CultureInfo.CurrentUICulture);

            System.Diagnostics.Debug.WriteLine(
                System.Globalization.CultureInfo.InstalledUICulture);

Output:

2014-12-01 10:55:09.663 CultureInfo[289:10285] fi-FI
fi-FI
2014-12-01 10:55:09.665 CultureInfo[289:10285] fi-FI
fi-FI
2014-12-01 10:55:09.667 CultureInfo[289:10285] fi-FI
fi-FI
Comment 1 Tajinder Singh 2014-12-29 04:26:19 UTC
We are able to reproduce the behavior as mentioned in bug description.

Screencast for this: http://www.screencast.com/t/v9po0FUPZkFs

Supplement Info:
IDE log: https://gist.github.com/anonymous/6b4d031af0210ec250f1

We need confirmation from the developer if this is a bug. Leaving as NEW for
now.

Environment Info:
Xamarin Studio
Version 5.5.4 (build 15)
Installation UUID: 3d25a767-a003-4a7d-9f5e-e57987cf6cf0
Runtime:
	Mono 3.10.0 ((detached/92c4884)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 310000031

Apple Developer Tools
Xcode 6.1 (6602)
Build 6A1052c

Xamarin.Mac
Version: 1.11.3.0 (Enterprise Edition)

Xamarin.Android
Version: 4.20.0.28 (Enterprise Edition)
Android SDK: /Users/mac360_xamarin/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		4.0.3 (API level 15)
		4.4   (API level 19)
		5.0   (API level 21)
Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

Xamarin.iOS
Version: 8.4.0.43 (Enterprise Edition)
Hash: 840a925
Branch: 
Build date: 2014-11-16 21:03:22-0500

Build Information
Release ID: 505040015
Git revision: f93940a35458a18052f1a25e106e62ca970d9c40
Build date: 2014-11-19 15:32:41-05
Xamarin addins: dc23cbd91a3a0e1d326328e1229e86c942a49ec8

Operating System
Mac OS X 10.10.0
Darwin mac360-xamarins-Mac-mini.local 14.0.0 Darwin Kernel Version 14.0.0
    Fri Sep 19 00:26:44 PDT 2014
    root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64
Comment 2 Rolf Bjarne Kvinge [MSFT] 2015-01-05 07:51:43 UTC
According to MSDN, 'CurrentCulture' determines the default format for dates, times, numbers, etc, so as far as I can see the value is correct.

OTOH CurrentUICulture is supposed to selected UI language, and there we could probably have chosen a better default than the same as CurrentCulture.

However changing this now would be a breaking change, and the workaround is simple: you can change CurrentUICulture yourself to whatever you wish. You can use NSLocale.PreferredLanguages [0] like this:

     Thread.CurrentThread.CurrentUICulture = new CultureInfo (NSLocale.PreferredLanguages [0]);