开发者

How to determine if the user prefers simplified or traditional Chinese characters

开发者 https://www.devze.com 2023-02-02 04:22 出处:网络
In an Android app, is there a standard way to determine whether a user prefers simplified or traditional Chinese characters?

In an Android app, is there a standard way to determine whether a user prefers simplified or traditional Chinese characters?

I know next to nothing about Chinese, but I do know from Wikipedia that simplified Chinese is used in mainland China (locale zh_CN) and Singapore whereas traditional Chinese is used in Taiwan (locale zh_TW), Hong Kong, and Ma开发者_JAVA技巧cau. Differentiating on the country code might be acceptable for the initial choice, but it would be problematic for someone in mainland China who prefers traditional characters, or someone in Hong Kong who prefers simplified characters. Is there a global setting for this preference?

If I must resort to an app-specific setting, is there an ad hoc standard way of sharing this information with other apps?


Just treat it as how you'd treat any other two languages. Don't rely on region. Just go with what the user has set in their default locale.

To check for the default locale:

Locale myPhoneLocale = Locale.getDefault();

If you want to translate your strings.xml file for both traditional and simplified, just make a values-zh-rCN folder and throw simplified in there, and another values-zh folder for traditional.

Most Chinese users are able to read both simplified and traditional. (Some might be annoyed at having to read the one they are less used to, but it's not the end of the world.) I personally only localize my apps to simplified Chinese, since mainland China has the most android users.

0

精彩评论

暂无评论...
验证码 换一张
取 消