From 6388acf36a9473efa34436798630706f03b404a2 Mon Sep 17 00:00:00 2001 From: GCWing Date: Fri, 13 Mar 2026 17:07:00 +0800 Subject: [PATCH] feat(i18n): internationalize flowchat welcome panel text Replace hardcoded Chinese text in WelcomePanel with i18n keys: - Add translation keys for workspace/project status messages - Add Git status translations (unstaged, staged, unpushed) - Support both Code and Cowork session modes Generated with BitFun Co-Authored-By: BitFun --- .../src/flow_chat/components/WelcomePanel.tsx | 28 +++++++++---------- src/web-ui/src/locales/en-US/flow-chat.json | 19 ++++++++++++- src/web-ui/src/locales/zh-CN/flow-chat.json | 20 ++++++++++++- 3 files changed, 51 insertions(+), 16 deletions(-) diff --git a/src/web-ui/src/flow_chat/components/WelcomePanel.tsx b/src/web-ui/src/flow_chat/components/WelcomePanel.tsx index b76ef3cf..258f32e1 100644 --- a/src/web-ui/src/flow_chat/components/WelcomePanel.tsx +++ b/src/web-ui/src/flow_chat/components/WelcomePanel.tsx @@ -74,28 +74,28 @@ export const WelcomePanel: React.FC = ({ if (!gitState) return null; const parts: { key: string; label: string; suffix: string }[] = []; if (gitState.unstagedFiles > 0) - parts.push({ key: 'unstaged', label: `${gitState.unstagedFiles} 个文件`, suffix: '等待暂存' }); + parts.push({ key: 'unstaged', label: t('welcome.gitUnstaged', { count: gitState.unstagedFiles }), suffix: t('welcome.waitingToStage') }); if (gitState.stagedFiles > 0) - parts.push({ key: 'staged', label: `${gitState.stagedFiles} 个文件`, suffix: '已暂存待提交' }); + parts.push({ key: 'staged', label: t('welcome.gitStaged', { count: gitState.stagedFiles }), suffix: t('welcome.stagedReady') }); if (gitState.unpushedCommits > 0) - parts.push({ key: 'unpushed', label: `${gitState.unpushedCommits} 个提交`, suffix: '待推送' }); + parts.push({ key: 'unpushed', label: t('welcome.gitUnpushed', { count: gitState.unpushedCommits }), suffix: t('welcome.toPush') }); if (parts.length === 0) return null; return ( <> - 目前有{' '} + {t('welcome.currentlyHas')} {parts.map(({ key, label, suffix }, i) => ( - {i > 0 && ','} + {i > 0 && t('welcome.commaSeparator')} {' '}{suffix} ))} - 。 + {t('welcome.period')} ); - }, [gitState, handleGitClick]); + }, [gitState, handleGitClick, t]); const loadGitState = useCallback(async (workspacePath: string) => { try { @@ -179,20 +179,20 @@ export const WelcomePanel: React.FC = ({

{!hasWorkspace ? ( <> - 还没有选择项目, + {t('welcome.noWorkspaceHint')} - {' '}开始吧。 + {' '}{t('welcome.toStart')} ) : ( <> - 我们正在 + {isCoworkSession ? t('welcome.workingInCowork') : t('welcome.workingIn')}{' '}