Skip to content

Add parity test and translator guidance for language files - #15265

Merged
cderv merged 5 commits into
mainfrom
fix/issue-14822
Nov 3, 2026
Merged

cderv merged 5 commits into
mainfrom
fix/issue-14822

Conversation

@cderv

@cderv cderv commented Nov 3, 2026

Copy link
Copy Markdown
Member

Keys added to _language.yml don't reach the per-language files, and nothing checks it, so localized pages fall back to English for those strings (#14822). This is the groundwork for filling the gaps, as planned in #14822 (comment). It adds no new translations.

Parity test

tests/unit/language-parity.test.ts reads _language.yml and every _language-*.yml and fails when:

  • a file carries a key that is not in _language.yml (how lt and sv broke),
  • a base language file misses a key that is not listed in tests/unit/language-known-gaps.yml,
  • an entry in the known-gaps list is no longer missing, or names a key or language that doesn't exist, so the list cannot go stale,
  • a value doesn't keep exactly the {0} placeholders of its English value.

Region files (de-CH, fr-CA, pt-BR, zh-TW) are read on top of their base language, so they are exempt from the missing-key check only. The known-gaps list starts with everything missing today (165 pairs) and shrinks as keys get translated.

Stale keys

Both strings fell back to English. lt still used search, renamed to search-label in 498f71a. sv used callout-danger-title, which never existed in _language.yml: callout-danger-caption became callout-caution-caption in 25e3eb2, then callout-caution-title in 748c66d, a month before the Swedish file was added (#5000). Both keys are renamed, keeping the existing values.

Guidance for translators

Most wrong translations come from not knowing what a short string is: "Dismiss announcement" read as reject, "Slide menu" as a single slide, "Download" as a noun where the file uses verbs. So:

  • _language.yml gets a translator comment above each key that is missing somewhere, saying what the string is, where it shows and which sense to use, in the same style as the existing comments.
  • src/resources/language/README.md gets the full list of language files (the table listed 20 of the 35 and a non-existent _language-kr.yml) and contributing guidance: read the comments, reuse the file's vocabulary, keep placeholders, region files are overlays, say when AI helped, and how the known-gaps list works.
  • src/resources/language/AGENTS.md points AI tools at the same guidance.

The open #14203 adds _language-ar.yml. Once this is merged, that file needs every key or its missing keys added to the known-gaps list.

Part of #14822

Checklist

I have (if applicable):

  • referenced the GitHub issue this PR closes
  • updated the appropriate changelog in the PR
  • ensured the present test suite passes
  • added new tests
  • created a separate documentation PR in Quarto's website repo and linked it to this PR
AI-assisted PR
  • AI tool used: Claude Code, Codex
  • Codebase grounding: local clone
  • Human review: I have reviewed, tested, and verified the AI-generated content before submitting.

Note: autonomous AI agents submitting PRs without human oversight are not permitted — see the Code of Conduct.

cderv added 4 commits November 3, 2026 13:11
Language files drifted from _language.yml (#14822) because nothing checks
them. The test fails on stale keys, missing keys not listed in
language-known-gaps.yml, stale gap entries, and placeholders that differ
from the English value. Region overlays may omit keys.
lt used `search` and sv used `callout-danger-title`, keys renamed in
_language.yml long ago (498f71a, 748c66d), so both strings fell back to
English. Same concept, existing values kept.
Contributors, and the AI tools many of them use, translate the new
accessibility and UI keys without knowing which sense is meant, so values
come out wrong (for example "Dismiss" as reject) or fall back to English.

- _language.yml: translator comments above the 14 keys that are missing
  somewhere, saying what the string is, where it shows and which sense to use.
- README.md: table of all language files with the correct names (kr -> ko),
  plus contributing guidance (read the notes, reuse existing vocabulary,
  region files are overlays, disclose AI help, known-gaps list).
- AGENTS.md and a rule pointer so coding agents read the same guidance.
- Changelog entry for the lt/sv key renames.
If an English key is renamed, its old name would stay in
language-known-gaps.yml and the test kept passing, so the list could go
stale. Also correct the code-links-title translator comment: the Code Links
list holds the repository, Binder and Dev Container links, not source
notebooks.
@posit-snyk-bot

posit-snyk-bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

The runtime boundary check failed on the three direct Deno calls the test
added. The contract cases only wrote temp files to feed the checker, so the
checker now takes the parsed files, and the cases pass objects directly.
Reading the shipped files goes through walkSync from deno_ral, and a test
checks that base, region and script files are all loaded.
@cderv
cderv merged commit 3909516 into main Nov 3, 2026
52 checks passed
@cderv
cderv deleted the fix/issue-14822 branch November 3, 2026 14:32
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