Why is the language character obtained by NSLocale.preferred Languages sometimes zh Han HK and sometimes zh HK? What kind of setting determines the value of this character
Explanation of the return value of NSLocale.preferred Languages
Why is the language character obtained by NSLocale.preferred Languages sometimes “zh-Han-HK” and sometimes “zh-HK”? What kind of setting determines the value of this character. Thanks.
You can set this in Settings (Language & Region). The system may make additional decisions based on the the languages you declare in Settings.
I want to know under what circumstances will it return to 'zh-hant-hk', and when will it return to 'zh-hk'. Could you share some relevant documentation.
My colleague reminded me to look at this post, and I hope I am not too late to the party...
Would you mind to share how you get zh-HK
as the language code? Specifically, the following information will help:
- Your system version.
- A screenshot of your system language and region settings. On iOS, it's at Settings > General > language & Region.
In our latest systems, if your system language is set to Traditional Chinese (Hongkong), the language code should be zh-Hant-HK
; if it is set to Traditional Chinese, the code should be zh-Hant-US
, assuming that the system region is set to United States.
I haven't seen h-HK
, but there may be something historial that leads to the result you see, and I may be able to get to the bottom if you can share more information.
Best,
——
Ziqiao Chen
Worldwide Developer Relations.