diff --git a/packages/cli/src/i18n/locales/en.js b/packages/cli/src/i18n/locales/en.js
index 41026026..a20812fd 100644
--- a/packages/cli/src/i18n/locales/en.js
+++ b/packages/cli/src/i18n/locales/en.js
@@ -762,6 +762,27 @@ export default {
'Press any key to return to authentication type selection.',
'Waiting for Qwen OAuth authentication...':
'Waiting for Qwen OAuth authentication...',
+ 'Note: Your existing API key in settings.json will not be cleared when using Qwen OAuth. You can switch back to OpenAI authentication later if needed.':
+ 'Note: Your existing API key in settings.json will not be cleared when using Qwen OAuth. You can switch back to OpenAI authentication later if needed.',
+ 'Authentication timed out. Please try again.':
+ 'Authentication timed out. Please try again.',
+ 'Waiting for auth... (Press ESC or CTRL+C to cancel)':
+ 'Waiting for auth... (Press ESC or CTRL+C to cancel)',
+ 'Failed to authenticate. Message: {{message}}':
+ 'Failed to authenticate. Message: {{message}}',
+ 'Authenticated successfully with {{authType}} credentials.':
+ 'Authenticated successfully with {{authType}} credentials.',
+ 'Invalid QWEN_DEFAULT_AUTH_TYPE value: "{{value}}". Valid values are: {{validValues}}':
+ 'Invalid QWEN_DEFAULT_AUTH_TYPE value: "{{value}}". Valid values are: {{validValues}}',
+ 'OpenAI Configuration Required': 'OpenAI Configuration Required',
+ 'Please enter your OpenAI configuration. You can get an API key from':
+ 'Please enter your OpenAI configuration. You can get an API key from',
+ 'API Key:': 'API Key:',
+ 'Invalid credentials: {{errorMessage}}':
+ 'Invalid credentials: {{errorMessage}}',
+ 'Failed to validate credentials': 'Failed to validate credentials',
+ 'Press Enter to continue, Tab/↑↓ to navigate, Esc to cancel':
+ 'Press Enter to continue, Tab/↑↓ to navigate, Esc to cancel',
// ============================================================================
// Dialogs - Model
diff --git a/packages/cli/src/i18n/locales/zh.js b/packages/cli/src/i18n/locales/zh.js
index 1421ab7c..329547de 100644
--- a/packages/cli/src/i18n/locales/zh.js
+++ b/packages/cli/src/i18n/locales/zh.js
@@ -718,6 +718,24 @@ export default {
'Press any key to return to authentication type selection.':
'按任意键返回认证类型选择',
'Waiting for Qwen OAuth authentication...': '正在等待 Qwen OAuth 认证...',
+ 'Note: Your existing API key in settings.json will not be cleared when using Qwen OAuth. You can switch back to OpenAI authentication later if needed.':
+ '注意:使用 Qwen OAuth 时,settings.json 中现有的 API 密钥不会被清除。如果需要,您可以稍后切换回 OpenAI 认证。',
+ 'Authentication timed out. Please try again.': '认证超时。请重试。',
+ 'Waiting for auth... (Press ESC or CTRL+C to cancel)':
+ '正在等待认证...(按 ESC 或 CTRL+C 取消)',
+ 'Failed to authenticate. Message: {{message}}': '认证失败。消息:{{message}}',
+ 'Authenticated successfully with {{authType}} credentials.':
+ '使用 {{authType}} 凭据成功认证。',
+ 'Invalid QWEN_DEFAULT_AUTH_TYPE value: "{{value}}". Valid values are: {{validValues}}':
+ '无效的 QWEN_DEFAULT_AUTH_TYPE 值:"{{value}}"。有效值为:{{validValues}}',
+ 'OpenAI Configuration Required': '需要配置 OpenAI',
+ 'Please enter your OpenAI configuration. You can get an API key from':
+ '请输入您的 OpenAI 配置。您可以从以下地址获取 API 密钥:',
+ 'API Key:': 'API 密钥:',
+ 'Invalid credentials: {{errorMessage}}': '凭据无效:{{errorMessage}}',
+ 'Failed to validate credentials': '验证凭据失败',
+ 'Press Enter to continue, Tab/↑↓ to navigate, Esc to cancel':
+ '按 Enter 继续,Tab/↑↓ 导航,Esc 取消',
// ============================================================================
// Dialogs - Model
diff --git a/packages/cli/src/ui/auth/AuthDialog.tsx b/packages/cli/src/ui/auth/AuthDialog.tsx
index f3483635..80c13b0b 100644
--- a/packages/cli/src/ui/auth/AuthDialog.tsx
+++ b/packages/cli/src/ui/auth/AuthDialog.tsx
@@ -146,9 +146,9 @@ export function AuthDialog(): React.JSX.Element {
{hasApiKey && currentSelectedAuthType === AuthType.QWEN_OAUTH && (
- Note: Your existing API key in settings.json will not be cleared
- when using Qwen OAuth. You can switch back to OpenAI authentication
- later if needed.
+ {t(
+ 'Note: Your existing API key in settings.json will not be cleared when using Qwen OAuth. You can switch back to OpenAI authentication later if needed.',
+ )}
)}
diff --git a/packages/cli/src/ui/auth/AuthInProgress.tsx b/packages/cli/src/ui/auth/AuthInProgress.tsx
index 6270ecf1..3269946d 100644
--- a/packages/cli/src/ui/auth/AuthInProgress.tsx
+++ b/packages/cli/src/ui/auth/AuthInProgress.tsx
@@ -10,6 +10,7 @@ import { Box, Text } from 'ink';
import Spinner from 'ink-spinner';
import { theme } from '../semantic-colors.js';
import { useKeypress } from '../hooks/useKeypress.js';
+import { t } from '../../i18n/index.js';
interface AuthInProgressProps {
onTimeout: () => void;
@@ -48,13 +49,13 @@ export function AuthInProgress({
>
{timedOut ? (
- Authentication timed out. Please try again.
+ {t('Authentication timed out. Please try again.')}
) : (
- Waiting for auth... (Press ESC or CTRL+C to
- cancel)
+ {' '}
+ {t('Waiting for auth... (Press ESC or CTRL+C to cancel)')}
)}
diff --git a/packages/cli/src/ui/auth/useAuth.ts b/packages/cli/src/ui/auth/useAuth.ts
index 04da911c..d2369690 100644
--- a/packages/cli/src/ui/auth/useAuth.ts
+++ b/packages/cli/src/ui/auth/useAuth.ts
@@ -18,6 +18,7 @@ import type { OpenAICredentials } from '../components/OpenAIKeyPrompt.js';
import { useQwenAuth } from '../hooks/useQwenAuth.js';
import { AuthState, MessageType } from '../types.js';
import type { HistoryItem } from '../types.js';
+import { t } from '../../i18n/index.js';
export type { QwenAuthState } from '../hooks/useQwenAuth.js';
@@ -60,7 +61,9 @@ export const useAuthCommand = (
const handleAuthFailure = useCallback(
(error: unknown) => {
setIsAuthenticating(false);
- const errorMessage = `Failed to authenticate. Message: ${getErrorMessage(error)}`;
+ const errorMessage = t('Failed to authenticate. Message: {{message}}', {
+ message: getErrorMessage(error),
+ });
onAuthError(errorMessage);
// Log authentication failure
@@ -127,7 +130,9 @@ export const useAuthCommand = (
addItem(
{
type: MessageType.INFO,
- text: `Authenticated successfully with ${authType} credentials.`,
+ text: t('Authenticated successfully with {{authType}} credentials.', {
+ authType,
+ }),
},
Date.now(),
);
@@ -225,7 +230,13 @@ export const useAuthCommand = (
)
) {
onAuthError(
- `Invalid QWEN_DEFAULT_AUTH_TYPE value: "${defaultAuthType}". Valid values are: ${[AuthType.QWEN_OAUTH, AuthType.USE_OPENAI].join(', ')}`,
+ t(
+ 'Invalid QWEN_DEFAULT_AUTH_TYPE value: "{{value}}". Valid values are: {{validValues}}',
+ {
+ value: defaultAuthType,
+ validValues: [AuthType.QWEN_OAUTH, AuthType.USE_OPENAI].join(', '),
+ },
+ ),
);
}
}, [onAuthError]);
diff --git a/packages/cli/src/ui/components/OpenAIKeyPrompt.tsx b/packages/cli/src/ui/components/OpenAIKeyPrompt.tsx
index 0dc89bc7..ae65d358 100644
--- a/packages/cli/src/ui/components/OpenAIKeyPrompt.tsx
+++ b/packages/cli/src/ui/components/OpenAIKeyPrompt.tsx
@@ -10,6 +10,7 @@ import { z } from 'zod';
import { Box, Text } from 'ink';
import { Colors } from '../colors.js';
import { useKeypress } from '../hooks/useKeypress.js';
+import { t } from '../../i18n/index.js';
interface OpenAIKeyPromptProps {
onSubmit: (apiKey: string, baseUrl: string, model: string) => void;
@@ -64,9 +65,11 @@ export function OpenAIKeyPrompt({
const errorMessage = error.errors
.map((e) => `${e.path.join('.')}: ${e.message}`)
.join(', ');
- setValidationError(`Invalid credentials: ${errorMessage}`);
+ setValidationError(
+ t('Invalid credentials: {{errorMessage}}', { errorMessage }),
+ );
} else {
- setValidationError('Failed to validate credentials');
+ setValidationError(t('Failed to validate credentials'));
}
}
};
@@ -205,7 +208,7 @@ export function OpenAIKeyPrompt({
width="100%"
>
- OpenAI Configuration Required
+ {t('OpenAI Configuration Required')}
{validationError && (
@@ -214,7 +217,9 @@ export function OpenAIKeyPrompt({
)}
- Please enter your OpenAI configuration. You can get an API key from{' '}
+ {t(
+ 'Please enter your OpenAI configuration. You can get an API key from',
+ )}{' '}
https://bailian.console.aliyun.com/?tab=model#/api-key
@@ -225,7 +230,7 @@ export function OpenAIKeyPrompt({
- API Key:
+ {t('API Key:')}
@@ -240,7 +245,7 @@ export function OpenAIKeyPrompt({
- Base URL:
+ {t('Base URL:')}
@@ -255,7 +260,7 @@ export function OpenAIKeyPrompt({
- Model:
+ {t('Model:')}
@@ -267,7 +272,7 @@ export function OpenAIKeyPrompt({
- Press Enter to continue, Tab/↑↓ to navigate, Esc to cancel
+ {t('Press Enter to continue, Tab/↑↓ to navigate, Esc to cancel')}