Conversation
The table column schema for `zh-Hant` reads its description from `tag.zh-Hant`, but the field regex captured `\w+`, which stops at the hyphen. It matched `tag.zh` and looked up the simplified tag, so every traditional Chinese argument table rendered simplified descriptions while the header and Returns section were correct. Allowing hyphens in the capture is not sufficient on its own: 146 of the 447 documented parameters carry `@zh` with no `@zh-Hant`, and an exact-match lookup blanks all of them. The lookup now falls back to the base language, matching the hook-level tag fallback in generate.ts, so untranslated parameters keep the text they render today. Fixes childrentime#234 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Output of `pnpm --filter @reactuses/core gend` after the tag lookup fix. 85 files, 252 argument descriptions switched from simplified to traditional. No English or simplified Chinese file changes. Co-Authored-By: Claude Opus 5 <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.
Description
Fixes #234. Traditional Chinese argument tables rendered simplified descriptions.
default.tspoints thezh-Hantdescription column attag.zh-Hant, but the field regex ingenerateMarkdown.tscaptured\w+, which stops at the hyphen. It matchedtag.zhand looked up the simplified tag. Only table columns pass through that regex, which is why the table header and the Returns section were already correct.Two options were considered
Regex only, as proposed in the issue:
/tag\.(\w+)/→/tag\.([\w-]+)/. This regresses. 146 of the 447 documented parameters carry@zhwith no@zh-Hant, and an exact-match lookup returns-for every one of them — 148 argument rows lose their description entirely. Wrong-script text replaced by no text is not an improvement.Regex plus a base-language fallback, taken here: prefer the exact tag, fall back to the tag without the subtag.
generate.ts:118already applies this rule to hook-level tags, so this makes parameter tags behave the same way. Parameters with a translation render traditional; parameters without one keep the text they render today.The 146 parameters missing
@zh-Hantare a separate content gap, not addressed here.Commits
Split so the generated diff does not bury the source change:
01a03a4— the 8-line fix inpackages/ts-document/src/generateMarkdown.tsaa57875—pnpm --filter @reactuses/core gendoutput, 85 filesVerification
pnpm lintcleanpackages/coretypecheck cleanpackages/coretests: 74 suites, 431 tests passinguseCounter-README-zhHant.mdagainst the interface sourceThe
packages/ts-documentjest suite could not exercise this change — it does not run onmainfor the reasons in #236. Runninggendis the only available verification of generator output.Building
packages/ts-documentby hand was needed beforegendwould run, per #233 / #235.Type of Change
Checklist
The tests box is unchecked: the package's suite does not run on
main(#236), so there is nowhere to add a regression test yet. Claude Code wrote the fix and this description.🤖 Generated with Claude Code