From what I understand, iOS8 now supports regional localisations (in this case I want to support pt-BR).
See http://www.ibabbleon.com/iOS-Language-Codes-ISO-639.html
I am having problems with this, testing this with a brand new single view application, in xcode I have added the pt and pt-BR languages to my project, and altered text accordingly in the pt.lproj and pt-BR.lproj directories.
After setting my device to pt-BR and running, the text displayed is always pt, not pt-BR as desired.
Indeed logging the preferred locale returned by NSLocale
NSString *language = [[NSLocale preferredLanguages] objectAtIndex:0];
NSLog(@"Locale = %@", language);
Returns only 'Locale = pt'...
Am I missing any steps or is this a bug in iOS8?
Thanks for any help...
For some reason, iOS8 is using pt for Portuguese Brasil (instead of pt_BR). When you select Portuguese Portugal, the localization will be pt_PT
I've deleted the localization, and added the generic portuguese (and replaced with .strings files with the old ones).
According to the apple docs a IETF BCP 47 should be returned. So you should get pt-BR if that's your preferred system language.
If what you want is only the current locale I suggest you use:
Replace currentLocale with autoupdatingCurrentLocale if you want to support locale changes while your app is running.
EDIT: Locale is not the same as language ID! Sorry for misunderstanding. Anyway "pt" is the correct language ID for Brazilian portuguese:
From: https://developer.apple.com/library/ios/documentation/MacOSX/Conceptual/BPInternational/LocalizingYourApp/LocalizingYourApp.html