Add zh_hant, rename zh to zh_hans (re-opened from #1322)#1333
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR renames the Simplified Chinese locale from zh to zh_hans and adds a new Traditional Chinese zh_hant locale for the Jekyll site.
Changes:
- Adds Traditional Chinese locale data and article front matter for index, businesses, and maintainers pages.
- Renames Simplified Chinese article front matter and locale key from
zhtozh_hans. - Removes the old
/zh/article entry in favor of/zh_hans/.
Show a summary per file
| File | Description |
|---|---|
_data/locales/zh_hant.yml |
Adds Traditional Chinese translations. |
_data/locales/zh_hans.yml |
Renames Simplified Chinese locale key. |
_articles/zh/index.html |
Removes old Simplified Chinese landing route. |
_articles/zh_hant/index.html |
Adds Traditional Chinese landing page front matter. |
_articles/zh_hant/businesses.html |
Adds Traditional Chinese businesses page front matter. |
_articles/zh_hant/maintainers.html |
Adds Traditional Chinese maintainers page front matter. |
_articles/zh_hans/index.html |
Adds renamed Simplified Chinese landing page front matter. |
_articles/zh_hans/businesses.html |
Updates Simplified Chinese businesses page language key. |
_articles/zh_hans/maintainers.html |
Updates Simplified Chinese maintainers page language key. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (2)
_articles/zh_hans/businesses.html:3
- This renamed page no longer serves the old
/zh/businesses/URL, which was part of the existing Chinese locale and will now 404. Add a redirect from the old route so links to the previous locale path continue to work.
_articles/zh_hans/maintainers.html:3 - This renamed page drops the existing
/zh/maintainers/URL, so any inbound links to the previous Chinese maintainers page will now fail. Add a redirect from the old route to the new Simplified Chinese path.
- Files reviewed: 9/9 changed files
- Comments generated: 3
Contributor
There was a problem hiding this comment.
Copilot's findings
Comments suppressed due to low confidence (3)
_articles/zh_hans/businesses.html:4
- The old Simplified Chinese businesses page was published at
/zh/businesses/; after this rename only/zh_hans/businesses/will be generated, so existing inbound links to the old URL will break. Add a redirect from the previous path on the renamed page.
_articles/zh_hans/maintainers.html:4 - The old Simplified Chinese maintainers page was published at
/zh/maintainers/; after this rename only/zh_hans/maintainers/will be generated, so existing inbound links to the old URL will break. Add a redirect from the previous path on the renamed page.
_data/locales/zh_hans.yml:1 - This locale key is emitted verbatim as
<html lang>and as thehreflangvalue in_layouts/default.htmland_includes/head.html.zh_hansis not a valid BCP 47/HTML language tag (the standard form iszh-Hans), so browsers, assistive technologies, and crawlers may not recognize the page language correctly; preserve the URL slug separately from the emitted language tag or normalize this value when rendering those attributes.
- Files reviewed: 9/9 changed files
- Comments generated: 2
Comment on lines
+1
to
+5
| --- | ||
| layout: index | ||
| lang: zh_hans | ||
| permalink: /zh_hans/ | ||
| --- |
| @@ -0,0 +1,125 @@ | |||
| zh_hant: | |||
Preserves inbound links and indexed search results for the existing /zh/, /zh/businesses/, and /zh/maintainers/ URLs after the locale rename. Uses the already-enabled jekyll-redirect-from plugin so no new dependencies are introduced. Addresses Copilot review feedback on PR #1333. Co-authored-by: Copilot <[email protected]>
The hreflang attribute requires BCP 47 language tags, but the existing template was emitting the raw locale key (e.g. 'zh_hans') as the hreflang value. Underscores aren't valid in BCP 47, so the new locales would have produced non-conformant alternate links that search engines ignore. Adds an optional 'hreflang' key to each locale's data file, with the template falling back to the locale key when the key is absent. That keeps every existing locale's output unchanged (single-subtag codes like 'es', 'pt', 'de' are already valid BCP 47) and lets zh_hans and zh_hant emit zh-Hans and zh-Hant. Addresses Copilot review feedback on PR #1333. Co-authored-by: Copilot <[email protected]>
Contributor
Author
|
Addressed both findings in 4a6c6f2 + d0f8319:
html 2. Non-BCP 47 hreflang values. The template was emitting the raw locale key (hreflang="zh_hans"), but BCP 47 doesn't allow underscores. Added an optional hreflang: field to each locale's data file and updated _includes/head.html to read it with | default: lang, so every existing locale (es, pt, de, …) is unchanged and zh_hans / zh_hant now emit:html HTMLProofer passes locally on the full build (3 checks, 61 files, 136 internal + 116 external links). |
2 tasks
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.
Re-opens #1322 from a local branch so CodeQL runs and the org code-scanning ruleset can be satisfied (fork PRs don't get CodeQL coverage in this repo, leaving #1322 permanently
BLOCKED).Single-commit cherry-pick of jyangchisyan's work (original author preserved):
zh_hans:_articles/zh_hans/withpermalink: /zh_hans/_data/locales/zh_hant.ymland corresponding_articles/zh_hant/{businesses,index,maintainers}.htmlwithpermalink: /zh_hant/The language switcher iterates
site.data.locales | sortand uses each locale's key as the URL slug, so the new/zh_hans/and/zh_hant/routes will appear automatically with no hardcoded link updates needed.One thing to confirm before merging: any inbound traffic to
/zh/(search results, external blog links) will 404 after the rename. Worth deciding whether to:/zh_hans/
redirect (e.g., a stub_articles/zh/index.htmlwith a meta refresh), or 2. Accept the breakage since/zh/` was the only Chinese locale and Simplified is the closest mapping.Closes #1322.
Co-authored-by: samueljiang [email protected]