Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Distinguish zh_CN/zh_TW by Locale country and script #236

Merged
merged 4 commits into from
Oct 12, 2018
Merged

Distinguish zh_CN/zh_TW by Locale country and script #236

merged 4 commits into from
Oct 12, 2018

Conversation

FantasyCheese
Copy link
Contributor

In CountryCodePicker::getCCPLanguageFromLocale(), currentLocale.getLanguage is not enough to distinguish between Chinese Simplified/Traditional because both have code 'zh' in Language Enum.

Before API 19, there are only two Locale zh_CN / zh_TW, so country is enough to make decision.

After API 19 following Locale options is added:
zh__#Hans,zh_CN_#Hans,zh_HK_#Hans,zh_MO_#Hans,zh_SG_#Hans,zh__#Hant,zh_HK_#Hant,zh_MO_#Hant,zh_TW_#Hant.

Take Hong Kong as an example, it has both Hans and Hant, which stand for Simplified and Traditional respectively, so country is no longer enough, and script part is more accurate.

If other language translations added in the future have same kind of conflict, specifying country and script in Language Enum should work as well.

@hbb20 hbb20 merged commit ba3a637 into hbb20:master Oct 12, 2018
@hbb20
Copy link
Owner

hbb20 commented Oct 12, 2018

Thank you for enhancing CCP... 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants