feat(i18n): add full English (US) support with browser auto-detect - #11
feat(i18n): add full English (US) support with browser auto-detect#11erbanku wants to merge 10 commits into
Conversation
Agent-Logs-Url: https://github.com/erbanku/llmrelayservice/sessions/7458dbd5-b9cf-4680-8511-7a2e43a18e28 Co-authored-by: erbanku <79493862+erbanku@users.noreply.github.com>
Agent-Logs-Url: https://github.com/erbanku/llmrelayservice/sessions/7458dbd5-b9cf-4680-8511-7a2e43a18e28 Co-authored-by: erbanku <79493862+erbanku@users.noreply.github.com>
Adds full English (US) i18n support to the console frontend (`console/ai-proxy-dashboard`). README.md/README.en.md language switchers and i18next/react-i18next setup already existed; this PR completes the remaining work: - **Browser language auto-detection**: added `i18next-browser-languagedetector`. Detection order is `localStorage` → `navigator`, persisted under the `lrs-console-lang` key, falling back to Chinese (`zh`) when detection is inconclusive. - **Manual language switcher**: added a toggle button (globe/languages icon) in the nav bar that switches between `zh` and `en` via `i18n.changeLanguage()`. - **Extracted remaining hardcoded Chinese UI strings** into i18n keys (with English translations) across `api-docs-page.tsx`, `routes-page.tsx`, and `providers-page.tsx`. Module-level constants that previously held static Chinese text (e.g., API docs endpoint list/body examples) were converted into functions parameterized by the translation function `t`, recomputed via `useMemo` whenever the active language changes. - **Locale-aware formatting**: `formatTime`, `formatCount`, `keys-page`'s `formatDateTime`, and the request-list `localeCompare` sort now use the active `i18n.language` instead of a hardcoded `zh-CN` locale. - **Comments**: added English translations alongside existing Chinese code comments throughout touched files (Chinese comments were not deleted, per repo convention). - **Changelog**: added `changelog/2026-07-29.md` documenting this work.
Docker multi-arch builds failed on bun install --frozen-lockfile because the committed lockfile drifted from package.json. Refresh bun.lock so CI installs stay deterministic.
There was a problem hiding this comment.
Pull request overview
This PR completes English (US) i18n support for the console frontend (console/ai-proxy-dashboard) by adding browser language auto-detection + a manual language toggle, and by extracting remaining hardcoded Chinese UI strings into i18n keys (with locale-aware formatting updates).
Changes:
- Added
i18next-browser-languagedetectorand configured i18n to detect language vialocalStorage→navigator, withzhfallback. - Replaced remaining hardcoded Chinese strings in key dashboard pages/components with i18n keys (including memoized,
t-parameterized factories for module-level constants like API docs endpoints/examples). - Updated date/number formatting and request sorting to use the active
i18n.languagelocale.
Reviewed changes
Copilot reviewed 20 out of 22 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| console/ai-proxy-dashboard/src/i18n/locales/zh.ts | Added new translation keys (login hero, combobox, pagination, cost formula labels, API docs, providers extras, etc.). |
| console/ai-proxy-dashboard/src/i18n/locales/en.ts | Added English equivalents for newly extracted UI strings and labels. |
| console/ai-proxy-dashboard/src/i18n/index.ts | Added browser language auto-detection with i18next-browser-languagedetector + persistence. |
| console/ai-proxy-dashboard/src/features/dashboard/utils.ts | Switched formatting/sorting and some metric labels to i18n-aware locale/strings. |
| console/ai-proxy-dashboard/src/features/dashboard/hooks/use-dashboard-data.ts | Added bilingual (ZH+EN) comment translations in touched sections. |
| console/ai-proxy-dashboard/src/features/dashboard/components/session-shell.tsx | Extracted login hero UI strings to i18n keys (incl. show/hide). |
| console/ai-proxy-dashboard/src/features/dashboard/components/routes-page.tsx | Localized “Rule N” label via i18n key. |
| console/ai-proxy-dashboard/src/features/dashboard/components/request-log-table.tsx | Added bilingual comment translations for column meaning notes. |
| console/ai-proxy-dashboard/src/features/dashboard/components/providers-page.tsx | Localized remaining UI strings (counts/placeholders/filters) and added bilingual comments. |
| console/ai-proxy-dashboard/src/features/dashboard/components/nav-bar.tsx | Localized subtitles and added a language toggle control. |
| console/ai-proxy-dashboard/src/features/dashboard/components/models-page.tsx | Added bilingual comment translation for a dialog note. |
| console/ai-proxy-dashboard/src/features/dashboard/components/logs-page.tsx | Added bilingual comment translation for debounce note. |
| console/ai-proxy-dashboard/src/features/dashboard/components/keys-page.tsx | Made date-time formatting locale-aware via active i18n.language. |
| console/ai-proxy-dashboard/src/features/dashboard/components/detail-view.tsx | Added bilingual comment translations for metric/tabs notes. |
| console/ai-proxy-dashboard/src/features/dashboard/components/api-docs-page.tsx | Localized all remaining UI strings; refactored endpoints/body examples into t-driven factories updated on language change. |
| console/ai-proxy-dashboard/src/features/dashboard/api.ts | Localized login failure fallback message via i18n. |
| console/ai-proxy-dashboard/src/components/ui/pagination.tsx | Localized pagination UI and accessibility labels. |
| console/ai-proxy-dashboard/src/components/ui/combobox.tsx | Localized default placeholders/empty-state strings via i18n. |
| console/ai-proxy-dashboard/package.json | Added i18next-browser-languagedetector dependency. |
| changelog/2026-07-29.md | Added changelog entry documenting the i18n work. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Auto-detect the browser/system language, remembering the user's choice in | ||
| // localStorage. Falls back to Chinese (zh) when detection is inconclusive. | ||
| i18n | ||
| .use(LanguageDetector) | ||
| .use(initReactI18next) | ||
| .init({ | ||
| resources: { zh: { translation: zh }, en: { translation: en } }, | ||
| fallbackLng: "zh", | ||
| supportedLngs: ["zh", "en"], | ||
| nonExplicitSupportedLngs: true, | ||
| interpolation: { escapeValue: false }, | ||
| detection: { | ||
| order: ["localStorage", "navigator"], | ||
| lookupLocalStorage: "lrs-console-lang", | ||
| caches: ["localStorage"], | ||
| }, | ||
| }) |
|
@GoJam11 Please ignore/skip Copilot's suggestions; they suck to hell. I've tested it manually, and it works, but accepting Copilot's suggestions breaks CI, so I reverted that commit. |
…outing filter, API Agent-Logs-Url: https://github.com/erbanku/llmrelayservice/sessions/15971e8d-5b21-41b6-b54c-1ec15e9df25c Co-authored-by: erbanku <79493862+erbanku@users.noreply.github.com>
…ore.ts) Agent-Logs-Url: https://github.com/erbanku/llmrelayservice/sessions/15971e8d-5b21-41b6-b54c-1ec15e9df25c Co-authored-by: erbanku <79493862+erbanku@users.noreply.github.com>
Agent-Logs-Url: https://github.com/erbanku/llmrelayservice/sessions/15971e8d-5b21-41b6-b54c-1ec15e9df25c Co-authored-by: erbanku <79493862+erbanku@users.noreply.github.com>
…uth dialog) Agent-Logs-Url: https://github.com/erbanku/llmrelayservice/sessions/15971e8d-5b21-41b6-b54c-1ec15e9df25c Co-authored-by: erbanku <79493862+erbanku@users.noreply.github.com>
Agent-Logs-Url: https://github.com/erbanku/llmrelayservice/sessions/15971e8d-5b21-41b6-b54c-1ec15e9df25c Co-authored-by: erbanku <79493862+erbanku@users.noreply.github.com>
## Summary - Adds a Zero Data Retention (ZDR) privacy feature, enabled by default for all accounts/orgs/API keys. - 4-level scope resolution (global → model group → provider/guardrail → per-request), most-restrictive-wins semantics via `resolveEffectiveZdr` (`src/zdr-settings.ts`). - Disabling ZDR requires password re-entry, exchanged for a short-lived (5 min), single-use, purpose-scoped privileged token (`src/zdr-privileged-token.ts`). - When ZDR is active, prompt/completion content is stripped before persistence/logging (`src/zdr-log-redaction.ts`); only metadata (request id, timestamp, model, provider, token usage, latency, status code, ZDR flag) is retained. - Provider routing is filtered to only ZDR-capable providers when ZDR is active (`src/zdr-provider-filter.ts`, `src/zdr-runtime.ts`), without changing the existing routing/failover algorithm itself. - Audit log for ZDR settings changes (operation, scope, actor IP, timestamp) with no content logging (`src/zdr-audit.ts`). - New console API endpoints: `GET/PATCH /__console/api/settings/zdr`, `POST /__console/api/settings/zdr/reauth`. - Console frontend (`console/ai-proxy-dashboard`): - Settings page "Privacy / ZDR" section: toggle with confirm dialog + password reauth dialog before disabling, Alert-based success/failure feedback. - Provider create/edit form: ZDR capability checkboxes (`zdrCapable`, `noTrainingCapable`) and a provider-scope ZDR override selector. - Model-alias (model group) form: a model-group-scope ZDR override selector. - Full Chinese/English i18n coverage for all new strings. - New unit tests covering: ZDR default-on behavior, 4-level scope resolution, log/persistence content redaction, and ZDR-aware provider routing filtering.
|
Closing this PR to keep my open PR list clean and moving forward, since it has been sitting without maintainer action for a while. For anyone who still wants these changes, my fork remains available for anyone who still needs these changes. Thanks! |

