Culture for localization in iOS

CaioshinnCaioshinn USMember ✭✭
edited January 2018 in Xamarin.Forms

Hello, I'm facing with a new problem trying to retrieve the current culture set on the iphone (as language set to main language of OS).

In one iphone 6 with iOS 11.2.1 when the language is set to italian if I retrieve the lang with these instructions:

    var loc = NSLocale.CurrentLocale.LanguageCode;
    var currCulture = CultureInfo.CurrentCulture.ToString();
            var lang = NSLocale.PreferredLanguages[0];

I found that the first 2 instructions return me a wrong code (en), and the only way that I have to understand the real current language is only reading the variable lang.

On another iphone (6s with iOS 10.3.2) all the variables return the correct value (it and it-IT, and the currCulture is the way that I used until some hours ago convinced that it was the right way to do it).

So I'm asking to myself, what is the best way that give me the assurance to obtain the right code?

Sign In or Register to comment.