chinese2english/package.json
spearzificial 23327d2bd5 feat: translate code comments, reaching zero Chinese in the served UI
The last Chinese lived in source comments: notes the plugin authors wrote
about why a module exists and which bug it fixed, plus two stylesheet
comment blocks. Comments never render, but they still shipped Chinese, and
the user asked for all of it gone.

- src/dictionary.comments.json: 274 whole comments (block and line form).
- src/rewrite.ts: rewriteComments replaces a comment only on an exact
  whole-comment match, so box-drawing runs and the `*` alignment that give
  these notes their structure cannot be reflowed by a partial replacement.
  Comment rewriting runs on the source between literals; running it over
  the assembled output would also scan literal contents, where a URL like
  `https://…` reads as a line comment.
- scripts/merge-comments.mjs emits the dictionary and enforces the
  invariants: no CJK, delimiters preserved and balanced, line count
  unchanged, box runs preserved in block comments. In a single-line `//`
  banner the run is decoration and may shift with the text.

Verified on the bytes a fresh instance actually served, escapes decoded:
total Chinese 55,345 -> 111 (99.80% removed). In the browser, both visible
text and the full page HTML report 0 CJK.

The 111 characters left are inside functional regular expressions that
match Chinese *input*: /失败|错误|无法/ classifies a status message,
dshmarket's PREVIEW_WORDS match Chinese plugin descriptions, and
/^[一-龥]{2}$/ validates a two-character name. Translating those would
break plugin behaviour, so they are deliberately left alone.
2026-10-18 22:25:19 +05:30

57 lines
1.4 KiB
JSON

{
"name": "chinese2english",
"version": "0.1.0",
"description": "Universal English translation patch for DeepSeek Harness third-party plugins",
"type": "module",
"main": "./lib/index.js",
"exports": {
".": "./lib/index.js",
"./client": "./lib/client.js",
"./package.json": "./package.json"
},
"files": [
"lib",
"cordis.patch.yml",
"README.md",
"LICENSE"
],
"keywords": [
"deepseek-harness",
"dsh",
"dsh-plugin",
"cordis",
"translation",
"english",
"i18n",
"localization"
],
"dsh": {
"bundle": {
"patch": "./cordis.patch.yml"
},
"client": {
"inject": [
"locale"
],
"platform": "web"
}
},
"scripts": {
"mt": "node scripts/mt-fill.mjs",
"dict": "node scripts/merge-dict.mjs && node scripts/merge-comments.mjs",
"build": "node scripts/build.mjs",
"build:dict": "node scripts/mt-fill.mjs && node scripts/merge-dict.mjs && node scripts/merge-comments.mjs && node scripts/build.mjs"
},
"peerDependencies": {
"@deepseek-ai/cordis": ">=4.0.0"
},
"license": "MIT",
"repository": {
"type": "git",
"url": "https://git.oiupoyt.space/oiupoyt/chinese2english.git"
},
"bugs": {
"url": "https://git.oiupoyt.space/oiupoyt/chinese2english/issues"
},
"homepage": "https://git.oiupoyt.space/oiupoyt/chinese2english#readme"
}