Skip to content

fix(commands): localize diff feedback - #7101

Merged
Hmbown merged 5 commits into
codewhale-hq:mainfrom
laozidabo:fix/diff-localization
Oct 27, 2026
Merged

Hmbown merged 5 commits into
codewhale-hq:mainfrom
laozidabo:fix/diff-localization

Conversation

@laozidabo

@laozidabo laozidabo commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

What and why

/diff returns English feedback and a pager title even when another UI language is selected. Route its nine user-facing messages through the existing presentation facet and typed diagnostics mapping, with translations in all 15 complete locale packs.

For example, with Simplified Chinese selected, No changes since session start becomes 会话开始以来没有变更. English output, error/action behavior, filenames and raw Git payloads stay unchanged.

Issue

Refs #7071 (partial)

This PR addresses /diff. /undo and the other remaining surfaces are still tracked in #7071.

How I tested it

On Linux, using the installed toolchain and linker:

cargo fmt --all -- --check
git diff --check HEAD^
CARGO_BUILD_JOBS=1 CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/cc scripts/dev-cargo.sh test -p codewhale-commands --lib --locked
CARGO_BUILD_JOBS=1 CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/cc scripts/dev-cargo.sh test -p codewhale-localization --lib --locked
CARGO_BUILD_JOBS=1 CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/cc scripts/dev-cargo.sh clippy -p codewhale-commands --lib --locked --no-deps -- -D warnings -A clippy::uninlined_format_args -A clippy::too_many_arguments -A clippy::unnecessary_map_or
CARGO_BUILD_JOBS=1 CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/cc scripts/dev-cargo.sh clippy -p codewhale-localization --lib --locked --no-deps -- -D warnings -A clippy::uninlined_format_args -A clippy::too_many_arguments -A clippy::unnecessary_map_or

Formatting, whitespace checks, 28 commands tests, 54 localization tests, and the focused Clippy checks passed. The existing command fixture now supplies English presentation, and its capability expectation includes PRESENTATION.

A committed regression case also runs the actual diff handler against the Simplified Chinese catalog and verifies translated interpolation, the stat header, pager title and unchanged raw patch. It fails against the original English-only handler and passes with this fix. The changed command/localization crates additionally pass Clippy with --all-targets --all-features --no-deps.

A separate local reproduction harness (not included in this commit) invokes the actual registered handlers and real catalog/mapping/interpolation. It reproduces the Chinese failure against the original handler, then checks the updated handler across all complete locale packs. Its output is:

BASELINE: 8/8 Chinese expectations fail as reproduced; sample "No changes since session start"
FIXED Chinese sample: 会话开始以来没有变更
PASS: 120 localized outcomes (8 × 15), 8 English parity comparisons, 135 catalog/mapping contracts, 30 opaque-payload cases; action/error/patch preserved

Clippy including dependencies encountered the existing clippy::large_enum_variant warning in unchanged crates/protocol/src/op.rs:209. The focused checks above exclude dependencies and use the project's documented allowances.

The full TUI/workspace build, real host Git collection and interactive terminal/pager rendering were not exercised locally. No UI screenshot or recording was captured; the reproduction verifies returned messages and pager metadata, not visual rendering.

Checklist

  • One focused change, started from current main (no need to rebase when main moves)
  • cargo fmt --all passes, and tests cover new or changed behavior
  • If this adds or changes a user-facing feature, I updated its docs and its row in docs/features.toml (cargo test -p codewhale-tui --test feature_registry checks it)

The docs/feature-registry item is not applicable: this fixes translation of the existing /diff feature.

AI disclosure: AI assistance was used for investigation, implementation, translation, testing and review on behalf of @laozidabo. The account owner has not personally written or technically reviewed it.

Route diff messages and pager titles through the presentation facet and
provide translations in all 15 complete locale packs. Preserve the English
output, action behavior and raw diff payloads.

Refs codewhale-hq#7071 (diff portion).
@laozidabo
laozidabo requested a review from Hmbown as a code owner October 27, 2026 09:08

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@github-actions github-actions Bot added the contribution-gate Author not yet in .github/APPROVED_CONTRIBUTORS; a maintainer grants access with /lgtm label Oct 27, 2026
Exercise Simplified Chinese interpolation, stat header, pager title and
opaque patch preservation through the real diff handler. This regression
check fails against the original English-only handler and passes with the
localization fix. The full commands suite remains 28 passed, 0 failed.
@laozidabo

Copy link
Copy Markdown
Contributor Author

CI triage note for reviewers:

The current red checks do not appear to be caused by this PR's /diff changes:

I have left those unrelated protocol, extension-host and release-note areas untouched to keep this PR scoped to /diff localization. The PR-owned evidence remains: formatting, locale parity, 28 commands tests, 54 localization tests, focused Clippy, and the committed Simplified Chinese regression case that fails against the original handler and passes with this fix.

Once main's shared failures are repaired, a rerun should provide a cleaner signal for this PR.

@Aboysky Aboysky mentioned this pull request Oct 27, 2026
3 tasks done
CodeWhale Bot and others added 3 commits October 27, 2026 15:19
Maintainer merge so the required checks run against current main
(main was red when this branch last ran CI; CW-7525).

Signed-off-by: CodeWhale Bot <bot@codewhale.net>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Picks up 22e3411, which clears the crates/tui/src/lib.rs rustfmt
drift main carried (CW-7525).

Signed-off-by: CodeWhale Bot <bot@codewhale.net>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Picks up codewhale-hq#7108, which restores main's clippy and rustfmt gate (CW-7525).

Signed-off-by: CodeWhale Bot <bot@codewhale.net>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Hmbown
Hmbown merged commit 7033922 into codewhale-hq:main Oct 27, 2026
23 of 24 checks passed
@Aboysky Aboysky mentioned this pull request Oct 28, 2026
3 tasks done
Hmbown pushed a commit that referenced this pull request Oct 28, 2026
…redit @laozidabo

prepare-release.sh 0.10.3 refuses a release section without a Keep a
Changelog subsection (rehearsed on an export of main: "CHANGELOG.md
section 0.10.3 must contain at least one Keep a Changelog subsection").
The Unreleased bullets are regrouped, unchanged, into Added, Changed,
Fixed, Security and Maintenance as in 0.10.2, with Contributors last;
the freeze then only renames the heading.

check-contributor-credit.py also failed on main: @laozidabo (#7101,
localized /diff feedback, merged) was not credited. Added to the
CHANGELOG Contributors block, docs/CONTRIBUTORS.md and
UNRELEASED_CONTRIBUTORS; agent docs regenerated.

Verified on the edited export of main: the sorted bullet set is
unchanged apart from the new credit line; sync-changelog.sh --check,
check-feature-release-notes.sh v0.10.2 HEAD, check-contributor-credit.py
v0.10.2 (was exit 1), check-bundled-plugin-claims.py and web
check:facts pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution-gate Author not yet in .github/APPROVED_CONTRIBUTORS; a maintainer grants access with /lgtm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants