feat(i18n): Add Internationalization Support for UI and LLM Output (#1058)

This commit is contained in:
pomelo
2025-11-21 15:44:37 +08:00
committed by GitHub
parent 640f30655d
commit 48b77541c3
98 changed files with 4740 additions and 636 deletions

View File

@@ -12,6 +12,7 @@ import {
type RadioSelectItem,
} from './shared/RadioButtonSelect.js';
import { useKeypress } from '../hooks/useKeypress.js';
import { t } from '../../i18n/index.js';
interface WelcomeBackDialogProps {
welcomeBackInfo: ProjectSummaryInfo;
@@ -36,12 +37,12 @@ export function WelcomeBackDialog({
const options: Array<RadioSelectItem<'restart' | 'continue'>> = [
{
key: 'restart',
label: 'Start new chat session',
label: t('Start new chat session'),
value: 'restart',
},
{
key: 'continue',
label: 'Continue previous conversation',
label: t('Continue previous conversation'),
value: 'continue',
},
];
@@ -67,7 +68,9 @@ export function WelcomeBackDialog({
>
<Box flexDirection="column" marginBottom={1}>
<Text color={Colors.AccentBlue} bold>
👋 Welcome back! (Last updated: {timeAgo})
{t('👋 Welcome back! (Last updated: {{timeAgo}})', {
timeAgo: timeAgo || '',
})}
</Text>
</Box>
@@ -75,7 +78,7 @@ export function WelcomeBackDialog({
{goalContent && (
<Box flexDirection="column" marginBottom={1}>
<Text color={Colors.Foreground} bold>
🎯 Overall Goal:
{t('🎯 Overall Goal:')}
</Text>
<Box marginTop={1} paddingLeft={2}>
<Text color={Colors.Gray}>{goalContent}</Text>
@@ -87,19 +90,25 @@ export function WelcomeBackDialog({
{totalTasks > 0 && (
<Box flexDirection="column" marginBottom={1}>
<Text color={Colors.Foreground} bold>
📋 Current Plan:
📋 {t('Current Plan:')}
</Text>
<Box marginTop={1} paddingLeft={2}>
<Text color={Colors.Gray}>
Progress: {doneCount}/{totalTasks} tasks completed
{inProgressCount > 0 && `, ${inProgressCount} in progress`}
{t('Progress: {{done}}/{{total}} tasks completed', {
done: String(doneCount),
total: String(totalTasks),
})}
{inProgressCount > 0 &&
t(', {{inProgress}} in progress', {
inProgress: String(inProgressCount),
})}
</Text>
</Box>
{pendingTasks.length > 0 && (
<Box flexDirection="column" marginTop={1} paddingLeft={2}>
<Text color={Colors.Foreground} bold>
Pending Tasks:
{t('Pending Tasks:')}
</Text>
{pendingTasks.map((task: string, index: number) => (
<Text key={index} color={Colors.Gray}>
@@ -113,8 +122,8 @@ export function WelcomeBackDialog({
{/* Action Selection */}
<Box flexDirection="column" marginTop={1}>
<Text bold>What would you like to do?</Text>
<Text>Choose how to proceed with your session:</Text>
<Text bold>{t('What would you like to do?')}</Text>
<Text>{t('Choose how to proceed with your session:')}</Text>
</Box>
<Box marginTop={1}>