Skip to content

Fix/i18n chinese translations - #2993

Open
zcai7675-bot wants to merge 3 commits into
QwenLM:mainfrom
zcai7675-bot:fix/i18n-chinese-translations
Open

Fix/i18n chinese translations#2993
zcai7675-bot wants to merge 3 commits into
QwenLM:mainfrom
zcai7675-bot:fix/i18n-chinese-translations

Conversation

@zcai7675-bot

Copy link
Copy Markdown

Summary

Fix commands that still show English text after switching to Chinese with /language ui.

Problem

After running /language ui zh to switch to Chinese UI, several commands still display English text:

  • /arena - Arena session commands
  • /compress - Context compression command
  • /copy - Copy output command
  • /export - Session export command
  • /hooks - Hook management command
  • /restore - Tool call restore command
  • /summary - Project summary command

Changes

1. Added missing translation keys

  • 'Value:''Value:' (Chinese: '值:')
  • 'No server selected''No server selected' (Chinese: '未选择服务器')

2. Fixed hardcoded strings

  • Replaced hardcoded English strings with t() function calls in command files
  • Ensured all user-visible strings go through internationalization

3. Added Arena command translations

  • Arena usage, options, and examples
  • Error messages (session not found, non-interactive mode not supported, etc.)
  • Confirmation prompts (discard results, cleanup worktrees)

Test Plan

  • Run /language ui zh to switch to Chinese UI
  • Run /arena start and verify Arena commands show Chinese
  • Run /compress and verify compression command shows Chinese
  • Run /copy and verify copy command shows Chinese
  • Run /export md and verify export command shows Chinese
  • Run /hooks list and verify Hooks command shows Chinese
  • Run /restore and verify restore command shows Chinese
  • Run /summary and verify summary command shows Chinese

- Add Chinese translations for arena, compress, copy, export, hooks, restore, summary commands
- Fix missing translation keys: 'Value:', 'No server selected'
- Use t() function for internationalization in command files
- Update en.js and zh.js with corresponding translation keys
- Add missing t() call for 'Configuration not available' in arena start action
Comment thread packages/cli/src/i18n/locales/en.js Outdated
// ============================================================================
// Commands - Hooks
// ============================================================================
'Configured Hooks ({{count}} total)':

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[Critical] This change adds a second Configured Hooks ({{count}} total) entry to en.js, so ESLint fails with no-dupe-keys and one definition will silently override the other at runtime. Please keep only one canonical entry for this key.

Suggested change
'Configured Hooks ({{count}} total)':
'Configured Hooks ({{count}} total)':
'Configured Hooks ({{count}} total)',

— gpt-5.4 via Qwen Code /review

Comment thread packages/cli/src/i18n/locales/zh.js Outdated
// ============================================================================
// Commands - Hooks
// ============================================================================
'Configured Hooks ({{count}} total)':

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[Critical] This change adds a second Configured Hooks ({{count}} total) entry to zh.js, so ESLint fails with no-dupe-keys and one definition will silently override the other at runtime. Please keep only one canonical entry for this key.

Suggested change
'Configured Hooks ({{count}} total)':
'Configured Hooks ({{count}} total)':
'已配置的 Hook(共 {{count}} 个)',

— gpt-5.4 via Qwen Code /review

messageType: 'error',
content:
'Usage: /arena start --models model1,model2 <task>\n' +
t('Arena usage: /arena start --models model1,model2 <task>') + '\n' +

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[Suggestion] buildArenaExecutionInput() now calls t('Options:') and t('Examples:'), but the new locale entries were added as Options / Examples without the trailing colon. Those lookups miss the translation table and fall back to English, so part of /arena help remains untranslated in Chinese mode.

Suggested change
t('Arena usage: /arena start --models model1,model2 <task>') + '\n' +
t('Options') + ':\n' +

— gpt-5.4 via Qwen Code /review

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has had no activity for 60 days and is being marked as stale. It will be closed in another 30 days if no further activity occurs. To keep it open, push a new commit or leave a comment. Maintainers may apply pinned, status/blocked, status/on-hold, or status/ready-for-merge to exempt it from auto-close.

@github-actions github-actions Bot added the status/stale No activity for extended period label Jun 18, 2026
@wenshao

wenshao commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

@copilot resolve the merge conflicts in this pull request

@github-actions github-actions Bot removed the status/stale No activity for extended period label Jun 19, 2026
@yiliang114

Copy link
Copy Markdown
Collaborator

@qwen-code /resolve

Merge origin/main into fix/i18n-chinese-translations. Resolve conflicts
in 8 files by preferring main's refactored command implementations
(arenaCommand, copyCommand, exportCommand, hooksCommand, restoreCommand)
while preserving the PR's i18n intent. Combine both sides for
compressCommand to retain main's truncationNotice prefix with the PR's
t() wrapping. Add missing translation keys for compress-related strings
to both en.js and zh.js locale files.
@qwen-code-dev-bot

