mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-21 09:17:53 +00:00
feat: add i18n utils
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
type Config,
|
||||
getErrorMessage,
|
||||
} from '@qwen-code/qwen-code-core';
|
||||
import { t } from '../i18n/index.js';
|
||||
|
||||
/**
|
||||
* Handles the initial authentication flow.
|
||||
@@ -29,7 +30,9 @@ export async function performInitialAuth(
|
||||
// The console.log is intentionally left out here.
|
||||
// We can add a dedicated startup message later if needed.
|
||||
} catch (e) {
|
||||
return `Failed to login. Message: ${getErrorMessage(e)}`;
|
||||
return t('Failed to login. Message: {{message}}', {
|
||||
message: getErrorMessage(e),
|
||||
});
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
import { type LoadedSettings } from '../config/settings.js';
|
||||
import { performInitialAuth } from './auth.js';
|
||||
import { validateTheme } from './theme.js';
|
||||
import { initializeI18n } from '../i18n/index.js';
|
||||
|
||||
export interface InitializationResult {
|
||||
authError: string | null;
|
||||
@@ -33,6 +34,13 @@ export async function initializeApp(
|
||||
config: Config,
|
||||
settings: LoadedSettings,
|
||||
): Promise<InitializationResult> {
|
||||
// Initialize i18n system
|
||||
const languageSetting =
|
||||
settings.merged.general?.language ||
|
||||
process.env['QWEN_CODE_LANG'] ||
|
||||
'auto';
|
||||
await initializeI18n(languageSetting);
|
||||
|
||||
const authError = await performInitialAuth(
|
||||
config,
|
||||
settings.merged.security?.auth?.selectedType,
|
||||
|
||||
Reference in New Issue
Block a user