tallneil
## What happens Every generated `*-README-zhHant.md` uses the simplified `@zh` text for argument descriptions, while the table header and the Returns section are correctly traditional. `packages/website-astro/api/useCounter-README-zhHant.md`: ``` #### Returns `readonly [...]`: 包含以下元素的元組: <- traditional, correct - 計數器的當前值。 #### Arguments |參數名|描述|類型|預設值| <- traditional header, correct |---|---|---|---| |initialValue|初始值,可以为数字或者一个初始化的函数|...| <- simplified, wrong |max|最大值。不提供则无上限|...| |min|最小值。不提供则无下限|...| ``` `packages/core/src/useCounter/interface.ts` defines `@zh-Hant` for every parameter, and the parser extracts it correctly — dumping `generate()` output shows both tags present with the right values: ```json { "name": "zh", "value": "初始值,可以为数字或者一个初始化的函数" }, { "name": "zh-Hant", "value": "初始值,可以為數字或者一個初始化的函數" } ``` So the translation exists and is reaching the renderer. It is discarded at the last step. ## Cause `packages/ts-document/src/generateMarkdown.ts:57`: ```ts // Field like tag.version const execResult = /tag\.(\w+)/.exec(field) if (execResult) { field = execResult[1] const obj = schema.tags?.find(tag => tag.name === field) ``` The `zh-Hant` table schema in `default.ts:75` sets the description column to `tag.zh-Hant`, but `\w` does not match `-`. The regex matches `tag.zh` and captures `zh`, dropping `-Hant`, so the lookup finds the simplified tag. This also explains why only the table is affected. The Returns text and the type description are read straight from `tagMap` (`generateMarkdown.ts:96` and `:108`) and never pass through this regex; only table *columns* do. ## Fix Allow hyphens in the captured tag name: ```diff -const execResult = /tag\.(\w+)/.exec(field) +const execResult = /tag\.([\w-]+)/.exec(field) ``` ## Verified Applied the one-character-class change, rebuilt `ts-document`, re-ran `pnpm --filter @reactuses/core gend`: - 90 `*-README-zhHant.md` files change, and their argument descriptions become traditional (`初始值,可以為數字或者一個初始化的函數`, `最大值。不提供則無上限`) - **0** English and **0** zhHans files change - 90 rather than the full hook count because hooks that take no arguments render no table ## Environment - `@reactuses/ts-document` 0.8.0 - reproduced on `main` at 48561e0 - note: `gend` currently needs `packages/ts-document` built by hand first — see #233