-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Update Chinese & Cantonese localization #7174
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me explain some of the related changes to deviceLocales.ts
, which are made to compatibility for both Web and Native platforms.
// Simplified Chinese to zh-CN | ||
locale.languageTag = 'zh-CN' | ||
if ( | ||
locale.languageTag === 'zh-CN' || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To ensure browser compatibility, as browsers still widely use RFC-1766.
locale.languageTag = 'zh-CN' | ||
if ( | ||
locale.languageTag === 'zh-CN' || | ||
locale.languageTag.startsWith('zh-Hans') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are multiple zh-Hans
/ zh-Hant
variants on iOS and Android, such as zh-Hans-SG
. We want to match as many of these language variants as possible.
// Traditional Chinese to zh-TW | ||
locale.languageTag = 'zh-TW' | ||
if ( | ||
locale.languageTag === 'zh-TW' || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the same reason as above—browser compatibility.
locale.languageTag = 'zh-TW' | ||
if ( | ||
locale.languageTag === 'zh-TW' || | ||
locale.languageTag.startsWith('zh-Hant') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
// Cantonese (Yue) to zh-HK | ||
locale.languageTag = 'zh-HK' | ||
// Cantonese (Yue) to yue | ||
locale.languageTag = 'yue' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To match the two variants on Android and iOS:
yue-Hans
and yue-Hant
.
Not using yue-Hant
directly due to poor browser compatibility.
This PR includes the latest translations from Crowdin, and cleans up outdated strings.
Update: We are attempting to convert the language codes for Chinese and Cantonese from RFC-1766 to RFC-4646, to resolve language-related compatibility issues.
The following are the changes:
zh-CN
->zh-Hans-CN
zh-TW
->zh-Hant-TW
zh-HK
->yue
Similar to
ast
#6774,yue
has been proven to be a valid language code for application languages. Tests have shown thatzh-Hans-CN
andzh-Hant-TW
can also be correctly used by Lingui and the application.Note the impact of changing the language code is limited to the app display language, Cantonese still cannot be used as post language.
This will be an attempt to fix #6728 without introducing a polyfills.
Co-maintained by @cirx1e @hakadao @VentusUta