Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/cli/src/i18n/locales/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -1515,6 +1515,11 @@ export default {
'Failed to compress chat history.': 'Failed to compress chat history.',
'Failed to compress chat history: {{error}}':
'Failed to compress chat history: {{error}}',
'Compressing context...': 'Compressing context...',
'Compression instructions were truncated to {{max}} characters.':
'Compression instructions were truncated to {{max}} characters.',
'Context compressed ({{originalTokens}} -> {{newTokens}}).':
'Context compressed ({{originalTokens}} -> {{newTokens}}).',
'Compressing chat history': 'Compressing chat history',
'Chat history compressed from {{originalTokens}} to {{newTokens}} tokens.':
'Chat history compressed from {{originalTokens}} to {{newTokens}} tokens.',
Expand Down
5 changes: 5 additions & 0 deletions packages/cli/src/i18n/locales/zh.js
Original file line number Diff line number Diff line change
Expand Up @@ -1420,6 +1420,11 @@ export default {
'正在压缩中,请等待上一个请求完成',
'Failed to compress chat history.': '压缩聊天历史失败',
'Failed to compress chat history: {{error}}': '压缩聊天历史失败:{{error}}',
'Compressing context...': '正在压缩上下文...',
'Compression instructions were truncated to {{max}} characters.':
'压缩指令已截断至 {{max}} 个字符。',
'Context compressed ({{originalTokens}} -> {{newTokens}}).':
'上下文已压缩({{originalTokens}} -> {{newTokens}})。',
'Compressing chat history': '正在压缩聊天历史',
'Chat history compressed from {{originalTokens}} to {{newTokens}} tokens.':
'聊天历史已从 {{originalTokens}} 个 token 压缩到 {{newTokens}} 个 token。',
Expand Down
9 changes: 6 additions & 3 deletions packages/cli/src/ui/commands/compressCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const compressCommand: SlashCommand = {
}
yield {
messageType: 'info' as const,
content: 'Compressing context...',
content: t('Compressing context...'),
};
const compressed = await doCompress();
if (!compressed) {
Expand All @@ -108,7 +108,10 @@ export const compressCommand: SlashCommand = {
}
yield {
messageType: 'info' as const,
content: `Context compressed (${compressed.originalTokenCount} -> ${compressed.newTokenCount}).`,
content: t('Context compressed ({{originalTokens}} -> {{newTokens}}).', {
originalTokens: compressed.originalTokenCount.toString(),
newTokens: compressed.newTokenCount.toString(),
}),
};
} catch (e) {
yield {
Expand Down Expand Up @@ -178,7 +181,7 @@ export const compressCommand: SlashCommand = {
return {
type: 'message',
messageType: 'info',
content: `${truncationNotice ? `${truncationNotice} ` : ''}Context compressed (${compressed.originalTokenCount} -> ${compressed.newTokenCount}).`,
content: `${truncationNotice ? `${truncationNotice} ` : ''}${t('Context compressed ({{originalTokens}} -> {{newTokens}}).', { originalTokens: compressed.originalTokenCount.toString(), newTokens: compressed.newTokenCount.toString() })}`,
};
} catch (e) {
// If cancelled via ESC, don't show error — cancelSlashCommand already handled UI
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/ui/commands/summaryCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ export const summaryCommand: SlashCommand = {
emitInteractivePending('generating');
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.': '摘要生成已取消。',

}
emitInteractivePending('saving');
const { filePathForDisplay } = await saveSummaryToDisk(markdownSummary);
Expand Down
Loading