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

Update Chinese & Cantonese localization #7235

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

auroursa
Copy link
Contributor

@auroursa auroursa commented Dec 21, 2024

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

The compatibility issue on Android stems from the differences in Hermes implementation of Intl. On Android, it is based on the ICU4j project, which does not include RFC 1766 Chinese language codes like zh-CN. This will be an attempt to fix #6728 without introducing polyfills.

Similar to ast #6774, yue has been proven to be a valid language code for app language. Tests have shown that zh-Hans-CN and zh-Hant-TW can also be correctly used by app language.

Since these code changes are all related to Chinese adjustments (including modifications to deviceLocales.ts), I’ve included them in the regular Chinese localization update PR instead of opening a new one. This also helps our translators test the impact of the changes earlier.

Note the impact of changing the language code is limited to the app display language, Cantonese still cannot be used as post language.

Co-maintained by @cirx1e @hakadao @VentusUta

// Simplified Chinese to zh-CN
locale.languageTag = 'zh-CN'
if (
locale.languageTag === 'zh-CN' ||
Copy link
Contributor Author

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')
Copy link
Contributor Author

@auroursa auroursa Dec 21, 2024

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.

Because it’s unlikely to maintain so many Chinese variants at this stage.

// Traditional Chinese to zh-TW
locale.languageTag = 'zh-TW'
}
if (locale.languageTag.startsWith('yue')) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After renaming zh-HK to yue, this is no longer needed.

@auroursa
Copy link
Contributor Author

I have considered directly using zh-Hans and zh-Hant instead of the current more complex expressions, but in my cross-testing, their compatibility wasn't good.

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.

Post time in Chinese cannot be localized on Android
1 participant