From 311d4b71e2f6668c04ce3864a7e5ae5f5f2fc3f2 Mon Sep 17 00:00:00 2001 From: shi chuang <709010312@qq.com> Date: Thu, 16 Jul 2026 00:02:55 +0800 Subject: [PATCH 1/3] feat: complete Simplified Chinese localization --- CHANGELOG.md | 2 + README.md | 2 +- frontend/dashboard/src/App.tsx | 6 +- .../src/app/DocumentLocalizationBridge.tsx | 151 ++++ frontend/dashboard/src/app/i18n.ts | 69 ++ .../src/app/zh-Hans/advancedPages.ts | 468 +++++++++++ frontend/dashboard/src/app/zh-Hans/common.ts | 269 ++++++ .../dashboard/src/app/zh-Hans/corePages.ts | 730 +++++++++++++++++ .../src/app/zh-Hans/diagnosticsReports.ts | 773 ++++++++++++++++++ .../src/app/zh-Hans/translate.test.ts | 95 +++ .../dashboard/src/app/zh-Hans/translate.ts | 86 ++ frontend/dashboard/src/app/zh-Hans/types.ts | 4 + frontend/dashboard/src/charts/LineChart.tsx | 8 +- .../dashboard/src/components/DataTable.tsx | 60 +- .../dashboard/src/components/MetricCard.tsx | 12 +- frontend/dashboard/src/components/Panel.tsx | 6 +- .../dashboard/src/components/StatusBadge.tsx | 4 +- .../dashboard/src/design/PageLoadProgress.tsx | 22 +- .../src/design/primitives/Primitives.tsx | 50 +- .../cache-context/CacheContextPage.tsx | 15 +- .../callInvestigatorReadout.test.ts | 1 + .../src/features/calls/CallsExplorerView.tsx | 6 +- .../diagnostics/DiagnosticSnapshotMatrix.tsx | 10 +- .../src/features/explore/EvidenceGrid.tsx | 28 +- .../investigator/InvestigatorPage.tsx | 22 +- .../src/features/limits/LimitsPage.tsx | 4 +- .../features/overview/OverviewRecentCalls.tsx | 8 +- .../src/features/reports/ReportsPage.tsx | 4 +- .../dashboard/src/features/shared/tables.tsx | 15 +- .../src/features/threads/ThreadInspector.tsx | 29 +- .../features/threads/ThreadsExplorerView.tsx | 10 +- .../src/visualization/react/Visualization.tsx | 74 +- .../react/VisualizationState.tsx | 6 +- .../react/VisualizationTable.tsx | 4 +- .../react/localizeVisualizationSpec.test.ts | 78 ++ .../react/localizeVisualizationSpec.ts | 153 ++++ .../src/visualization/renderer/modelShared.ts | 2 +- .../src/visualization/spec/accessibility.ts | 13 +- .../dashboard/src/visualization/spec/types.ts | 1 + .../cli/commands_lifecycle.py | 61 +- src/codex_usage_tracker/cli/dashboard.py | 12 +- src/codex_usage_tracker/cli/help_i18n.py | 170 ++++ src/codex_usage_tracker/cli/main.py | 9 +- src/codex_usage_tracker/cli/parser.py | 7 +- .../dashboard/locales/zh-Hans.json | 306 +++---- .../plugin_data/dashboard/react/assets/App.js | 56 +- .../react/assets/CacheContextPage.js | 2 +- .../dashboard/react/assets/CallsPage.js | 2 +- .../dashboard/react/assets/DataTable.js | 6 +- .../dashboard/react/assets/DiagnosticsPage.js | 2 +- .../dashboard/react/assets/EvidenceGrid.js | 4 +- .../react/assets/ExploreWorkspaceSwitcher.js | 2 +- .../react/assets/InvestigatorPage.js | 6 +- .../dashboard/react/assets/LineChart.js | 2 +- .../dashboard/react/assets/OverviewPage.js | 2 +- .../react/assets/PageLoadProgress.js | 2 +- .../dashboard/react/assets/Panel.js | 2 +- .../dashboard/react/assets/Primitives.js | 2 +- .../dashboard/react/assets/ReportsPage.js | 2 +- .../dashboard/react/assets/ThreadsPage.js | 4 +- .../react/assets/UsageConstellation.js | 6 +- .../dashboard/react/assets/UsageDrainPage.js | 2 +- .../dashboard/react/assets/overviewQueries.js | 4 +- .../dashboard/react/assets/runtime.js | 2 +- src/codex_usage_tracker/server/api.py | 27 +- tests/cli/test_cli_help_i18n.py | 38 + tests/server/test_server_api.py | 28 +- 67 files changed, 3671 insertions(+), 397 deletions(-) create mode 100644 frontend/dashboard/src/app/DocumentLocalizationBridge.tsx create mode 100644 frontend/dashboard/src/app/zh-Hans/advancedPages.ts create mode 100644 frontend/dashboard/src/app/zh-Hans/common.ts create mode 100644 frontend/dashboard/src/app/zh-Hans/corePages.ts create mode 100644 frontend/dashboard/src/app/zh-Hans/diagnosticsReports.ts create mode 100644 frontend/dashboard/src/app/zh-Hans/translate.test.ts create mode 100644 frontend/dashboard/src/app/zh-Hans/translate.ts create mode 100644 frontend/dashboard/src/app/zh-Hans/types.ts create mode 100644 frontend/dashboard/src/visualization/react/localizeVisualizationSpec.test.ts create mode 100644 frontend/dashboard/src/visualization/react/localizeVisualizationSpec.ts create mode 100644 src/codex_usage_tracker/cli/help_i18n.py create mode 100644 tests/cli/test_cli_help_i18n.py diff --git a/CHANGELOG.md b/CHANGELOG.md index faf9ee5f..043e54cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +- Complete the Simplified Chinese dashboard experience across React views, visualization metadata, tables, accessibility text, CLI help, and dashboard lifecycle messages while preserving user-provided data verbatim. + ## 0.18.0 - 2026-07-15 - Exclude exact historical calls copied by cloned Codex tasks from default dashboard, CLI, MCP, report, allowance, compression, recommendation, and export totals while retaining every physical source row for local provenance. diff --git a/README.md b/README.md index 158fdacc..1b2c17ca 100644 --- a/README.md +++ b/README.md @@ -214,7 +214,7 @@ CODEX_USAGE_TRACKER_LANG=vi codex-usage-tracker serve-dashboard --open The dashboard also includes a language selector. Browser selections are stored locally and can override the generated default for that browser. -Supported dashboard locales include English, Vietnamese, Spanish, French, German, Portuguese, Japanese, Simplified Chinese, Korean, Russian, Italian, and Arabic. This localizes dashboard UI text, not raw Codex log content, thread names, project names, paths, full CLI output, or data exports. +Supported dashboard locales include English, Vietnamese, Spanish, French, German, Portuguese, Japanese, Simplified Chinese, Korean, Russian, Italian, and Arabic. Simplified Chinese also localizes CLI help and dashboard lifecycle messages. Localization never rewrites raw Codex log content, thread names, project names, paths, or data exports. ### Adding A Dashboard Language diff --git a/frontend/dashboard/src/App.tsx b/frontend/dashboard/src/App.tsx index dbdccf45..1e6ff831 100644 --- a/frontend/dashboard/src/App.tsx +++ b/frontend/dashboard/src/App.tsx @@ -6,6 +6,7 @@ import { errorMessage, refreshProgressLabel, type RefreshOptions } from './app/d import { historyScopeFromPayload, historyScopeStatusLabel } from './app/historyScope'; import { createShellI18n, initialDashboardLanguage, storeDashboardLanguage } from './app/i18n'; import { ShellI18nProvider } from './app/i18nContext'; +import { DocumentLocalizationBridge } from './app/DocumentLocalizationBridge'; import { modelWithLegacyShellFilters } from './app/legacyShellFilters'; import { navItems, secondaryNavItems, type ViewId } from './app/navigation'; import { RowLimitControl } from './app/RowLimitControl'; @@ -526,7 +527,8 @@ function clearInvestigationPreset() { return ( -
+ +