Bug 15214 - Retrieving System.Globalization Culture info returns Invariant info
Summary: Retrieving System.Globalization Culture info returns Invariant info
Status: RESOLVED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries ()
Version: 4.8.x
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2013-10-04 15:44 UTC by Neal
Modified: 2013-10-31 04:08 UTC (History)
2 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 FIXED

Description Neal 2013-10-04 15:44:14 UTC
Hello,

In my apps it's helpful to get the region information for the user to troubleshoot issues, i.e. are they in the US or Netherlands which has different date/number formats.  This works fine in iOS, but in Android it's returning "Invariant Language and Invariant Country".

System.Globalization.CultureInfo.CurrentCulture.DisplayName
System.Globalization.CultureInfo.CurrentCulture.ToString()

These results are from my Samsung Galaxy S4 (I'm in the US) and I'm using the 4.8.3 build installed today from the beta channel.

Thank you.
Comment 1 Neal 2013-10-04 15:44:38 UTC
My device is running Android 4.2.2
Comment 2 Jonathan Pryor 2013-10-07 12:43:00 UTC
Fixed in monodroid/d63cbcd7 and monodroid-4.8.2-branch/355b80cb. It should appear in the next 4.8 .3 beta release.
Comment 3 David PIHAN 2013-10-29 13:56:56 UTC
Hello,
I have updated mono today with version 4.8.3 and I have still the problem on my HTC One SV phone setup in German. 
In fact in the phone settiongs I am in "German (Frankreich)" (it seems that the phone has been bought in France and this is a french ROM) so the culture is "invariant". 
If I setup French on the phone, the culture is "French"...
Best regards,
David
Comment 4 Jonathan Pryor 2013-10-30 15:37:14 UTC
@David: That seems like expected behavior. Mono does not contain locale data for "German (Frankreich)" (which I assume is de-FR); mono only contains locale data for de, de-AT, de-CH, de-DE, de-LI, and de-LU. Note that de-FR is not on that list.

https://github.com/mono/mono/blob/master/mono/metadata/culture-info-tables.h#L921

Since your locale isn't found, Mono will fallback to the Invariant culture.

> If I setup French on the phone, the culture is "French"...

Locale info for fr-FR is available (line 981), which is why it works.

We would need to add support for de-FR in order for your device to work.
Comment 5 David PIHAN 2013-10-31 04:08:23 UTC
Hi Jonathan,
Thanks for your prompt answer.
Isn't possible if de-XX does not exists to force to "de" which exists in the culture instead of invariant ?
Best regards,
David