Copy link
Copy Markdown
Collaborator

Qwen Code resolved the merge conflicts and pushed the branch update.

Merge Conflict Resolution Summary — PR #2993

PR: fix/i18n chinese translations

Base: main

Conflicts (8 files)

Command files resolved by taking origin/main (5 files)

These files conflicted because the PR wrapped strings with t() while main simultaneously refactored the same code with better patterns. Main's versions already include t() wrapping where appropriate.

  1. arenaCommand.ts — PR used string concatenation with t(); main refactored to array-based .join('\n') with t(). Took main's cleaner formatting. Also accepted main's key changes: "Arena usage:""Usage:", "{{arg}}""{{name}}", and result.error || ''result.error ?? 'Unknown error'.

  2. copyCommand.ts — PR wrapped a generic "Last output copied to the clipboard" with t(); main added more specific conditional messages (e.g., per-block labels, indexed message labels). Took main's richer user feedback.

  3. exportCommand.ts — PR duplicated export logic across html/json/jsonl actions with t() wrapping; main refactored all three into a shared exportSessionAction() function. Took main's DRY refactoring.

  4. hooksCommand.ts — PR wrapped flat hook list output with t(); main restructured to group hooks by event name AND matcher with supportsMatchers() logic. Took main's improved structure.

  5. restoreCommand.ts — PR kept legacy gitService?.restoreProjectFromSnapshot() code with t() wrapping; main removed this legacy commitHash-based path entirely (replaced by promptId-based rewind). Took main's removal.

compressCommand.ts — Combined both sides

The PR wrapped compression messages with t() using i18n template parameters. Main added truncationNotice prefix support. Resolution: kept main's truncationNotice concatenation AND wrapped the message with t('Context compressed ({{originalTokens}} -> {{newTokens}}).', {...}).

Locale files (2 files)

  1. en.js — PR added ~50 new translation keys in sectioned

@DragonnZhang DragonnZhang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Code Review

Reviewed the translation additions in en.js/zh.js and the t() wrapper insertions in compressCommand.ts and summaryCommand.ts.

Translation keys match between the two locale files, the Chinese translations look accurate, and the t() calls use the correct interpolation syntax ({{originalTokens}}, {{newTokens}}, {{max}}). The typo fix in summaryCommand.ts (missing t() wrapper) is correct. No issues found.


Generated by Claude Code

@DragonnZhang DragonnZhang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Code Review

Reviewed the i18n changes in compressCommand.ts, summaryCommand.ts, en.js, and zh.js.

The compressCommand.ts changes look correct — all three new translation keys (Compressing context..., Compression instructions were truncated to {{max}} characters., Context compressed ({{originalTokens}} -> {{newTokens}}).) are present in both en.js and zh.js, and the interpolation parameters match.

One issue found in summaryCommand.ts (see inline comment).

const markdownSummary = await generateSummaryMarkdown(history);
if (abortSignal?.aborted) {
throw new DOMException('Summary generation cancelled.', 'AbortError');
throw new DOMException(t('Summary generation cancelled.'), 'AbortError');

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[Bug] t('Summary generation cancelled.') is called here, but the key 'Summary generation cancelled.' was not added to either en.js or zh.js.

The t() function falls back to returning the raw key string when no translation entry exists. Under Chinese locale the user will see the English text 'Summary generation cancelled.' embedded inside the Chinese error template (e.g. 无法生成项目上下文摘要:Summary generation cancelled.), which defeats the purpose of this PR.

Fix: Add the missing key to both locale files:

  • en.js: 'Summary generation cancelled.': 'Summary generation cancelled.',
  • zh.js: 'Summary generation cancelled.': '摘要生成已取消。',

@wenshao

wenshao commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

@qwen-code /triage

github-merge-queue Bot pushed a commit that referenced this pull request Jul 21, 2026
…7389)

* fix(ci): stop /resolve reports from being guillotined mid-sentence

Every substantive /resolve summary was hitting the 2000-byte cap exactly
and stopping mid-word: #2993, #4256 and #6206 all ended at 2100 bytes
total, cut inside a sentence, with nothing saying the report had been
clipped rather than abandoned.

Two causes, both fixed:

- The contract asked for a file-by-file inventory, which duplicates the
  diff and grows without bound. It now asks for what only the resolver
  knows — the root cause on the base branch, whether the merge was
  semantic or merely textual, what the resolution's correctness rests
  on, and what it could not verify (this command runs no tests and may
  not touch non-conflicted files, so a merge that breaks an untouched
  test can only be reported).
- The cap was silent and too low. It is now 6000, above the 4000 the
  prompt asks for, and a report that still exceeds it says so.

Also adds the project's collapsed Chinese section to the contract; no
/resolve report had one.

* fix(ci): make the truncation test fatal-decode real and link the run in the notice (#7389)

---------

Co-authored-by: wenshao <wenshao@example.com>
Co-authored-by: qwen-code-dev-bot <qwen-code-dev@service.alibaba.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants