mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-05 15:31:27 +00:00
feat(i18n): Add Internationalization Support for UI and LLM Output (#1058)
This commit is contained in:
parent
640f30655d
commit
48b77541c3
98 changed files with 4740 additions and 636 deletions
|
|
@ -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]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue