Skip to content

Add zh_hant, rename zh to zh_hans (re-opened from #1322)#1333

Merged
AndreaGriffiths11 merged 3 commits into
mainfrom
patch/zh-hant-locale-0531-local
May 31, 2026
Merged

Add zh_hant, rename zh to zh_hans (re-opened from #1322)#1333
AndreaGriffiths11 merged 3 commits into
mainfrom
patch/zh-hant-locale-0531-local

Conversation

@AndreaGriffiths11
Copy link
Copy Markdown
Contributor

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/ with permalink: /zh_hans/

  • Add full _data/locales/zh_hant.yml and corresponding _articles/zh_hant/{businesses,index,maintainers}.html with permalink: /zh_hant/

The language switcher iterates site.data.locales | sort and 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]

Copilot AI review requested due to automatic review settings May 31, 2026 22:46
@AndreaGriffiths11 AndreaGriffiths11 requested a review from a team as a code owner May 31, 2026 22:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 zh to zh_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

Comment thread _articles/zh_hans/index.html
Comment thread _articles/zh_hant/index.html
Comment thread _articles/zh_hans/index.html
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 the hreflang value in _layouts/default.html and _includes/head.html. zh_hans is not a valid BCP 47/HTML language tag (the standard form is zh-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/
---
Comment thread _data/locales/zh_hant.yml
@@ -0,0 +1,125 @@
zh_hant:
Andrea Griffiths and others added 2 commits May 31, 2026 19:09
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]>
@AndreaGriffiths11
Copy link
Copy Markdown
Contributor Author

Addressed both findings in 4a6c6f2 + d0f8319:

  1. Stale /zh/ URLs → 404 after the rename. Added redirect_from: front matter (the jekyll-redirect-from plugin is already enabled in _config.yml) to the three zh_hans pages so /zh/, /zh/businesses/, and /zh/maintainers/ continue to resolve. Verified the build emits proper meta-refresh stubs:

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).

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot's findings

  • Files reviewed: 10/10 changed files
  • Comments generated: 0 new

@AndreaGriffiths11 AndreaGriffiths11 merged commit 7a5fffb into main May 31, 2026
6 checks passed
@AndreaGriffiths11 AndreaGriffiths11 deleted the patch/zh-hant-locale-0531-local branch May 31, 2026 23:25
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.

2 participants