From 371275ec3417243c98b6af9c0c23a9a882d63af1 Mon Sep 17 00:00:00 2001 From: IanShaw027 <131567472+IanShaw027@users.noreply.github.com> Date: Wed, 14 Jan 2026 17:04:30 +0800 Subject: [PATCH] =?UTF-8?q?refactor(frontend):=20=E6=B8=85=E7=90=86ops?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E4=B8=AD=E6=9C=AA=E4=BD=BF=E7=94=A8=E7=9A=84?= =?UTF-8?q?i18n=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除i18n文件中未使用的翻译键(cpu, redis, qps, ttft等) - 将技术术语改为硬编码(QPS, CPU, TPS等不需要翻译) - 简化OpsDashboardHeader、OpsErrorDetailModal等组件的i18n调用 --- frontend/src/i18n/locales/en.ts | 8 -------- frontend/src/i18n/locales/zh.ts | 8 -------- .../views/admin/ops/components/OpsDashboardHeader.vue | 10 +++++----- .../views/admin/ops/components/OpsErrorDetailModal.vue | 10 +++++----- .../admin/ops/components/OpsRuntimeSettingsCard.vue | 4 ++-- .../admin/ops/components/OpsThroughputTrendChart.vue | 4 ++-- 6 files changed, 14 insertions(+), 30 deletions(-) diff --git a/frontend/src/i18n/locales/en.ts b/frontend/src/i18n/locales/en.ts index 936d6bfa..eb75785e 100644 --- a/frontend/src/i18n/locales/en.ts +++ b/frontend/src/i18n/locales/en.ts @@ -1858,10 +1858,8 @@ export default { noSystemMetrics: 'No system metrics collected yet.', collectedAt: 'Collected at:', window: 'window', - cpu: 'CPU', memory: 'Memory', db: 'DB', - redis: 'Redis', goroutines: 'Goroutines', jobs: 'Jobs', jobsHelp: 'Click “Details” to view job heartbeats and recent errors', @@ -1907,7 +1905,6 @@ export default { p99: 'p99:', avg: 'avg:', max: 'max:', - qps: 'QPS', requests: 'Requests', requestsTitle: 'Requests', upstream: 'Upstream', @@ -2061,7 +2058,6 @@ export default { }, total: 'Total:', searchPlaceholder: 'Search request_id / client_request_id / message', - accountIdPlaceholder: 'account_id' }, // Error Detail Modal errorDetail: { @@ -2096,7 +2092,6 @@ export default { requestId: 'Request ID' }, retryMeta: { - http: 'HTTP', used: 'Used', success: 'Success', pinned: 'Pinned' @@ -2113,7 +2108,6 @@ export default { group: 'Group', account: 'Account', latency: 'Request Duration', - ttft: 'TTFT', businessLimited: 'Business Limited', requestPath: 'Request Path', timings: 'Timings', @@ -2134,7 +2128,6 @@ export default { confirmRetry: 'Confirm Retry', retrySuccess: 'Retry succeeded', retryFailed: 'Retry failed', - na: 'N/A', retryHint: 'Retry will resend the request with the same parameters', retryClientHint: 'Use client retry (no account pinning)', retryUpstreamHint: 'Use upstream pinned retry (pin to the error account)', @@ -2357,7 +2350,6 @@ export default { title: 'Alert Silencing (Maintenance Mode)', enabled: 'Enable silencing', globalUntil: 'Silence until (RFC3339)', - untilPlaceholder: '2026-01-05T00:00:00Z', untilHint: 'Leave empty to only toggle silencing without an expiry (not recommended).', reason: 'Reason', reasonPlaceholder: 'e.g., planned maintenance', diff --git a/frontend/src/i18n/locales/zh.ts b/frontend/src/i18n/locales/zh.ts index 85270e02..ef650133 100644 --- a/frontend/src/i18n/locales/zh.ts +++ b/frontend/src/i18n/locales/zh.ts @@ -2002,10 +2002,8 @@ export default { noSystemMetrics: '尚未收集系统指标。', collectedAt: '采集时间:', window: '窗口', - cpu: 'CPU', memory: '内存', db: '数据库', - redis: 'Redis', goroutines: '协程', jobs: '后台任务', jobsHelp: '点击“明细”查看任务心跳与报错信息', @@ -2051,7 +2049,6 @@ export default { p99: 'p99', avg: 'avg', max: 'max', - qps: 'QPS', requests: '请求数', requestsTitle: '请求', upstream: '上游', @@ -2205,7 +2202,6 @@ export default { }, total: '总计:', searchPlaceholder: '搜索 request_id / client_request_id / message', - accountIdPlaceholder: 'account_id' }, // Error Detail Modal errorDetail: { @@ -2240,7 +2236,6 @@ export default { requestId: '请求ID' }, retryMeta: { - http: 'HTTP', used: '使用账号', success: '成功', pinned: '固定账号' @@ -2257,7 +2252,6 @@ export default { group: '分组', account: '账号', latency: '请求时长', - ttft: 'TTFT', businessLimited: '业务限制', requestPath: '请求路径', timings: '时序信息', @@ -2278,7 +2272,6 @@ export default { confirmRetry: '确认重试', retrySuccess: '重试成功', retryFailed: '重试失败', - na: 'N/A', retryHint: '重试将使用相同的请求参数重新发送请求', retryClientHint: '使用客户端重试(不固定账号)', retryUpstreamHint: '使用上游固定重试(固定到错误的账号)', @@ -2501,7 +2494,6 @@ export default { title: '告警静默(维护模式)', enabled: '启用静默', globalUntil: '静默截止时间(RFC3339)', - untilPlaceholder: '2026-01-05T00:00:00Z', untilHint: '建议填写截止时间,避免忘记关闭静默。', reason: '原因', reasonPlaceholder: '例如:计划维护', diff --git a/frontend/src/views/admin/ops/components/OpsDashboardHeader.vue b/frontend/src/views/admin/ops/components/OpsDashboardHeader.vue index c50524ac..51da5b88 100644 --- a/frontend/src/views/admin/ops/components/OpsDashboardHeader.vue +++ b/frontend/src/views/admin/ops/components/OpsDashboardHeader.vue @@ -1084,7 +1084,7 @@ function handleToolbarRefresh() {
{{ displayRealTimeQps.toFixed(1) }} - {{ t('admin.ops.qps') }} + QPS
{{ displayRealTimeTps.toFixed(1) }} @@ -1101,7 +1101,7 @@ function handleToolbarRefresh() {
{{ realtimeQpsPeakLabel }} - {{ t('admin.ops.qps') }} + QPS
{{ realtimeTpsPeakLabel }} @@ -1116,7 +1116,7 @@ function handleToolbarRefresh() {
{{ realtimeQpsAvgLabel }} - {{ t('admin.ops.qps') }} + QPS
{{ realtimeTpsAvgLabel }} @@ -1384,7 +1384,7 @@ function handleToolbarRefresh() {
-
{{ t('admin.ops.cpu') }}
+
CPU
@@ -1433,7 +1433,7 @@ function handleToolbarRefresh() {
-
{{ t('admin.ops.redis') }}
+
Redis
diff --git a/frontend/src/views/admin/ops/components/OpsErrorDetailModal.vue b/frontend/src/views/admin/ops/components/OpsErrorDetailModal.vue index 88af52e5..67eda179 100644 --- a/frontend/src/views/admin/ops/components/OpsErrorDetailModal.vue +++ b/frontend/src/views/admin/ops/components/OpsErrorDetailModal.vue @@ -181,7 +181,7 @@
-
{{ t('admin.ops.errorDetail.ttft') }}
+
TTFT
{{ detail.time_to_first_token_ms != null ? `${detail.time_to_first_token_ms}ms` : '—' }}
@@ -434,7 +434,7 @@
{{ selectedA ? `#${selectedA.id} · ${selectedA.mode} · ${selectedA.status}` : '—' }}
- {{ t('admin.ops.errorDetail.retryMeta.http') }}: {{ selectedA?.http_status_code ?? '—' }} · + HTTP: {{ selectedA?.http_status_code ?? '—' }} · {{ t('admin.ops.errorDetail.retryMeta.used') }}: {{ selectedA.used_account_name || selectedA.used_account_id }} @@ -448,7 +448,7 @@
{{ selectedB ? `#${selectedB.id} · ${selectedB.mode} · ${selectedB.status}` : '—' }}
- {{ t('admin.ops.errorDetail.retryMeta.http') }}: {{ selectedB?.http_status_code ?? '—' }} · + HTTP: {{ selectedB?.http_status_code ?? '—' }} · {{ t('admin.ops.errorDetail.retryMeta.used') }}: {{ selectedB.used_account_name || selectedB.used_account_id }} @@ -469,7 +469,7 @@
{{ t('admin.ops.errorDetail.retryMeta.success') }}: {{ a.success ?? '—' }}
-
{{ t('admin.ops.errorDetail.retryMeta.http') }}: {{ a.http_status_code ?? '—' }}
+
HTTP: {{ a.http_status_code ?? '—' }}
{{ t('admin.ops.errorDetail.retryMeta.pinned') }}: @@ -613,7 +613,7 @@ function close() { } function prettyJSON(raw?: string): string { - if (!raw) return t('admin.ops.errorDetail.na') + if (!raw) return 'N/A' try { return JSON.stringify(JSON.parse(raw), null, 2) } catch { diff --git a/frontend/src/views/admin/ops/components/OpsRuntimeSettingsCard.vue b/frontend/src/views/admin/ops/components/OpsRuntimeSettingsCard.vue index d9bcbd51..82c19f4f 100644 --- a/frontend/src/views/admin/ops/components/OpsRuntimeSettingsCard.vue +++ b/frontend/src/views/admin/ops/components/OpsRuntimeSettingsCard.vue @@ -407,7 +407,7 @@ onMounted(() => { v-model="draftAlert.silencing.global_until_rfc3339" type="text" class="input font-mono text-sm" - :placeholder="t('admin.ops.runtime.silencing.untilPlaceholder')" + placeholder="2026-01-05T00:00:00Z" />

{{ t('admin.ops.runtime.silencing.untilHint') }}

@@ -479,7 +479,7 @@ onMounted(() => { v-model="(entry as any).until_rfc3339" type="text" class="input font-mono text-sm" - :placeholder="t('admin.ops.runtime.silencing.untilPlaceholder')" + placeholder="2026-01-05T00:00:00Z" />
diff --git a/frontend/src/views/admin/ops/components/OpsThroughputTrendChart.vue b/frontend/src/views/admin/ops/components/OpsThroughputTrendChart.vue index 10c958b4..5707cc3b 100644 --- a/frontend/src/views/admin/ops/components/OpsThroughputTrendChart.vue +++ b/frontend/src/views/admin/ops/components/OpsThroughputTrendChart.vue @@ -61,7 +61,7 @@ const chartData = computed(() => { labels: props.points.map((p) => formatHistoryLabel(p.bucket_start, props.timeRange)), datasets: [ { - label: t('admin.ops.qps'), + label: 'QPS', data: props.points.map((p) => p.qps ?? 0), borderColor: colors.value.blue, backgroundColor: colors.value.blueAlpha, @@ -183,7 +183,7 @@ function downloadChart() {
- {{ t('admin.ops.qps') }} + QPS {{ t('admin.ops.tpsK') }}