From cc3368c591252456c564f55b07ffbafd2ebaa13b Mon Sep 17 00:00:00 2001 From: YuanNiancai Date: Thu, 22 Jan 2026 15:12:01 +0800 Subject: [PATCH] add translations for Shell.jsx --- src/components/Shell.jsx | 38 +++++++++++++++++--------------- src/i18n/locales/en/chat.json | 25 +++++++++++++++++++++ src/i18n/locales/zh-CN/chat.json | 25 +++++++++++++++++++++ 3 files changed, 70 insertions(+), 18 deletions(-) diff --git a/src/components/Shell.jsx b/src/components/Shell.jsx index 9a74436..5cee346 100644 --- a/src/components/Shell.jsx +++ b/src/components/Shell.jsx @@ -4,6 +4,7 @@ import { FitAddon } from '@xterm/addon-fit'; import { WebglAddon } from '@xterm/addon-webgl'; import { WebLinksAddon } from '@xterm/addon-web-links'; import '@xterm/xterm/css/xterm.css'; +import { useTranslation } from 'react-i18next'; const xtermStyles = ` .xterm .xterm-screen { @@ -25,6 +26,7 @@ if (typeof document !== 'undefined') { } function Shell({ selectedProject, selectedSession, initialCommand, isPlainShell = false, onProcessComplete, minimal = false, autoConnect = false }) { + const { t } = useTranslation('chat'); const terminalRef = useRef(null); const terminal = useRef(null); const fitAddon = useRef(null); @@ -373,8 +375,8 @@ function Shell({ selectedProject, selectedSession, initialCommand, isPlainShell -

Select a Project

-

Choose a project to open an interactive shell in that directory

+

{t('shell.selectProject.title')}

+

{t('shell.selectProject.description')}

); @@ -400,13 +402,13 @@ function Shell({ selectedProject, selectedSession, initialCommand, isPlainShell )} {!selectedSession && ( - (New Session) + {t('shell.status.newSession')} )} {!isInitialized && ( - (Initializing...) + {t('shell.status.initializing')} )} {isRestarting && ( - (Restarting...) + {t('shell.status.restarting')} )}
@@ -414,12 +416,12 @@ function Shell({ selectedProject, selectedSession, initialCommand, isPlainShell )} @@ -427,12 +429,12 @@ function Shell({ selectedProject, selectedSession, initialCommand, isPlainShell onClick={restartShell} disabled={isRestarting || isConnected} className="text-xs text-gray-400 hover:text-white disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-1" - title="Restart Shell (disconnect first)" + title={t('shell.actions.restartTitle')} > - Restart + {t('shell.actions.restart')}
@@ -443,7 +445,7 @@ function Shell({ selectedProject, selectedSession, initialCommand, isPlainShell {!isInitialized && (
-
Loading terminal...
+
{t('shell.loading')}
)} @@ -453,19 +455,19 @@ function Shell({ selectedProject, selectedSession, initialCommand, isPlainShell

{isPlainShell ? - `Run ${initialCommand || 'command'} in ${selectedProject.displayName}` : + t('shell.runCommand', { command: initialCommand || 'command', projectName: selectedProject.displayName }) : selectedSession ? - `Resume session: ${sessionDisplayNameLong}...` : - 'Start a new Claude session' + t('shell.resumeSession', { displayName: sessionDisplayNameLong }) : + t('shell.startSession') }

@@ -477,12 +479,12 @@ function Shell({ selectedProject, selectedSession, initialCommand, isPlainShell
- Connecting to shell... + {t('shell.connecting')}

{isPlainShell ? - `Running ${initialCommand || 'command'} in ${selectedProject.displayName}` : - `Starting Claude CLI in ${selectedProject.displayName}` + t('shell.runCommand', { command: initialCommand || 'command', projectName: selectedProject.displayName }) : + t('shell.startCli', { projectName: selectedProject.displayName }) }

diff --git a/src/i18n/locales/en/chat.json b/src/i18n/locales/en/chat.json index 54e2835..6cada03 100644 --- a/src/i18n/locales/en/chat.json +++ b/src/i18n/locales/en/chat.json @@ -175,5 +175,30 @@ "showingLast": "Showing last {{count}} messages ({{total}} total)", "loadEarlier": "Load earlier messages" } + }, + "shell": { + "selectProject": { + "title": "Select a Project", + "description": "Choose a project to open an interactive shell in that directory" + }, + "status": { + "newSession": "New Session", + "initializing": "Initializing...", + "restarting": "Restarting..." + }, + "actions": { + "disconnect": "Disconnect", + "disconnectTitle": "Disconnect from shell", + "restart": "Restart", + "restartTitle": "Restart Shell (disconnect first)", + "connect": "Continue in Shell", + "connectTitle": "Connect to shell" + }, + "loading": "Loading terminal...", + "connecting": "Connecting to shell...", + "startSession": "Start a new Claude session", + "resumeSession": "Resume session: {{displayName}}...", + "runCommand": "Run {{command}} in {{projectName}}", + "startCli": "Starting Claude CLI in {{projectName}}" } } diff --git a/src/i18n/locales/zh-CN/chat.json b/src/i18n/locales/zh-CN/chat.json index 5aeda37..a6d9cd0 100644 --- a/src/i18n/locales/zh-CN/chat.json +++ b/src/i18n/locales/zh-CN/chat.json @@ -175,5 +175,30 @@ "showingLast": "显示最近 {{count}} 条消息(共 {{total}} 条)", "loadEarlier": "加载更早的消息" } + }, + "shell": { + "selectProject": { + "title": "选择项目", + "description": "选择一个项目以在该目录中打开交互式 Shell" + }, + "status": { + "newSession": "新会话", + "initializing": "初始化中...", + "restarting": "重启中..." + }, + "actions": { + "disconnect": "断开连接", + "disconnectTitle": "断开 Shell 连接", + "restart": "重启", + "restartTitle": "重启 Shell(请先断开连接)", + "connect": "在 Shell 中继续", + "connectTitle": "连接到 Shell" + }, + "loading": "正在加载终端...", + "connecting": "正在连接到 Shell...", + "startSession": "启动新的 Claude 会话", + "resumeSession": "恢复会话:{{displayName}}...", + "runCommand": "在 {{projectName}} 中运行 {{command}}", + "startCli": "在 {{projectName}} 中启动 Claude CLI" } }