[auto] update translations#246
Merged
Merged
Conversation
8 tasks
NiveditJain
added a commit
that referenced
this pull request
Apr 30, 2026
* [docs] sanitize JSX attribute quotes in auto-translated MDX The German translator periodically emits `<Tab title="Tab „Richtlinien"">` where it intends `„…"` typographic quotes but uses ASCII `"` for the closing — the inner straight `"` terminates the JSX attribute and the real attribute close becomes a stray `"` before `>`, which trips `mintlify validate` with `Unexpected character "`. PR #229 fixed this once by hand on `docs/de/dashboard.mdx`. The next auto-translation run regenerated the same broken markup, so the same parse error landed on `main` again after #246. Make it stick: - `scripts/translate-docs/mdx-translator.ts` adds `sanitizeJsxAttributes`, which strips stray trailing ASCII `"` after a JSX attribute close and drops unmatched typographic opening quotes (`„`, `"`, `«`, `‹`, `「`, `『`) inside the same value. Matched pairs (e.g. `「ポリシー」`) are preserved. Wired into `translateMdxPage` ahead of `rewriteInternalLinks`. - `scripts/translate-docs/translator.ts` extends rule #2 of the system prompt to forbid ASCII `"` inside JSX attribute values entirely, so the LLM is less likely to produce the pattern in the first place. - `__tests__/scripts/translate-docs/mdx-translator.test.ts` covers the exact `de/dashboard.mdx` failure plus self-close, multi-attribute, matched typographic pairs, empty-value, and multiple-on-one-line cases. - `docs/de/dashboard.mdx` drops the inner German quotes from the two `<Tab title>` attributes (mirrors #229) so CI on `main` goes green immediately rather than waiting for the next translation cycle. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * [docs] address CodeRabbit review on sanitizeJsxAttributes Two findings on PR #247: 1. mdx-translator.ts:50 — `cleaned.split(open).join("")` removed *every* occurrence of an opener when `opens > closes`, so a value containing one matched typographic pair plus one stray opener (e.g. `„Foo“ und „Bar`) lost the matched pair too. Fix: drop only the surplus = opens - closes openers, scanning from the right with `lastIndexOf` so the leftmost matched pair is preserved. 2. mdx-translator.test.ts — add a regression test for that mixed case (one matched „…“ pair + one dangling „) so the bug above can't recur. Also drop the English curly “…” pair from the openings list. U+201C is both the German closer and the English-curly opener, so processing the English pair after the German pair would strip the very German closer we just preserved. The remaining pairs (German, French ×2, Japanese ×2) all have unambiguous openers. 1177 unit tests pass (was 1176 — the new mixed-case test is the +1). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Automated translation update triggered by changes to English documentation sources.