mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-30 12:40:44 +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
|
|
@ -15,6 +15,7 @@ import {
|
|||
} from '../utils/computeStats.js';
|
||||
import type { ModelMetrics } from '../contexts/SessionContext.js';
|
||||
import { useSessionStats } from '../contexts/SessionContext.js';
|
||||
import { t } from '../../i18n/index.js';
|
||||
|
||||
const METRIC_COL_WIDTH = 28;
|
||||
const MODEL_COL_WIDTH = 22;
|
||||
|
|
@ -65,7 +66,7 @@ export const ModelStatsDisplay: React.FC = () => {
|
|||
paddingX={2}
|
||||
>
|
||||
<Text color={theme.text.primary}>
|
||||
No API calls have been made in this session.
|
||||
{t('No API calls have been made in this session.')}
|
||||
</Text>
|
||||
</Box>
|
||||
);
|
||||
|
|
@ -94,7 +95,7 @@ export const ModelStatsDisplay: React.FC = () => {
|
|||
paddingX={2}
|
||||
>
|
||||
<Text bold color={theme.text.accent}>
|
||||
Model Stats For Nerds
|
||||
{t('Model Stats For Nerds')}
|
||||
</Text>
|
||||
<Box height={1} />
|
||||
|
||||
|
|
@ -102,7 +103,7 @@ export const ModelStatsDisplay: React.FC = () => {
|
|||
<Box>
|
||||
<Box width={METRIC_COL_WIDTH}>
|
||||
<Text bold color={theme.text.primary}>
|
||||
Metric
|
||||
{t('Metric')}
|
||||
</Text>
|
||||
</Box>
|
||||
{modelNames.map((name) => (
|
||||
|
|
@ -125,13 +126,13 @@ export const ModelStatsDisplay: React.FC = () => {
|
|||
/>
|
||||
|
||||
{/* API Section */}
|
||||
<StatRow title="API" values={[]} isSection />
|
||||
<StatRow title={t('API')} values={[]} isSection />
|
||||
<StatRow
|
||||
title="Requests"
|
||||
title={t('Requests')}
|
||||
values={getModelValues((m) => m.api.totalRequests.toLocaleString())}
|
||||
/>
|
||||
<StatRow
|
||||
title="Errors"
|
||||
title={t('Errors')}
|
||||
values={getModelValues((m) => {
|
||||
const errorRate = calculateErrorRate(m);
|
||||
return (
|
||||
|
|
@ -146,7 +147,7 @@ export const ModelStatsDisplay: React.FC = () => {
|
|||
})}
|
||||
/>
|
||||
<StatRow
|
||||
title="Avg Latency"
|
||||
title={t('Avg Latency')}
|
||||
values={getModelValues((m) => {
|
||||
const avgLatency = calculateAverageLatency(m);
|
||||
return formatDuration(avgLatency);
|
||||
|
|
@ -156,9 +157,9 @@ export const ModelStatsDisplay: React.FC = () => {
|
|||
<Box height={1} />
|
||||
|
||||
{/* Tokens Section */}
|
||||
<StatRow title="Tokens" values={[]} isSection />
|
||||
<StatRow title={t('Tokens')} values={[]} isSection />
|
||||
<StatRow
|
||||
title="Total"
|
||||
title={t('Total')}
|
||||
values={getModelValues((m) => (
|
||||
<Text color={theme.status.warning}>
|
||||
{m.tokens.total.toLocaleString()}
|
||||
|
|
@ -166,13 +167,13 @@ export const ModelStatsDisplay: React.FC = () => {
|
|||
))}
|
||||
/>
|
||||
<StatRow
|
||||
title="Prompt"
|
||||
title={t('Prompt')}
|
||||
isSubtle
|
||||
values={getModelValues((m) => m.tokens.prompt.toLocaleString())}
|
||||
/>
|
||||
{hasCached && (
|
||||
<StatRow
|
||||
title="Cached"
|
||||
title={t('Cached')}
|
||||
isSubtle
|
||||
values={getModelValues((m) => {
|
||||
const cacheHitRate = calculateCacheHitRate(m);
|
||||
|
|
@ -186,20 +187,20 @@ export const ModelStatsDisplay: React.FC = () => {
|
|||
)}
|
||||
{hasThoughts && (
|
||||
<StatRow
|
||||
title="Thoughts"
|
||||
title={t('Thoughts')}
|
||||
isSubtle
|
||||
values={getModelValues((m) => m.tokens.thoughts.toLocaleString())}
|
||||
/>
|
||||
)}
|
||||
{hasTool && (
|
||||
<StatRow
|
||||
title="Tool"
|
||||
title={t('Tool')}
|
||||
isSubtle
|
||||
values={getModelValues((m) => m.tokens.tool.toLocaleString())}
|
||||
/>
|
||||
)}
|
||||
<StatRow
|
||||
title="Output"
|
||||
title={t('Output')}
|
||||
isSubtle
|
||||
values={getModelValues((m) => m.tokens.candidates.toLocaleString())}
|
||||
/>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue