chore: remove leftover Chinese from the Go core, CI examples and pages comments - #861
Merged
Merged
Conversation
Rewrite the remaining Chinese code comments outside the VSCode extension
in English, so the Go core and the pages site read consistently.
- allowed_ext.go: translate the default_exclude_patterns.json package doc.
Quote the wildcards ("*", "**", "{a,b,c}") so gofmt stops reflowing the
leading "*" as a markdown bullet, which had swallowed the first entry's
wildcard and broken the list alignment in godoc.
- HighlightsSection.tsx: translate three comments in parseStatValue and
CountUpValue.
Contributor
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 2 selected item(s). |
The language config value is fed to the LLM, which understands "Chinese" just as well, and "Chinese" is what the rest of the project already uses (skills/open-code-review/SKILL.md, config_cmd_test.go, ApplyLanguage). Keeps the GitLab CI example's inline docs fully English.
task_template.json ships a single English template ("### Review Plan
(Optional)") and is embedded via go:embed with no override path, so the
"审查计划" alternative could never match anything. It came from the
pre-open-source template and survived the #33 fix as dead defensive code.
Drops the two test cases that only exercised that alternative.
stay-foolish-forever
approved these changes
Aug 12, 2026
wu21-web
added a commit
to wu21-web/open-code-review
that referenced
this pull request
Aug 12, 2026
commit 140871d Author: Syt3s <lkxyout@gmail.com> Date: Wed Aug 12 18:03:34 2026 +0800 feat(cmd): add SARIF output format (alibaba#820) commit 552dc95 Author: Syt3s <lkxyout@gmail.com> Date: Wed Aug 12 16:44:35 2026 +0800 feat(cmd): add no-review cmd (alibaba#835) * feat(cmd): add no-review cmd * docs(flags): improve --no-filter help text for clarity --------- Co-authored-by: kite <lizhengfeng.lzf@alibaba-inc.com> commit 980f21d Author: kite <254839944+lizhengfeng101@users.noreply.github.com> Date: Wed Aug 12 15:58:23 2026 +0800 chore: remove leftover Chinese from the Go core, CI examples and pages comments (alibaba#861) * docs(comments): translate Chinese comments to English Rewrite the remaining Chinese code comments outside the VSCode extension in English, so the Go core and the pages site read consistently. - allowed_ext.go: translate the default_exclude_patterns.json package doc. Quote the wildcards ("*", "**", "{a,b,c}") so gofmt stops reflowing the leading "*" as a markdown bullet, which had swallowed the first entry's wildcard and broken the list alignment in godoc. - HighlightsSection.tsx: translate three comments in parseStatValue and CountUpValue. * docs(examples): use "Chinese" instead of "中文" in OCR_LANGUAGE examples The language config value is fed to the LLM, which understands "Chinese" just as well, and "Chinese" is what the rest of the project already uses (skills/open-code-review/SKILL.md, config_cmd_test.go, ApplyLanguage). Keeps the GitLab CI example's inline docs fully English. * fix(agent): drop the unreachable Chinese branch from planBlockPattern task_template.json ships a single English template ("### Review Plan (Optional)") and is embedded via go:embed with no override path, so the "审查计划" alternative could never match anything. It came from the pre-open-source template and survived the alibaba#33 fix as dead defensive code. Drops the two test cases that only exercised that alternative.
lizhengfeng101
added a commit
that referenced
this pull request
Aug 13, 2026
… files (#876) * fix(prompt): replace the fullwidth colon in the file_read tool description tools.json advertised the example output as "File:path/to/example.go" with a fullwidth colon (U+FF1A), while file_read.go actually emits "File: %s". The description is sent to the model on every review, so the example did not match the output it was describing. Also switches action.yml's OCR_LANGUAGE example from 中文 to Chinese, for the same reason as #861: the value is fed to the LLM and Chinese is what the rest of the project uses. * chore(ci): fail CI when CJK characters appear in source files Comments, identifiers and strings in this repository are meant to be English, but nothing enforced it — #861 had to clean up leftovers by hand, and the same drift keeps arriving through generated code and contributions written internally. scripts/verify-cjk.go walks the index plus untracked files and reports Han ideographs, kana, CJK punctuation and fullwidth forms. Written in Go rather than shell so it does not depend on the container's grep having PCRE, and so `unicode.Is` decides what counts as CJK instead of a byte range that would flag the em dashes used throughout the comments. `//go:build ignore` keeps it out of ./..., so it does not affect go vet, go build or the coverage threshold. Untracked files are included (--others --exclude-standard) so a new file is checked before it lands: while writing this, the script's own comment used Chinese punctuation as an example and went unreported until it was staged. Two escape hatches, preferring the narrow one: an `allow-cjk: <reason>` marker comment on a single line, or a prefix in allowedPrefixes for a whole tree. 23 existing lines get markers (UTF-8 encoding fixtures, multibyte truncation fixtures, language-switcher labels, the fullwidth bar used as a terminal cursor). pages/src/i18n/ is allowlisted as translated UI copy; extensions/vscode/ is allowlisted TEMPORARILY — its comments, test names and zh-cn NLS bundle are still Chinese and need a follow-up pass. Wired into CI next to the license and action-pin checks, plus `make cjk-check` and `make check` for local runs. * chore(ci): generalise the CJK check to all non-English text Addresses the review feedback, and widens the rule that the feedback exposed. Review feedback: - exemptMarker requires its colon, so a bare "allow-cjk" can no longer exempt a line without giving a reason. - The script is named for CJK but missed Hangul. - git ls-files gains -z, so paths that are not plain ASCII arrive unquoted, and its stderr is reported rather than a bare exit status. - main discarded run()'s error entirely and only called os.Exit(1), which is what made the lost stderr invisible in the first place. - The CI step and AGENTS.md say "unapproved", since escape hatches exist. The check was skewed by writing system rather than by language. In one array the 'zh' and 'ja' labels each needed a marker while the adjacent 'ru' label passed untouched, and nine lines of Russian sat in the tree unflagged: two language-switcher labels and the heading-ID fixtures. Contributors writing Chinese had to justify every line; contributors writing Russian had nothing to justify. The rule is now "a letter outside ASCII", since written English needs no letter beyond the ASCII 26 -- Cyrillic and Han as much as the diacritics that spell German or Vietnamese. Scripts are not enumerated, so one nobody has contributed in yet is covered when it arrives. Common and Inherited pass, so letterlike symbols (U+2139, U+2113) are not mistaken for prose, and combining accents are caught, so the decomposed spelling of an accented letter cannot slip through. Symbols and emoji stay out of scope by construction: they are not letters. Renamed to scripts/verify-english-only.go and make english-check, and the marker to allow-non-english:. Text spelled entirely in ASCII still takes a dictionary to identify and stays a matter for review. * docs(agents): restate the English-only rule as rule, homes, hatches The rule was one dense bullet that led with the detection mechanism and mentioned the exemptions only in passing, which is the wrong order for the reader: an agent needs to know where a translation may go before it needs to know which Unicode scripts are flagged. Split into three. The homes are now spelled out from what the tree actually holds, rather than left as "<locale> docs or an i18n table": README and CONTRIBUTING in zh-CN, ja-JP, ko-KR and ru-RU; the doc pages under pages/src/content/docs/ in en, zh, ja and ru; the UI copy tables in pages/src/i18n/. Also why the two are exempt for different reasons -- Markdown by extension, the i18n tables by prefix because they are .ts -- since that decides where a new translation can safely go. Drops the enumerated list of what "make check" runs. It duplicated the Makefile, went stale the moment a check was added (this PR had to edit it), and told an agent nothing it would not read in the output anyway. What is worth saying is that the target writes to the tree. * fix(ci): detect U+FE10–FE6F CJK punctuation in english-only check The vertical forms (U+FE10–FE19), CJK compatibility forms (U+FE30–FE4F) and small form variants (U+FE50–FE6F) were not caught, even though their fullwidth counterparts (U+FF00–FFEF) already were. A small question mark (U+FE56 ﹖) or vertical comma (U+FE10 ︐) left in source reads as correct English punctuation and is invisible in review — the same class of typo the fullwidth range already defends against. Skip U+FE20–FE2F (Combining Half Marks) which are used in Latin text.
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.
What
Clears out the remaining Chinese text outside the VSCode extension, in three unrelated-but-adjacent spots.
1. Translate comments to English
internal/config/allowlist/allowed_ext.go— the package doc describing thedefault_exclude_patterns.jsonformat.pages/src/components/HighlightsSection.tsx— three comments inparseStatValue/CountUpValue, matching the English comments already in that file.While translating, the wildcard list in the package doc turned out to be subtly broken:
gofmttreats a leading*inside an indented doc block as a markdown bullet and reflows it to-, which had swallowed the first entry's wildcard and left the list misaligned ingodoc. Quoting the wildcards ("*","**","{a,b,c}") stops the reflow and restores the intended layout.2. Use
Chineseinstead of中文in the GitLab CI exampleOCR_LANGUAGEis fed to the LLM, which understandsChinesejust as well, andChineseis what the rest of the project already uses (skills/open-code-review/SKILL.md,config_cmd_test.go,ApplyLanguage("Chinese")). Applied to both.gitlab-ci.ymland the parallel row in that example'sREADME.mdso the two don't contradict each other.3. Drop the unreachable Chinese branch from
planBlockPatterninternal/agent/util.gomatched(?:Review Plan|审查计划)when stripping the empty plan wrapper.task_template.jsonships a single English template (### Review Plan (Optional)) and is embedded viago:embedwith no override path, so the审查计划alternative could never match anything — it came from the pre-open-source template and survived the #33 fix as dead defensive code. The two test cases that only exercised that alternative are dropped;multiple wrappers all removedkeeps its second header as### Review Plan(without the(Optional)suffix) so it still proves the replacement is global.Verification
gofmt -l— cleango vet ./internal/agent/ ./internal/config/allowlist/— passgo test ./internal/agent/ ./internal/config/allowlist/ ./internal/config/template/ ./internal/scan/— oknpx tsc --noEmitinpages/— no errorsgo doc ./internal/config/allowlist— renders the wildcard list correctlyOut of scope
extensions/vscode/still has ~106 Chinese comment lines and ~91 Chinese test names; left for a separate change.internal/agent/util.gono longer contains Chinese, butexamples/gerrit_ci/post_review_test.pykeeps its Chinese test data on purpose — it exists to verify UTF-8 path and comment encoding.ocr config set language 中文snippets inpages/src/content/docs/*/configuration.mdare user-facing command examples kept in sync across four locales; untouched.