Summary
Adds full English (US) i18n support to the console frontend (
console/ai-proxy-dashboard). README.md/README.en.md language switchers and i18next/react-i18next setup already existed; this PR completes the remaining work:i18next-browser-languagedetector. Detection order islocalStorage→navigator, persisted under thelrs-console-langkey, falling back to Chinese (zh) when detection is inconclusive.zhandenviai18n.changeLanguage().api-docs-page.tsx,routes-page.tsx, andproviders-page.tsx. Module-level constants that previously held static Chinese text (e.g., API docs endpoint list/body examples) were converted into functions parameterized by the translation functiont, recomputed viauseMemowhenever the active language changes.formatTime,formatCount,keys-page'sformatDateTime, and the request-listlocaleComparesort now use the activei18n.languageinstead of a hardcodedzh-CNlocale.changelog/2026-07-29.mddocumenting this work.Screenshots
Agent-Logs-Url: https://github.com/erbanku/llmrelayservice/sessions/7458dbd5-b9cf-4680-8511-7a2e43a18e28
Co-authored-by: erbanku 79493862+erbanku@users.noreply.github.comAgent-Logs-Url: https://github.com/erbanku/llmrelayservice/sessions/7458dbd5-b9cf-4680-8511-7a2e43a18e28
Co-authored-by: erbanku 79493862+erbanku@users.noreply.github.com