NSLocale returns wrong country code for German
| Originator: | georg | ||
| Number: | rdar://22869580 | Date Originated: | 26-Sep-2015 02:49 PM |
| Status: | Open | Resolved: | |
| Product: | iOS SDK | Product Version: | 9.0 |
| Classification: | Serious Bug | Reproducible: | Yes |
Summary: On an iPhone using iOS 9 with the language set to German, NSLocale returns the wrong country code. Steps to Reproduce: 1. Use iPhone with iOS 9 2. Set iPhone language to German 3. Execute the following code: NSString * language = [[NSLocale preferredLanguages] objectAtIndex:0]; Expected Results: I expect a return value of 'de' Actual Results: The value returned is 'de-US' Version: iOS 9.0 Notes: Configuration: iPhone 6+
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
With iOS 9, the results returned by NSLocale.preferredLanguages() can differ from previous releases.
With iOS 9, the results returned by NSLocale.preferredLanguages() can differ from previous releases. In iOS 8 and earlier, only certain language, script, and region combinations were returned by this API. However, in iOS 9, more combinations of language, script, and region are permitted.
For example, when a user has configured their iOS device with language set to English and region set to India, NSLocale.preferredLanguages() will now return [ "en-IN" ], instead of [ "en" ]. This allows for smarter language fallbacks; for this user, if an app doesn’t support en-IN as a localization, but does support en-GB, the fallback mechanism will select en-GB instead of en.
Read more at : https://developer.apple.com/library/ios/technotes/tn2418/_index.html#//apple_ref/doc/uid/DTS40016588