Skip to content

refactor(website): move UI text out of scripts before translation - #1737

Closed
kaoru0822-kitauji wants to merge 7 commits into
mainfrom
refactor/website-i18n-prep
Closed

kaoru0822-kitauji wants to merge 7 commits into
mainfrom
refactor/website-i18n-prep

Conversation

@kaoru0822-kitauji

Copy link
Copy Markdown
Collaborator

Step 1 of the website translation plan (zh-Hans, zh-Hant, ja, ko, fr, de). This PR changes only English pages. Readers should see no difference.

Changes

  • Font tokens. --font-sans and --font-mono on :root replace the literal font stacks, so later per-language rules (:lang(...)) only override the tokens. The Aegis code display keeps its ui-monospace first choice (ui-monospace, var(--font-mono)). One side effect: its fallback list now also includes Liberation Mono.
  • main.js has no reader-facing text.
    • Copy feedback (Copied, Selected and the two status messages) comes from data-* attributes on the shared #copy-status element in the footer template.
    • Each Copy button restores its own original label instead of a hard-coded "Copy".
    • The GitHub star label uses data-label-one / data-label-other from the header template, chosen with Intl.PluralRules. The count is formatted with Intl.NumberFormat for the page's lang, which gives the same 1,234 for en as the previous en-US.
  • Demo messages in the page. home.js (percent demo) and dino-demo.js (game, canvas labels, speed check) read data-msg-* attributes with {name} placeholders. The home page and examples/dino-lab/ both carry the attributes.
  • Skip link in the header template. It is now rendered inside the website:header region, and all 17 synced pages were regenerated. templates/page.html no longer contains its own copy.
  • Fixed the lowercase aria-label Copy ghidra connection · macos / linux → Copy Ghidra connection for macOS and Linux, matching the Windows label.
  • website/README.md documents where script messages live.

Validation

  • python3 scripts/website.py check: passes (19 HTML pages, 422 local references, 17 indexable pages, 7 regression tests).
  • npm run format:check: passes. oxlint website/public/assets reports only the existing max-lines-per-function warning on initializeDinoDemo, which is also present on main.
  • Comparison with main in real headless Firefox (the installed Firefox, driven over WebDriver BiDi; main served from git archive origin/main):
    • Full-page screenshots at 375px and 1440px of the home page, dino lab, get-started, FAQ and Aegis are byte-identical between main and this branch.
    • These read out the same: the percent-demo status through both operations, the dino button/status text through play, pause, slider, auto toggle, reset and crash, the canvas text, the dino-lab speed check, copy feedback on both the clipboard-success and fallback-selection paths with the label restored after 2 s, the star label for 1 and 1,234 stars (fetch stubbed), and the skip link as the first link.
  • Not verified: Chromium and WebKit rendering (no other browser is installed here).

🤖 Generated with Claude Code

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-11T06:41:07.736470Z 8b0fe11 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@kaoru0822-kitauji
kaoru0822-kitauji marked this pull request as draft October 11, 2026 07:01
kaoru0822-kitauji and others added 3 commits October 11, 2026 07:09
Prepare the website for localized pages without changing what English
readers see:

- Add --font-sans and --font-mono tokens and use them for every font stack.
- Read copy feedback from the shared #copy-status element, restore each
  Copy button's own label, and build the GitHub star label from header
  data attributes with Intl.PluralRules and Intl.NumberFormat for the
  page language.
- Move the percent demo, dinosaur game and speed-check messages into
  data-msg-* attributes on the home page and dino lab.
- Render the skip link from the shared header template.
- Fix the lowercase Ghidra macOS/Linux copy-button label.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A page that omits a message attribute (a translation that drops one, or a
page without the shared footer) must not show empty or "undefined" text:

- Copy buttons still copy without #copy-status or its messages, keep their
  own label and leave the status empty.
- The star label is skipped when the header has no label for the count.
- The percent demo, dinosaur game and speed check leave the current text in
  place for a missing message; an unknown {placeholder} stays literal.

