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:
[[NSLocale currentLocale] localeIdentifier]
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:
... For example, use pt as the language ID for Portuguese as it is used in Brazil and pt-PT as the language ID for Portuguese as it is used in Portugal. The Other submenu (at the bottom of the list) contains more languages and dialects.
From: https://developer.apple.com/library/ios/documentation/MacOSX/Conceptual/BPInternational/LocalizingYourApp/LocalizingYourApp.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With