Skip to content

chore(ci): check translation keys on pull requests - #4622

Draft
thetaPC wants to merge 1 commit into
mainfrom
translation-check
Draft

chore(ci): check translation keys on pull requests#4622
thetaPC wants to merge 1 commit into
mainfrom
translation-check

Conversation

@thetaPC

@thetaPC thetaPC commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Issue URL: N/A

What is the current behavior?

No PR check builds a non-default locale. build:preview is docusaurus build --locale en and only build:production builds all locales, so anything that fails specifically in ja gets through review and breaks the main deploy instead.

That just happened: the Docusaurus 3.10 upgrade added a validation that rejects duplicate sidebar translation keys, our three "Build Your First App" categories collide on one key, and every check on that PR was green because none of them touched ja.

What is the new behavior?

A Check Translation Keys step runs on pull requests, before Check Diff:

- name: Check Translation Keys
  if: strategy.job-index == 0
  shell: bash
  run: |
    trap 'rm -rf i18n' EXIT
    npm run generate-markdown
    npx docusaurus write-translations --locale ja

write-translations extracts translatable strings through the same code path the localized build uses, so it hits the same validation, but it never compiles anything. It caught the real failure in 2 seconds, versus minutes for docusaurus build --locale ja.

The workflow is also renamed from Install Dependencies, Lint to Validate Docs. The old name was already stale, since it didn't mention Spell Check, and naming it after the steps is what let it drift.

Does this introduce a breaking change?

  • Yes
  • No

Other information

How to test:

The check should fail where the duplicate keys still exist, and pass where they are fixed. Run it on both branches to see each side.

1. This branch, without the fix. The check should fail.

git checkout translation-check
npm run generate-markdown
npx docusaurus write-translations --locale ja

Expected: exits 1 with

[ERROR] Error: Multiple docs sidebar items produce the same translation key.
- `sidebar.docs.category.Build Your First App`: 3 duplicates found:
  - Build Your First App (The label for category 'Build Your First App' in sidebar 'docs')
  - Build Your First App (The label for category 'Build Your First App' in sidebar 'docs')
  - Build Your First App (The label for category 'Build Your First App' in sidebar 'docs')

2. The branch with the sidebar fix. The check should pass.

git checkout jp-react-19-fix
npm run generate-markdown
npx docusaurus write-translations --locale ja

Expected: exits 0 and reports the files it wrote, for example

[INFO] 68 translations will be written at "i18n/ja/docusaurus-plugin-content-docs/current.json".
[INFO] 67 translations will be written at "i18n/ja/docusaurus-plugin-content-docs/version-v7.json".

3. Clean up.

rm -rf i18n/

@vercel

vercel Bot commented Aug 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ionic-docs Ready Ready Preview Aug 6, 2026 11:03pm

Request Review

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.

1 participant