iOS8 Regional Localization (e.g. pt-BR)?

前端 未结 2 2009
猫巷女王i
猫巷女王i 2021-01-12 15:31

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

相关标签:
2条回答
  • 2021-01-12 16:05

    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

    0 讨论(0)
  • 2021-01-12 16:14

    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).

    0 讨论(0)
提交回复
热议问题