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

@@ -16,6 +16,7 @@ import type {
SettingsValue,
} from '../config/settingsSchema.js';
import { getSettingsSchema } from '../config/settingsSchema.js';
import { t } from '../i18n/index.js';
// The schema is now nested, but many parts of the UI and logic work better
// with a flattened structure and dot-notation keys. This section flattens the
@@ -446,7 +447,11 @@ export function getDisplayValue(
if (definition?.type === 'enum' && definition.options) {
const option = definition.options?.find((option) => option.value === value);
valueString = option?.label ?? `${value}`;
if (option?.label) {
valueString = t(option.label) || option.label;
} else {
valueString = `${value}`;
}
}
// Check if value is different from default OR if it's in modified settings OR if there are pending changes

View File

@@ -5,6 +5,7 @@
*/
import type { ExtendedSystemInfo } from './systemInfo.js';
import { t } from '../i18n/index.js';
/**
* Field configuration for system information display
@@ -23,59 +24,59 @@ export function getSystemInfoFields(
): SystemInfoField[] {
const allFields: SystemInfoField[] = [
{
label: 'CLI Version',
label: t('CLI Version'),
key: 'cliVersion',
},
{
label: 'Git Commit',
label: t('Git Commit'),
key: 'gitCommit',
},
{
label: 'Model',
label: t('Model'),
key: 'modelVersion',
},
{
label: 'Sandbox',
label: t('Sandbox'),
key: 'sandboxEnv',
},
{
label: 'OS Platform',
label: t('OS Platform'),
key: 'osPlatform',
},
{
label: 'OS Arch',
label: t('OS Arch'),
key: 'osArch',
},
{
label: 'OS Release',
label: t('OS Release'),
key: 'osRelease',
},
{
label: 'Node.js Version',
label: t('Node.js Version'),
key: 'nodeVersion',
},
{
label: 'NPM Version',
label: t('NPM Version'),
key: 'npmVersion',
},
{
label: 'Session ID',
label: t('Session ID'),
key: 'sessionId',
},
{
label: 'Auth Method',
label: t('Auth Method'),
key: 'selectedAuthType',
},
{
label: 'Base URL',
label: t('Base URL'),
key: 'baseUrl',
},
{
label: 'Memory Usage',
label: t('Memory Usage'),
key: 'memoryUsage',
},
{
label: 'IDE Client',
label: t('IDE Client'),
key: 'ideClient',
},
];