Skip to content

Generate supported-languages table from /v3/languages#395

Open
lilkraftwerk wants to merge 10 commits into
docs/split-product-family-tabsfrom
docs/language-table-from-v3
Open

Generate supported-languages table from /v3/languages#395
lilkraftwerk wants to merge 10 commits into
docs/split-product-family-tabsfrom
docs/language-table-from-v3

Conversation

@lilkraftwerk

@lilkraftwerk lilkraftwerk commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Note

Based on #396 and merges after it; the base branch will flip back to main automatically when that PR lands.

What

Language-support info across the docs was hand-maintained and drifting from what the API reports. This PR makes it generated from GET /v3/languages.

One script per target, plus a parent that updates everything:

node scripts/update-language-docs.mjs <api-key>
Script Target
generate-language-table.mjs languages table on Languages supported
generate-voice-languages.mjs Voice API support matrix (docs/voice) + the input/target lists on the service-specification page
generate-write-lists.mjs target_lang / writing_style / tone lists on improve-text
generate-style-rules-lists.mjs style-rules callout on the supported-languages page

Generated content sits between BEGIN/END GENERATED markers; everything outside stays hand-written. Each script also runs standalone. The API key is passed as an argument, never stored. Set DEEPL_SERVER_URL to run against a mock. The OpenAPI spec is untouched.

A daily workflow (sync-language-docs.yml) reruns the generators against the live API and opens/updates a bot PR when anything drifts, so future language launches show up as a reviewable diff without anyone remembering to run the script.

Earlier revisions also generated the formality lists on the translate/document pages and a style-rules mention on translate; those pages became OpenAPI stubs in #396, so that generator was dropped.

Notable data changes (all now match the live API)

  • style rules and translation memory: the table and the supported-languages callout pick up the expanded language support that went live with the June 30 launch (now served by prod /v3/languages)
  • supported-languages table: tag handling shown for all translation languages, new DE-DE/FR-FR variants, DE-CH/FR-CA corrected, EN/ZH/PT-PT gain text improvement
  • improve-text: adds base en/pt and zh-Hant per the API; writing_style/tone lists gain base pt
  • voice: matrix content matches the API (Norwegian (bokmål) naming, alphabetical order); the service-specification lists gain the beta languages hi, ms, ta and base en/zh as text targets

Regenerating after future API changes is one command and a reviewable diff.

@mintlify

mintlify Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
deepl-c950b784 🟢 Ready View Preview Jul 9, 2026, 7:32 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

Lucas Mathis added 10 commits July 10, 2026 12:26
Replace the hand-maintained languageData array in the language table
snippet with output generated from GET /v3/languages, and add the
generator script. The array now sits between BEGIN/END GENERATED
markers; run node scripts/generate-language-table.mjs to refresh it.
Split the generator into one script per target with a parent that runs
all of them (scripts/update-language-docs.mjs). New generated blocks:
the Voice API language matrix and its service-specification lists, the
formality sentences on translate and document, the target_lang,
writing_style and tone lists on improve-text, and the style-rules
language mentions. Generated blocks sit between BEGIN/END GENERATED
markers; everything outside them stays hand-written.
Formality and write language lists are now grouped by base language and
sorted alphabetically. Shared joinList handles one- and two-item lists,
the marker regex escapes ids and anchors on the trailing space, the
parent script reports partial-update state on failure, and the voice
generator warns if a target-only language would be missing from the
matrix. Restores the pt-PT scope caveat on the service specification
page and the final conjunction in the style-rules callout.
Tests run with Node's built-in runner (node --test scripts/*.test.mjs),
covering joinList edge cases, groupByBase grouping and ordering, the
marker-replacement core (extracted as pure replaceGeneratedBlock),
voice matrix symbols, and the grouped bullet renderer. A GitHub
workflow runs them on PRs touching scripts/.
Scheduled (plus manual dispatch) workflow that reruns the generators
against /v3/languages and opens a PR when anything changed. The git and
PR logic lives in scripts/open-sync-pr.sh, which refuses to run outside
CI. Requires a DEEPL_API_KEY repo secret; use a dedicated cost-capped
key. Repeated drift updates the same bot branch and PR.
The translate and document overview pages are now OpenAPI stubs, so the
formality lists and the translate-page style-rules mention have no docs
home anymore; drop that generator and target. The voice matrix moved to
docs/voice/supported-languages-formats-and-limits.mdx.
…n now live

Prod /v3/languages now reports the expanded style-rules and
translation-memory language support, so the generated table and callout
pick it up.
@lilkraftwerk lilkraftwerk changed the base branch from main to docs/split-product-family-tabs July 10, 2026 10:30
@lilkraftwerk lilkraftwerk force-pushed the docs/language-table-from-v3 branch from cf43af6 to f63866c Compare July 10, 2026 10:30
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