Distinguish zh_CN/zh_TW by Locale country and script #236
Merged
hbb20 merged 4 commits intohbb20:masterfrom Oct 12, 2018
FantasyCheese:master
Merged
Distinguish zh_CN/zh_TW by Locale country and script #236hbb20 merged 4 commits intohbb20:masterfrom FantasyCheese:master
hbb20 merged 4 commits intohbb20:masterfrom
FantasyCheese:master
Conversation
Owner
|
Thank you for enhancing CCP... 😄 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.