I am testing my app with different languages. On Windows Phone and Android, everything is fine. However, testing in the iOS Simulator, the code for detecting the language is not picking up the preferred languages.
This is what I am using:
var netLanguage = "en";
if (NSLocale.PreferredLanguages.Length > 0)
{
var pref = NSLocale.PreferredLanguages [0];
netLanguage = pref.Replace ("_", "-");
}
return new System.Globalization.CultureInfo(netLanguage);
However, the PreferredLanguages collection is coming back empty. If I hack this and set the netLanguage to the appropriate value (e.g. "nl") then I can test my app, but would far prefer to get this working. Is this an issue in the simulator, or is the bit of code above (which I got from a sample) incorrect?
Many thanks,
John H.