Hi eskimo,
Once again I apologize for my English, I try to be simple and direct.
iPhone with iOS 7.1.2
With:
- Setting - General - International
-> Language = English
-> Voice Control = English
-> Keyboards -> 3
-> Region Format = Portugal
-> Calendar = Gregorian
I have:
[[NSLocale currentLocale] localeIdentifier] -> pt_PT
[[NSBundle mainBundle] preferredLocalizations] -> one object with pt-PT
With:
- Setting - General - International
-> Language = Português (Portugal)
-> Voice Control = Português
-> Keyboards -> 3
-> Region Format = Portugal
-> Calendar = Gregorian
I have:
[[NSLocale currentLocale] localeIdentifier] -> pt_PT
[[NSBundle mainBundle] preferredLocalizations] -> one object with pt-PT
iPhone with iOS 8.4
With:
- Setting - General - Language & Region
-> iPhone Language = English
-> Preferred Language Order = English, Português (Portugal)
-> Keyboards -> 3
-> Region = Portugal
-> Calendar = Gregorian
-> Advanced = Automatic - On
I have:
[[NSLocale currentLocale] localeIdentifier] -> en_PT (!?)
[[NSBundle mainBundle] preferredLocalizations] -> one object with pt-PT
With:
- Setting - General - Language & Region
-> iPhone Language = Português (Portugal)
-> Preferred Language Order = Português (Portugal), English
-> Keyboards -> 3
-> Region = Portugal
-> Calendar = Gregorian
-> Advanced = Automatic - On
I have:
[[NSLocale currentLocale] localeIdentifier] -> pt_PT
[[NSBundle mainBundle] preferredLocalizations] -> one object with pt-PT
I can not correctly know the iPhone Language !?
Thanks,
JFontes
Update:
The first time I run the app, these method give the correct information, and keep it.
Then give me the same information, change or not the iPhone language.
Update #2: I found the solution:
[[[NSLocale preferredLanguages] objectAtIndex:0] substringToIndex:2] gives a NSString* with the first two letters of the language that is configured iPhone.
BUT not save the language into standardUserDefaults with key @"AppleLanguages".
Thanks to everyone who helped me.
JFontes