scripts/test-website-scripts.mjs runs main.js, home.js and dino-demo.js
against a small document model with node:test. `website.py check` runs it,
so the website CI job and the publisher's preparation job now set up the
repository's Node.js version.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kaoru0822-kitauji
kaoru0822-kitauji force-pushed the refactor/website-i18n-prep branch from 8b0fe11 to 80f6365 Compare October 11, 2026 07:09
kaoru0822-kitauji and others added 4 commits October 11, 2026 07:23
Prepare translated versions of the home, Get started, Guides and FAQ pages
in zh-Hans, zh-Hant, ja, ko, de and fr. English stays at the root and each
language lives under its own directory. No translated page exists yet, so
English pages only gain an og:locale tag.

- LANGUAGES in website.py owns each language's directory, lang/hreflang tag,
  menu name and og:locale; locales/<language>.json holds the shared UI text
  (non-English locales start as English placeholders).
- sync renders the header, footer and sharing regions in the page's
  language: localized navigation with an EN badge on English-only targets,
  a native-details language menu (same page, else the language's reviewed
  home, else omitted), hreflang alternates with x-default, og:locale
  alternates and the brand link to the language's home.
- Translations record source-sha256 and status (draft or reviewed). Drafts
  are noindex and stay out of the sitemap, menus, hreflang and navigation.
- sync copies every Copy-targeted code block from English by ID, and fills
  the website:translation-notice region when the English text has changed.
  The hash leaves out shared regions and those code blocks.
- The verifier checks records, copied code, ID/Copy/data-msg parity while
  fresh, whitespace between CJK characters in ja/zh, and the page's lang.
  An out-of-date translation, inline-code differences, links to English
  pages with a reviewed translation and English placeholder UI strings
  are warnings, shown as GitHub annotations and in the job summary.
- New commands: `translate <language> <route>` creates a draft and
  `translations` reports status, freshness and OS names to confirm.
- styles.css adds per-language CJK font stacks, CJK heading, emphasis and
  line-breaking rules, German hyphenation, and the menu, badge and notice.
- The publisher runs sync after the checks so notices are current.
- website/translation.md documents the workflow, rules, register, glossary
  (with Korean), OS names to confirm and the review checklist.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The menu's list opened leftward past the screen edge on phones, and at
320px the fourth header button overlapped the brand. Open the list to the
right below 640px, and hide the GitHub star count below 360px when a page
has a language menu.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The translation tests now drop existing translated pages from their site
copy, read expected UI strings from the locale file, and insert their own
paragraphs and code changes instead of editing particular English
sentences, so ordinary page edits and new translations do not break them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Pilot translation created with `website.py translate zh-hant get-started`
and translated in place. It stays a noindex draft until review, so it is
not linked from other pages, the sitemap or hreflang.

- locales/zh-hant.json: Taiwan-standard UI strings for the header, footer,
  copy messages, star label and out-of-date notice.
- Prose, headings, captions, Copy labels, the agent prompts, title and
  description are translated; commands and paths come from English.
- Ten OS names are marked data-os-ui for confirmation (PowerShell's
  messages, the Start menu, File Explorer and Copy as path on Windows;
  Terminal, the Pathname command and Show Package Contents on macOS).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@N0zoM1z0

Copy link
Copy Markdown
Collaborator

Thanks for the work on this, especially the script-message separation and Traditional Chinese onboarding draft.

The complete multilingual implementation is now in #1779, covering all 19 README languages, reading pages, figures and interactive examples. It uses gettext catalogs and generated language pages, so we should keep one translation system.

I've incorporated your CJK font choices, original copy-button label restoration, accessibility wording and parts of the Traditional Chinese draft, with co-author credit. Once #1779 passes CI and merges, I'll close this as superseded.

Further language review would be very welcome; the PO workflow is documented in website/locales/README.md in #1779. Thanks again for helping make the site easier to use.

N0zoM1z0 added a commit that referenced this pull request Oct 11, 2026
Adapt CJK font stacks, original copy-button label restoration, accessibility wording and Traditional Chinese onboarding improvements from PR #1737. Protect the complete APK filename and correct setup terminology.

Co-authored-by: Kaoru0822 <[email protected]>
@N0zoM1z0

Copy link
Copy Markdown
Collaborator

#1779 is now merged, so I'm closing this as superseded. The incorporated font, copy-button, accessibility and Traditional Chinese improvements carry co-author credit.

Language corrections and further review are welcome through the PO translation workflow. Thanks for contributing to this work!

@N0zoM1z0 N0zoM1z0 closed this Oct 11, 2026
@morluto morluto added the enhancement New feature or request label Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants