Skip to content

feat(studio): open Help links in the browser's language - #67

Merged
matinfo merged 1 commit into
mainfrom
feat/studio-docs-language
Nov 29, 2026
Merged

matinfo merged 1 commit into
mainfrom
feat/studio-docs-language

Conversation

@matinfo

@matinfo matinfo commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #66 (docs in French, German and Spanish). Studio in a browser (npx markdown-pdf-export studio, and Zed and Cursor, which open it there) now points its Help links to the documentation in the browser's preferred language when the site has it, English otherwise. Studio's own text stays English.

  • studio/model.mjs: DOCS_LANGUAGES, docsLanguageOf(tag) (fr, de-CH, es-419… → its folder) and localDocsUrl(url, language), which keeps #sections, links already in a language, shared files (/schema/, /img/, /samples/, /logo.png) and other sites unchanged. Same rule as the VS Code extension (Open the documentation in VS Code's display language vscode-markdown-pdf-export#39).
  • studio/app.mjs: rewrites the page's links at start and sends the one link it builds later (hand-written header/footer notice) through the same step. When an editor embeds Studio (window.studioHost), Studio leaves its links alone: the editor picks the language (VS Code already does).
  • No new file, so the server's static file list, files and the smoke test are unchanged.

Tests

  • studio-model.test.mjs: language tags and URL edge cases.
  • studio-links.test.mjs: Studio's language list matches the site's (docs/.vitepress/theme/i18n); every Help link exists in each language with its pinned section anchor; the script sends every docs link it writes through docs() and keeps the editor-panel guard (checked to fail when the wrapper is removed).

Test plan

  • npm test (618 pass), npm run lint, build-studio-strings --check
  • Real Studio in headless Chrome: fr-FR, de-CH, es-419 get /fr/, /de/, /es/ links with sections; en-US, pt-BR stay English; no page errors
  • Independent review (correctness, integration with the VS Code bundle, docs site and packaging): no defect; its one hardening suggestion is in

The documentation site is now in French, German and Spanish under
/fr/, /de/ and /es/, with every English page at the same path and the
same section anchors. Studio in a browser (npx markdown-pdf-export
studio, and Zed and Cursor, which open it there) now points its Help
links to that language when the browser's preferred language is one of
them, English otherwise. Studio's own text stays English.

An editor that shows Studio in its own panel picks the language itself
(the VS Code extension does), so Studio leaves its links alone there.

Tests keep Studio's language list in step with the site's, check each
Help link and its section exist in every language, and check the script
sends every link it writes through the language step.
@matinfo
matinfo merged commit f5650d6 into main Nov 29, 2026
13 checks passed
@matinfo
matinfo deleted the feat/studio-docs-language branch November 29, 2026 00:00
@matinfo matinfo mentioned this pull request Nov 29, 2026
2 tasks done
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