Skip to content

7.4 billion tokens per month. 34 free LLM providers. 635 free model endpoints. All behind one /v1 endpoint, plus any custom OpenAI-compatible endpoint. Smart routing, automatic failover, encrypted keys. Personal experimentation only.

TypeScript

feat(i18n): multi-language dashboard (en, zh-CN, fr, es, pt-BR)

Tashfeen65e52780868d
diff --git a/client/src/App.tsx b/client/src/App.tsx
index 7a9747ed..a2ca23e5 100644
--- a/client/src/App.tsx
+++ b/client/src/App.tsx
@@ -1,17 +1,23 @@
import { useEffect, useState } from 'react'
import { BrowserRouter, Routes, Route, Navigate, NavLink, Link, useLocation, useNavigate } from 'react-router-dom'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
-import { Menu, MoreHorizontal, Moon, Sun } from 'lucide-react'
+import { Languages, Menu, MoreHorizontal, Moon, Sun } from 'lucide-react'
import { buttonVariants } from '@/components/ui/button'
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuGroup,
DropdownMenuItem,
+ DropdownMenuRadioGroup,
+ DropdownMenuRadioItem,
DropdownMenuSeparator,
+ DropdownMenuSub,
+ DropdownMenuSubContent,
+ DropdownMenuSubTrigger,
DropdownMenuTrigger,
} from '@/components/ui/dropdown-menu'
import { AuthGate } from '@/components/auth-gate'
+import { I18nProvider, useI18n, SUPPORTED_LOCALES, type Locale } from '@/i18n'
import { logout } from '@/lib/api'
import KeysPage from '@/pages/KeysPage'
import PlaygroundPage from '@/pages/PlaygroundPage'
@@ -23,11 +29,11 @@ import PremiumPage from '@/pages/PremiumPage'
const queryClient = new QueryClient()
const navItems = [
- { to: '/models', label: 'Models' },
- { to: '/playground', label: 'Playground' },
- { to: '/keys', label: 'Keys' },
- { to: '/analytics', label: 'Analytics' },
- { to: '/premium', label: 'Premium' },
+ { to: '/models', labelKey: 'nav.models' },
+ { to: '/playground', labelKey: 'nav.playground' },
+ { to: '/keys', labelKey: 'nav.keys' },
+ { to: '/analytics', labelKey: 'nav.analytics' },
+ { to: '/premium', labelKey: 'nav.premium' },
]
function getPreferredDarkMode() {
@@ -96,8 +102,33 @@ if (isDesktopApp) {
document.documentElement.classList.add('desktop')
}
+// Language picker as a dropdown submenu, shared by the desktop (⋯) and mobile
+// (☰) menus. Radio items show a check on the active locale; selecting one calls
+// setLocale, which persists and re-renders every t() synchronously.
+function LanguageSubMenu() {
+ const { locale, setLocale, t } = useI18n()
+ return (
+ <DropdownMenuSub>
+ <DropdownMenuSubTrigger className="gap-2">
+ <Languages className="size-4" />
+ <span>{t('nav.language')}</span>
+ </DropdownMenuSubTrigger>
+ <DropdownMenuSubContent>
+ <DropdownMenuRadioGroup value={locale} onValueChange={(v) => setLocale(v as Locale)}>
+ {SUPPORTED_LOCALES.map((code) => (
+ <DropdownMenuRadioItem key={code} value={code}>
+ {t(`languages.${code}`)}
+ </DropdownMenuRadioItem>
+ ))}
+ </DropdownMenuRadioGroup>
+ </DropdownMenuSubContent>
+ </DropdownMenuSub>
+ )
+}
+
function Navbar() {
const { dark, toggle } = useDarkMode()
+ const { t } = useI18n()
const location = useLocation()
const navigate = useNavigate()
@@ -123,7 +154,7 @@ function Navbar() {
>
{navItems.map((item) => (
<NavItem key={item.to} to={item.to}>
- {item.label}
+ {t(item.labelKey)}
</NavItem>
))}
</nav>
@@ -134,19 +165,20 @@ function Navbar() {
<DropdownMenu>
<DropdownMenuTrigger
className={buttonVariants({ variant: 'ghost', size: 'icon' })}
- aria-label="Open menu"
+ aria-label={t('nav.openMenu')}
>
<MoreHorizontal />
</DropdownMenuTrigger>
- <DropdownMenuContent align="end" className="w-44">
+ <DropdownMenuContent align="end" className="w-48">
<DropdownMenuItem onClick={toggle} className="justify-between">
- <span>Theme</span>
+ <span>{t('nav.theme')}</span>
{dark ? <Sun /> : <Moon />}
</DropdownMenuItem>
+ <LanguageSubMenu />
{!isDesktopApp && (
<>
<DropdownMenuSeparator />
- <DropdownMenuItem onClick={() => logout()}>Sign out</DropdownMenuItem>
+ <DropdownMenuItem onClick={() => logout()}>{t('nav.signOut')}</DropdownMenuItem>
</>
)}
</DropdownMenuContent>
@@ -156,7 +188,7 @@ function Navbar() {
<DropdownMenu>
<DropdownMenuTrigger
className={buttonVariants({ variant: 'ghost', size: 'icon' })}
- aria-label="Open navigation menu"
+ aria-label={t('nav.openMenu')}
>
<Menu />
</DropdownMenuTrigger>
@@ -168,18 +200,19 @@ function Navbar() {
onClick={() => navigate(item.to)}
className={isActiveRoute(item.to) ? 'bg-accent text-accent-foreground font-medium' : undefined}
>
- {item.label}
+ {t(item.labelKey)}
</DropdownMenuItem>
))}
</DropdownMenuGroup>
<DropdownMenuSeparator />
<DropdownMenuGroup>
<DropdownMenuItem onClick={toggle} className="justify-between">
- <span>Theme</span>
+ <span>{t('nav.theme')}</span>
{dark ? <Sun /> : <Moon />}
</DropdownMenuItem>
+ <LanguageSubMenu />
{!isDesktopApp && (
- <DropdownMenuItem onClick={() => logout()}>Sign out</DropdownMenuItem>
+ <DropdownMenuItem onClick={() => logout()}>{t('nav.signOut')}</DropdownMenuItem>
)}
</DropdownMenuGroup>
</DropdownMenuContent>
@@ -193,6 +226,7 @@ function Navbar() {
function App() {
return (
<QueryClientProvider client={queryClient}>
+ <I18nProvider>
<BrowserRouter basename={import.meta.env.BASE_URL}>
<AuthGate>
<div className={`min-h-screen ${isDesktopApp ? 'desktop-backdrop' : 'bg-background'}`}>
@@ -215,6 +249,7 @@ function App() {
</div>
</AuthGate>
</BrowserRouter>
+ </I18nProvider>
</QueryClientProvider>
)
}
diff --git a/client/src/components/auth-gate.tsx b/client/src/components/auth-gate.tsx
index 4ae87739..66b0ade4 100644
--- a/client/src/components/auth-gate.tsx
+++ b/client/src/components/auth-gate.tsx
@@ -4,6 +4,7 @@ import { apiFetch, setToken, UNAUTHORIZED_EVENT } from '@/lib/api'
import { Button } from '@/components/ui/button'
import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label'
+import { useI18n } from '@/i18n'
interface AuthStatus {
needsSetup: boolean
@@ -20,6 +21,7 @@ function Centered({ children }: { children: ReactNode }) {
}
function AuthForm({ mode, onAuthed }: { mode: 'setup' | 'login'; onAuthed: () => void }) {
+ const { t } = useI18n()
const [email, setEmail] = useState('')
const [password, setPassword] = useState('')
const [error, setError] = useState('')
@@ -52,38 +54,38 @@ function AuthForm({ mode, onAuthed }: { mode: 'setup' | 'login'; onAuthed: () =>
<span className="font-semibold tracking-tight text-sm">FreeLLMAPI</span>
</div>
<div className="rounded-3xl border bg-card p-6">
- <h1 className="text-base font-medium">{isSetup ? 'Create your account' : 'Sign in'}</h1>
+ <h1 className="text-base font-medium">{isSetup ? t('auth.createYourAccount') : t('auth.signIn')}</h1>
<p className="text-xs text-muted-foreground mt-1 mb-4">
{isSetup
- ? 'Set the email and password that will protect this dashboard.'
- : 'Sign in to manage your keys, routing, and analytics.'}
+ ? t('auth.setupDescription')
+ : t('auth.loginDescription')}
</p>
<form onSubmit={submit} className="space-y-3">
<div className="space-y-1.5">
- <Label className="text-xs" htmlFor="auth-email">Email</Label>
+ <Label className="text-xs" htmlFor="auth-email">{t('auth.email')}</Label>
<Input
id="auth-email"
type="email"
autoComplete="username"
value={email}
onChange={e => setEmail(e.target.value)}
- placeholder="[email protected]"
+ placeholder={t('auth.emailPlaceholder')}
/>
</div>
<div className="space-y-1.5">
- <Label className="text-xs" htmlFor="auth-password">Password</Label>
+ <Label className="text-xs" htmlFor="auth-password">{t('auth.password')}</Label>
<Input
id="auth-password"
type="password"
autoComplete={isSetup ? 'new-password' : 'current-password'}
value={password}
onChange={e => setPassword(e.target.value)}
- placeholder={isSetup ? 'at least 8 characters' : 'your password'}
+ placeholder={isSetup ? t('auth.passwordPlaceholderSetup') : t('auth.passwordPlaceholderLogin')}
/>
</div>
{error && <p className="text-destructive text-xs">{error}</p>}
<Button type="submit" className="w-full" disabled={busy || !email || !password}>
- {busy ? (isSetup ? 'Creating…' : 'Signing in…') : isSetup ? 'Create account' : 'Sign in'}
+ {busy ? (isSetup ? t('auth.creating') : t('auth.signingIn')) : isSetup ? t('auth.createAccount') : t('auth.signIn')}
</Button>
</form>
</div>
@@ -92,6 +94,7 @@ function AuthForm({ mode, onAuthed }: { mode: 'setup' | 'login'; onAuthed: () =>
}
export function AuthGate({ children }: { children: ReactNode }) {
+ const { t } = useI18n()
const queryClient = useQueryClient()
const { data, isLoading, isError, refetch } = useQuery<AuthStatus>({
queryKey: ['auth-status'],
@@ -111,7 +114,7 @@ export function AuthGate({ children }: { children: ReactNode }) {
refetch()
}
- if (isLoading) return <Centered><p className="text-sm text-muted-foreground text-center">Loading…</p></Centered>
+ if (isLoading) return <Centered><p className="text-sm text-muted-foreground text-center">{t('auth.loading')}</p></Centered>
if (isError || !data) {
return (
<Centered>
diff --git a/client/src/components/models-tabs.tsx b/client/src/components/models-tabs.tsx
index 2d56801c..77a77c7f 100644
--- a/client/src/components/models-tabs.tsx
+++ b/client/src/components/models-tabs.tsx
@@ -1,18 +1,20 @@
import { NavLink } from 'react-router-dom'
+import { useI18n } from '@/i18n'
// Segmented Chat | Embeddings switcher shared by the two Models pages.
// Industry-standard layout: one "Models" section, modality as a tab — chat
// routing (cross-model fallback) and embeddings routing (same-model,
// cross-provider fallback) are different machines behind one roof.
export function ModelsTabs() {
+ const { t } = useI18n()
const tab = (isActive: boolean) =>
`px-3 py-1.5 text-xs rounded-lg transition-colors ${
isActive ? 'bg-foreground text-background font-medium' : 'text-muted-foreground hover:text-foreground hover:bg-muted'
}`
return (
<div className="inline-flex gap-1 rounded-xl border p-1">
- <NavLink to="/models/chat" className={({ isActive }) => tab(isActive)}>Chat models</NavLink>
- <NavLink to="/models/embeddings" className={({ isActive }) => tab(isActive)}>Embeddings</NavLink>
+ <NavLink to="/models/chat" className={({ isActive }) => tab(isActive)}>{t('models.chatModelsTab')}</NavLink>
+ <NavLink to="/models/embeddings" className={({ isActive }) => tab(isActive)}>{t('models.embeddingsTab')}</NavLink>
</div>
)
}
diff --git a/client/src/i18n/I18nProvider.tsx b/client/src/i18n/I18nProvider.tsx
new file mode 100644
index 00000000..13a8f739
--- /dev/null
+++ b/client/src/i18n/I18nProvider.tsx
@@ -0,0 +1,166 @@
+/**
+ * Lightweight i18n for the dashboard.
+ *
+ * - Zero external dependencies (no react-i18next, no Intl polyfills)
+ * - Locale data is imported as JSON (en, zh-CN) — adding a new locale is a
+ * single file under `locales/` plus a registration in `LOCALES` below.
+ * - Locale preference is persisted in `localStorage` under
+ * `freellmapi.locale` and falls back to `navigator.language` on first visit
+ * (snapped to the closest supported locale).
+ * - The provider re-renders synchronously on `setLocale`, so all `t()` calls
+ * pick up the new strings without page reload.
+ *
+ * Translation keys use dot notation, e.g. `nav.models` or `premium.renewsOn`.
+ * `t()` does a single dotted lookup; unknown keys return the key itself
+ * rather than throwing, so partial translations degrade gracefully.
+ */
+import {
+ createContext,
+ useCallback,
+ useContext,
+ useEffect,
+ useMemo,
+ useState,
+ type ReactNode,
+} from 'react'
+
+import en from './locales/en.json'
+import zhCN from './locales/zh-CN.json'
+import fr from './locales/fr.json'
+import es from './locales/es.json'
+import ptBR from './locales/pt-BR.json'
+
+export const SUPPORTED_LOCALES = ['en', 'zh-CN', 'fr', 'es', 'pt-BR'] as const
+export type Locale = (typeof SUPPORTED_LOCALES)[number]
+
+export const DEFAULT_LOCALE: Locale = 'en'
+
+// `navigator.language` returns values like `zh`, `zh-CN`, `fr-CA`, `pt-BR`,
+// `es-419`, `en-US`. We snap to the closest supported locale (match on the
+// primary subtag) so first-visit detection is forgiving — e.g. a `zh-Hans`
+// browser still gets our `zh-CN` strings and a `pt-PT` browser gets `pt-BR`.
+function detectLocale(): Locale {
+ if (typeof window === 'undefined' || typeof navigator === 'undefined') {
+ return DEFAULT_LOCALE
+ }
+ const stored = window.localStorage.getItem('freellmapi.locale')
+ if (stored && (SUPPORTED_LOCALES as readonly string[]).includes(stored)) {
+ return stored as Locale
+ }
+ const nav = navigator.language || (navigator as { userLanguage?: string }).userLanguage || ''
+ const lower = nav.toLowerCase()
+ if (lower.startsWith('zh')) return 'zh-CN'
+ if (lower.startsWith('pt')) return 'pt-BR'
+ if (lower.startsWith('fr')) return 'fr'
+ if (lower.startsWith('es')) return 'es'
+ if (lower.startsWith('en')) return 'en'
+ return DEFAULT_LOCALE
+}
+
+type Dictionary = Record<string, unknown>
+
+const dictionaries: Record<Locale, Dictionary> = {
+ en: en as Dictionary,
+ 'zh-CN': zhCN as Dictionary,
+ fr: fr as Dictionary,
+ es: es as Dictionary,
+ 'pt-BR': ptBR as Dictionary,
+}
+
+function lookup(dict: Dictionary, key: string): unknown {
+ // Walk the dot path; return the literal key when a segment is missing so
+ // the UI never blanks out for an untranslated string.
+ const segments = key.split('.')
+ let cur: unknown = dict
+ for (const seg of segments) {
+ if (cur && typeof cur === 'object' && seg in (cur as Dictionary)) {
+ cur = (cur as Dictionary)[seg]
+ } else {
+ return undefined
+ }
+ }
+ return cur
+}
+
+function interpolate(template: string, vars?: Record<string, string | number>): string {
+ if (!vars) return template
+ return template.replace(/\{(\w+)\}/g, (_, name) => {
+ const v = vars[name]
+ return v === undefined || v === null ? `{${name}}` : String(v)
+ })
+}
+
+interface I18nContextValue {
+ locale: Locale
+ setLocale: (next: Locale) => void
+ t: (key: string, vars?: Record<string, string | number>) => string
+ /** Cycle to the next supported locale. Handy for a toggle button. */
+ toggleLocale: () => void
+}
+
+const I18nContext = createContext<I18nContextValue | null>(null)
+
+export interface I18nProviderProps {
+ children: ReactNode
+ /** Optional override for tests; defaults to the detector. */
+ initialLocale?: Locale
+}
+
+export function I18nProvider({ children, initialLocale }: I18nProviderProps) {
+ const [locale, setLocaleState] = useState<Locale>(() => initialLocale ?? detectLocale())
+
+ // Persist + keep <html lang> in sync so screen readers and CSS `:lang()` rules
+ // see the right language attribute.
+ useEffect(() => {
+ if (typeof window === 'undefined') return
+ window.localStorage.setItem('freellmapi.locale', locale)
+ document.documentElement.lang = locale
+ }, [locale])
+
+ const setLocale = useCallback((next: Locale) => {
+ if ((SUPPORTED_LOCALES as readonly string[]).includes(next)) {
+ setLocaleState(next)
+ }
+ }, [])
+
+ const toggleLocale = useCallback(() => {
+ setLocaleState((cur) => {
+ const i = SUPPORTED_LOCALES.indexOf(cur)
+ return SUPPORTED_LOCALES[(i + 1) % SUPPORTED_LOCALES.length]
+ })
+ }, [])
+
+ const value = useMemo<I18nContextValue>(() => {
+ const dict = dictionaries[locale] ?? dictionaries[DEFAULT_LOCALE]
+ return {
+ locale,
+ setLocale,
+ toggleLocale,
+ t: (key, vars) => {
+ const raw = lookup(dict, key)
+ if (typeof raw === 'string') return interpolate(raw, vars)
+ // Fallback to English so a partial zh-CN still renders something.
+ const fallback = lookup(dictionaries[DEFAULT_LOCALE], key)
+ if (typeof fallback === 'string') return interpolate(fallback, vars)
+ return key
+ },
+ }
+ }, [locale, setLocale, toggleLocale])
+
+ return <I18nContext.Provider value={value}>{children}</I18nContext.Provider>
+}
+
+export function useI18n(): I18nContextValue {
+ const ctx = useContext(I18nContext)
+ if (!ctx) {
+ // Safe default so components used outside the provider (e.g. in tests)
+ // don't throw — they just render the key strings.
+ return {
+ locale: DEFAULT_LOCALE,
+ setLocale: () => {},
+ toggleLocale: () => {},
+ t: (key) => key,
+ }
+ }
+ return ctx
+}
diff --git a/client/src/i18n/index.ts b/client/src/i18n/index.ts
new file mode 100644
index 00000000..983938f8
--- /dev/null
+++ b/client/src/i18n/index.ts
@@ -0,0 +1,8 @@
+export {
+ I18nProvider,
+ useI18n,
+ SUPPORTED_LOCALES,
+ DEFAULT_LOCALE,
+ type Locale,
+ type I18nProviderProps,
+} from './I18nProvider'
diff --git a/client/src/i18n/locales/en.json b/client/src/i18n/locales/en.json
new file mode 100644
index 00000000..c8560399
--- /dev/null
+++ b/client/src/i18n/locales/en.json
@@ -0,0 +1,252 @@
+{
+ "nav": {
+ "models": "Models",
+ "playground": "Playground",
+ "keys": "Keys",
+ "analytics": "Analytics",
+ "premium": "Premium",
+ "signOut": "Sign out",
+ "openMenu": "Open navigation menu",
+ "theme": "Theme",
+ "switchLight": "Switch to light theme",
+ "switchDark": "Switch to dark theme",
+ "language": "Change language",
+ "switchToChinese": "Switch to Chinese",
+ "switchToEnglish": "Switch to English"
+ },
+ "auth": {
+ "createYourAccount": "Create your account",
+ "signIn": "Sign in",
+ "email": "Email",
+ "password": "Password",
+ "emailPlaceholder": "[email protected]",
+ "passwordPlaceholderSetup": "at least 8 characters",
+ "passwordPlaceholderLogin": "your password",
+ "setupDescription": "Set the email and password that will protect this dashboard.",
+ "loginDescription": "Sign in to manage your keys, routing, and analytics.",
+ "createAccount": "Create account",
+ "creating": "Creating…",
+ "signingIn": "Signing in…",
+ "loading": "Loading…",
+ "serverUnreachable": "Can't reach the server. Make sure the backend is running (npm run dev).",
+ "newPasswordAutoComplete": "new-password",
+ "currentPasswordAutoComplete": "current-password"
+ },
+ "common": {
+ "save": "Save",
+ "saving": "Saving…",
+ "cancel": "Cancel",
+ "discard": "Discard",
+ "delete": "Delete",
+ "confirm": "Confirm",
+ "copy": "Copy",
+ "copied": "Copied",
+ "show": "Show",
+ "hide": "Hide",
+ "apply": "Apply",
+ "applied": "Applied",
+ "applying": "Applying…",
+ "active": "Active",
+ "inactive": "Inactive",
+ "never": "never",
+ "loading": "Loading…",
+ "error": "Error",
+ "noData": "No data yet"
+ },
+ "models": {
+ "title": "Models",
+ "chatModelsTab": "Chat models",
+ "embeddingsTab": "Embeddings",
+ "monthlyTokenBudget": "Monthly token budget",
+ "remaining": "remaining",
+ "of": "of",
+ "showAllModels": "Show all {count} models",
+ "showLess": "Show less",
+ "vision": "Vision",
+ "visionTitle": "Accepts image input",
+ "tools": "Tools",
+ "toolsTitle": "Emits structured tool calls, so it is eligible for tool-bearing requests",
+ "penalty": "−{value} penalty",
+ "obs": "{count} obs",
+ "tokPerMonth": "{count} tok/mo",
+ "rpmLimit": "{count} rpm",
+ "rpdLimit": "{count} rpd",
+ "noKey": "no key",
+ "dragToReorder": "Drag to reorder"
+ },
+ "strategies": {
+ "title": "Routing strategy",
+ "description": "Pick how the router orders your fallback chain. Manual is the order you set; the rest are bandit strategies that learn from live traffic.",
+ "manual": "Manual",
+ "manualBlurb": "Route in the exact order you set below. Drag the handles to reorder. No scoring; the chain is followed top-to-bottom.",
+ "balanced": "Balanced",
+ "balancedBlurb": "Reliability leads (50%), with speed and intelligence weighted equally (25% each). A sensible all-round default.",
+ "smartest": "Smartest",
+ "smartestBlurb": "Prefer the most capable model that still works. Intelligence 55%, reliability 35%, speed 10%.",
+ "fastest": "Fastest",
+ "fastestBlurb": "Prefer the fastest model that still works. Speed 55%, reliability 35%, intelligence 10%.",
+ "reliable": "Most reliable",
+ "reliableBlurb": "Maximize success rate above all. Reliability 70%, speed and intelligence 15% each.",
+ "custom": "Custom",
+ "customBlurb": "Set your own balance of reliability, speed and intelligence with sliders. Same engine as the presets, just your weights.",
+ "adjust": "Adjust",
+ "customWeights": "Custom weights",
+ "customWeightsHelp": "Sliders are independent; shares auto-balance to 100%.",
+ "weightReliability": "Reliability",
+ "weightSpeed": "Speed",
+ "weightIntelligence": "Intelligence",
+ "weightRequired": "At least one weight must be above zero.",
+ "scoreColumn": "Score"
+ },
+ "keys": {
+ "pageTitle": "Keys",
+ "pageDescription": "Add and rotate the API keys for each free-tier provider. Stored encrypted with AES-256-GCM.",
+ "unifiedKey": "Your unified API key",
+ "unifiedKeyDescription": "Use this as your OpenAI api_key; it authenticates requests to this proxy.",
+ "regenerate": "Regenerate",
+ "showKey": "Show",
+ "hideKey": "Hide",
+ "copyKey": "Copy",
+ "copiedKey": "Copied",
+ "baseUrl": "Base URL",
+ "endpointChat": "Chat",
+ "endpointResponses": "Responses",
+ "endpointEmbeddings": "Embeddings",
+ "endpointEmbeddingsHint": "model: \"auto\" or a family from the Embeddings tab",
+ "selectPlatform": "Select a provider",
+ "addKey": "Add key",
+ "adding": "Adding…",
+ "selectProvider": "Select a provider…",
+ "accountId": "Account ID",
+ "label": "Label",
+ "noKeyNeeded": "(no key needed)",
+ "outboundProxy": "Outbound proxy",
+ "outboundProxyDescription": "Route outbound LLM requests through a proxy. Supports SOCKS5, HTTP, and HTTPS.",
+ "proxyUrl": "Proxy URL",
+ "saveProxy": "Save",
+ "savingProxy": "Saving…",
+ "proxyLoadFailed": "Could not load proxy settings.",
+ "proxyEnvHint": "Also configurable via the PROXY_URL environment variable (takes precedence). Leave blank to disable.",
+ "addCustom": "Add a custom OpenAI-compatible model",
+ "addCustomDescription": "Point at any OpenAI-compatible endpoint: llama.cpp, LM Studio, vLLM, a local Ollama, or a remote gateway.",
+ "customBaseUrl": "Base URL",
+ "customModels": "Models",
+ "customDisplayName": "Display name",
+ "customDisplayNamePerModel": "per-model",
+ "customDisplayNameOptional": "optional",
+ "customApiKey": "API key",
+ "addModel": "Add model",
+ "addModels": "Add {count} models",
+ "addingCustom": "Adding…",
+ "getApiKey": "Get API key",
+ "deleteKeyConfirm": "Delete this key? This cannot be undone.",
+ "checkAll": "Check all",
+ "checking": "Checking…",
+ "editLabel": "Edit label",
+ "saveLabel": "Save label"
+ },
+ "status": {
+ "healthy": "healthy",
+ "rateLimited": "rate-limited",
+ "invalid": "invalid",
+ "error": "error",
+ "unchecked": "unchecked"
+ },
+ "analytics": {
+ "title": "Analytics",
+ "description": "Request volume, latency, token usage, and failures.",
+ "range24h": "24h",
+ "range7d": "7d",
+ "range30d": "30d",
+ "requests": "Requests",
+ "successRate": "Success rate",
+ "inputTokens": "Input tokens",
+ "outputTokens": "Output tokens",
+ "avgLatency": "Avg latency",
+ "estSavings": "Est. savings",
+ "requestsByProvider": "Requests by provider",
+ "avgLatencyByProvider": "Avg latency by provider",
+ "requestsOverTime": "Requests over time",
+ "byModel": "By model",
+ "byPlatform": "By platform",
+ "errors": "Errors",
+ "errorDistribution": "Error distribution",
+ "pinnedRequests": "Pinned requests",
+ "pinnedHonored": "Honored",
+ "fallbackAttempts": "Fallback attempts",
+ "savingsHint": "You actually saved ${actual} over the last {range}. That is what the same tokens would have cost on paid APIs, priced per model. The number shown projects your pace from the last {span} of data to a full 30 days."
+ },
+ "playground": {
+ "title": "Playground",
+ "description": "Send a chat completion through the router and see which provider serves it.",
+ "autoModel": "Auto (fallback chain)",
+ "send": "Send",
+ "sending": "Sending…",
+ "clear": "Clear",
+ "inputPlaceholder": "Type a message… (⏎ to send, ⇧⏎ for newline)",
+ "emptyTitle": "Send a message to get started.",
+ "emptyDescription": "Using {model}. Switch models in the selector above.",
+ "noModels": "No models yet. Add an API key on the Keys page to populate this list.",
+ "copyReply": "Copy reply",
+ "fallback": "fallback",
+ "fallbacks": "fallbacks",
+ "errorPrefix": "Error:"
+ },
+ "embeddings": {
+ "title": "Models",
+ "description": "Embeddings fail over within a family only: the same model served by another provider. Vectors from different models are incompatible, so the router never swaps models on you.",
+ "defaultBadge": "Default · auto",
+ "makeDefault": "Make default",
+ "moveUp": "Move up",
+ "moveDown": "Move down",
+ "usageToday": "{count} req today",
+ "usageMonth": "{count} tok this month",
+ "autoDescription": "model: \"auto\" on POST /v1/embeddings routes to the default family. Naming a family (or a provider model id) pins that family; providers inside it are tried in order.",
+ "unsavedChanges": "Unsaved changes",
+ "saveChanges": "Save changes",
+ "savingChanges": "Saving…"
+ },
+ "premium": {
+ "title": "Premium",
+ "description": "The live model catalog, on every device.",
+ "loading": "Loading…",
+ "checkForUpdates": "Check for updates",
+ "syncing": "Syncing…",
+ "catalogFeed": "Catalog feed",
+ "liveFeed": "Live feed",
+ "monthlySnapshot": "Monthly snapshot",
+ "lastChecked": "Last checked: {when}",
+ "liveDescription": "New free models, quota changes, and quirk fixes land here within hours of being shipped. The app checks automatically twice a day; nothing to do.",
+ "snapshotDescription": "Free tier: the catalog refreshes from a monthly snapshot, checked automatically twice a day. Premium switches this to the live feed, updated every 2-3 days.",
+ "lastSyncProblem": "Last sync problem: {error}",
+ "license": "License",
+ "planAnnual": "Premium Annual",
+ "planLifetime": "Premium Lifetime",
+ "expired": "Expired",
+ "inactive": "Inactive",
+ "lifetimeNote": "Lifetime license: never expires.",
+ "renewsOn": "Renews on {date}.",
+ "willNotRenew": "Will not renew. Premium until {date}, then this install falls back to the free monthly catalog.",
+ "keyInactive": "This key is no longer active. The app keeps working on the free monthly catalog.",
+ "manageSubscription": "Manage subscription",
+ "openingPortal": "Opening…",
+ "removeKey": "Remove key from this device",
+ "manageHint": "Manage subscription opens Stripe's billing portal: cancel, update your card, or download invoices. Removing the key only deactivates this device; your purchase is untouched.",
+ "licenseKey": "License key",
+ "licenseKeyPlaceholder": "fla_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
+ "activate": "Activate",
+ "activating": "Activating…",
+ "keyHint": "Your key is in your purchase email and on the post-checkout page. Lost it?",
+ "recoverKey": "Recover it on the website",
+ "upsellTitle": "Go live for $19 a year",
+ "upsellDescription": "New free models the moment they exist, instead of on the 1st of the month. One key, every device. Cancel anytime; the router stays free forever.",
+ "goPremium": "Go Premium"
+ },
+ "languages": {
+ "en": "English",
+ "zh-CN": "中文 (简体)",
+ "fr": "Français",
+ "es": "Español",
+ "pt-BR": "Português (Brasil)"
+ }
+}
diff --git a/client/src/i18n/locales/es.json b/client/src/i18n/locales/es.json
new file mode 100644
index 00000000..20900f9d
--- /dev/null
+++ b/client/src/i18n/locales/es.json
@@ -0,0 +1,252 @@
+{
+ "nav": {
+ "models": "Modelos",
+ "playground": "Entorno de pruebas",
+ "keys": "Claves",
+ "analytics": "Analíticas",
+ "premium": "Premium",
+ "signOut": "Cerrar sesión",
+ "openMenu": "Abrir el menú de navegación",
+ "theme": "Tema",
+ "switchLight": "Cambiar al tema claro",
+ "switchDark": "Cambiar al tema oscuro",
+ "language": "Cambiar idioma",
+ "switchToChinese": "Cambiar a chino",
+ "switchToEnglish": "Cambiar a inglés"
+ },
+ "auth": {
+ "createYourAccount": "Crea tu cuenta",
+ "signIn": "Iniciar sesión",
+ "email": "Correo electrónico",
+ "password": "Contraseña",
+ "emailPlaceholder": "[email protected]",
+ "passwordPlaceholderSetup": "al menos 8 caracteres",
+ "passwordPlaceholderLogin": "tu contraseña",
+ "setupDescription": "Define el correo y la contraseña que protegerán este panel.",
+ "loginDescription": "Inicia sesión para gestionar tus claves, el enrutamiento y las analíticas.",
+ "createAccount": "Crear cuenta",
+ "creating": "Creando…",
+ "signingIn": "Iniciando sesión…",
+ "loading": "Cargando…",
+ "serverUnreachable": "No se puede conectar con el servidor. Asegúrate de que el backend esté en ejecución (npm run dev).",
+ "newPasswordAutoComplete": "new-password",
+ "currentPasswordAutoComplete": "current-password"
+ },
+ "common": {
+ "save": "Guardar",
+ "saving": "Guardando…",
+ "cancel": "Cancelar",
+ "discard": "Descartar",
+ "delete": "Eliminar",
+ "confirm": "Confirmar",
+ "copy": "Copiar",
+ "copied": "Copiado",
+ "show": "Mostrar",
+ "hide": "Ocultar",
+ "apply": "Aplicar",
+ "applied": "Aplicado",
+ "applying": "Aplicando…",
+ "active": "Activo",
+ "inactive": "Inactivo",
+ "never": "nunca",
+ "loading": "Cargando…",
+ "error": "Error",
+ "noData": "Aún no hay datos"
+ },
+ "models": {
+ "title": "Modelos",
+ "chatModelsTab": "Modelos de chat",
+ "embeddingsTab": "Embeddings",
+ "monthlyTokenBudget": "Presupuesto mensual de tokens",
+ "remaining": "restante",
+ "of": "de",
+ "showAllModels": "Mostrar los {count} modelos",
+ "showLess": "Mostrar menos",
+ "vision": "Visión",
+ "visionTitle": "Acepta imágenes como entrada",
+ "tools": "Herramientas",
+ "toolsTitle": "Emite llamadas a herramientas estructuradas, por lo que es apto para solicitudes con herramientas",
+ "penalty": "penalización de −{value}",
+ "obs": "{count} obs",
+ "tokPerMonth": "{count} tok/mes",
+ "rpmLimit": "{count} rpm",
+ "rpdLimit": "{count} rpd",
+ "noKey": "sin clave",
+ "dragToReorder": "Arrastra para reordenar"
+ },
+ "strategies": {
+ "title": "Estrategia de enrutamiento",
+ "description": "Elige cómo el enrutador ordena tu cadena de reserva. El modo manual sigue el orden que defines; las demás son estrategias bandit que aprenden del tráfico real.",
+ "manual": "Manual",
+ "manualBlurb": "Enrutar en el orden exacto que definas abajo. Arrastra los controles para reordenar. Sin puntuación; la cadena se sigue de arriba abajo.",
+ "balanced": "Equilibrado",
+ "balancedBlurb": "La fiabilidad va primero (50 %), con velocidad e inteligencia ponderadas por igual (25 % cada una). Un valor por defecto sensato y versátil.",
+ "smartest": "El más inteligente",
+ "smartestBlurb": "Prefiere el modelo más capaz que siga funcionando. Inteligencia 55 %, fiabilidad 35 %, velocidad 10 %.",
+ "fastest": "El más rápido",
+ "fastestBlurb": "Prefiere el modelo más rápido que siga funcionando. Velocidad 55 %, fiabilidad 35 %, inteligencia 10 %.",
+ "reliable": "El más fiable",
+ "reliableBlurb": "Maximizar la tasa de éxito por encima de todo. Fiabilidad 70 %, velocidad e inteligencia 15 % cada una.",
+ "custom": "Personalizado",
+ "customBlurb": "Define tu propio equilibrio entre fiabilidad, velocidad e inteligencia con controles deslizantes. El mismo motor que los preajustes, pero con tus pesos.",
+ "adjust": "Ajustar",
+ "customWeights": "Pesos personalizados",
+ "customWeightsHelp": "Los controles son independientes; las proporciones se equilibran automáticamente al 100 %.",
+ "weightReliability": "Fiabilidad",
+ "weightSpeed": "Velocidad",
+ "weightIntelligence": "Inteligencia",
+ "weightRequired": "Al menos un peso debe ser mayor que cero.",
+ "scoreColumn": "Puntuación"
+ },
+ "keys": {
+ "pageTitle": "Claves",
+ "pageDescription": "Añade y rota las claves API de cada proveedor del nivel gratuito. Se almacenan cifradas con AES-256-GCM.",
+ "unifiedKey": "Tu clave API unificada",
+ "unifiedKeyDescription": "Úsala como tu api_key de OpenAI; autentica las solicitudes a este proxy.",
+ "regenerate": "Regenerar",
+ "showKey": "Mostrar",
+ "hideKey": "Ocultar",
+ "copyKey": "Copiar",
+ "copiedKey": "Copiado",
+ "baseUrl": "URL base",
+ "endpointChat": "Chat",
+ "endpointResponses": "Responses",
+ "endpointEmbeddings": "Embeddings",
+ "endpointEmbeddingsHint": "model: «auto» o una familia de la pestaña Embeddings",
+ "selectPlatform": "Selecciona un proveedor",
+ "addKey": "Añadir clave",
+ "adding": "Añadiendo…",
+ "selectProvider": "Selecciona un proveedor…",
+ "accountId": "ID de cuenta",
+ "label": "Etiqueta",
+ "noKeyNeeded": "(no se necesita clave)",
+ "outboundProxy": "Proxy de salida",
+ "outboundProxyDescription": "Enruta las solicitudes LLM salientes a través de un proxy. Compatible con SOCKS5, HTTP y HTTPS.",
+ "proxyUrl": "URL del proxy",
+ "saveProxy": "Guardar",
+ "savingProxy": "Guardando…",
+ "proxyLoadFailed": "No se pudieron cargar los ajustes del proxy.",
+ "proxyEnvHint": "También configurable mediante la variable de entorno PROXY_URL (tiene prioridad). Déjalo en blanco para desactivar.",
+ "addCustom": "Añadir un modelo personalizado compatible con OpenAI",
+ "addCustomDescription": "Apunta a cualquier endpoint compatible con OpenAI: llama.cpp, LM Studio, vLLM, un Ollama local o una pasarela remota.",
+ "customBaseUrl": "URL base",
+ "customModels": "Modelos",
+ "customDisplayName": "Nombre visible",
+ "customDisplayNamePerModel": "por modelo",
+ "customDisplayNameOptional": "opcional",
+ "customApiKey": "Clave API",
+ "addModel": "Añadir modelo",
+ "addModels": "Añadir {count} modelos",
+ "addingCustom": "Añadiendo…",
+ "getApiKey": "Obtener clave API",
+ "deleteKeyConfirm": "¿Eliminar esta clave? No se puede deshacer.",
+ "checkAll": "Comprobar todo",
+ "checking": "Comprobando…",
+ "editLabel": "Editar etiqueta",
+ "saveLabel": "Guardar etiqueta"
+ },
+ "status": {
+ "healthy": "correcto",
+ "rateLimited": "limitado",
+ "invalid": "no válido",
+ "error": "error",
+ "unchecked": "sin comprobar"
+ },
+ "analytics": {
+ "title": "Analíticas",
+ "description": "Volumen de solicitudes, latencia, consumo de tokens y fallos.",
+ "range24h": "24 h",
+ "range7d": "7 d",
+ "range30d": "30 d",
+ "requests": "Solicitudes",
+ "successRate": "Tasa de éxito",
+ "inputTokens": "Tokens de entrada",
+ "outputTokens": "Tokens de salida",
+ "avgLatency": "Latencia media",
+ "estSavings": "Ahorro est.",
+ "requestsByProvider": "Solicitudes por proveedor",
+ "avgLatencyByProvider": "Latencia media por proveedor",
+ "requestsOverTime": "Solicitudes a lo largo del tiempo",
+ "byModel": "Por modelo",
+ "byPlatform": "Por plataforma",
+ "errors": "Errores",
+ "errorDistribution": "Distribución de errores",
+ "pinnedRequests": "Solicitudes fijadas",
+ "pinnedHonored": "Respetadas",
+ "fallbackAttempts": "Intentos de reserva",
+ "savingsHint": "Realmente ahorraste {actual} $ en los últimos {range}. Eso es lo que los mismos tokens habrían costado en APIs de pago, con precio por modelo. La cifra mostrada proyecta tu ritmo de los {span} de datos más recientes a 30 días completos."
+ },
+ "playground": {
+ "title": "Entorno de pruebas",
+ "description": "Envía una finalización de chat a través del enrutador y observa qué proveedor la atiende.",
+ "autoModel": "Auto (cadena de reserva)",
+ "send": "Enviar",
+ "sending": "Enviando…",
+ "clear": "Limpiar",
+ "inputPlaceholder": "Escribe un mensaje… (⏎ para enviar, ⇧⏎ para nueva línea)",
+ "emptyTitle": "Envía un mensaje para empezar.",
+ "emptyDescription": "Usando {model}. Cambia de modelo en el selector de arriba.",
+ "noModels": "Aún no hay modelos. Añade una clave API en la página Claves para llenar esta lista.",
+ "copyReply": "Copiar respuesta",
+ "fallback": "reserva",
+ "fallbacks": "reservas",
+ "errorPrefix": "Error:"
+ },
+ "embeddings": {
+ "title": "Modelos",
+ "description": "Los embeddings solo conmutan dentro de una misma familia: el mismo modelo servido por otro proveedor. Los vectores de modelos distintos son incompatibles, por lo que el enrutador nunca cambia de modelo a tus espaldas.",
+ "defaultBadge": "Predeterminado · auto",
+ "makeDefault": "Establecer como predeterminado",
+ "moveUp": "Subir",
+ "moveDown": "Bajar",
+ "usageToday": "{count} sol. hoy",
+ "usageMonth": "{count} tok este mes",
+ "autoDescription": "model: «auto» en POST /v1/embeddings enruta a la familia predeterminada. Nombrar una familia (o un id de modelo de proveedor) fija esa familia; los proveedores dentro de ella se prueban en orden.",
+ "unsavedChanges": "Cambios sin guardar",
+ "saveChanges": "Guardar cambios",
+ "savingChanges": "Guardando…"
+ },
+ "premium": {
+ "title": "Premium",
+ "description": "El catálogo de modelos en vivo, en todos tus dispositivos.",
+ "loading": "Cargando…",
+ "checkForUpdates": "Buscar actualizaciones",
+ "syncing": "Sincronizando…",
+ "catalogFeed": "Fuente del catálogo",
+ "liveFeed": "Fuente en vivo",
+ "monthlySnapshot": "Instantánea mensual",
+ "lastChecked": "Última comprobación: {when}",
+ "liveDescription": "Los nuevos modelos gratuitos, los cambios de cuota y las correcciones llegan aquí pocas horas después de publicarse. La aplicación comprueba automáticamente dos veces al día; no hay nada que hacer.",
+ "snapshotDescription": "Nivel gratuito: el catálogo se actualiza desde una instantánea mensual, comprobada automáticamente dos veces al día. Premium cambia esto a la fuente en vivo, actualizada cada 2 o 3 días.",
+ "lastSyncProblem": "Problema en la última sincronización: {error}",
+ "license": "Licencia",
+ "planAnnual": "Premium Anual",
+ "planLifetime": "Premium de por vida",
+ "expired": "Caducada",
+ "inactive": "Inactiva",
+ "lifetimeNote": "Licencia de por vida: nunca caduca.",
+ "renewsOn": "Se renueva el {date}.",
+ "willNotRenew": "No se renovará. Premium hasta el {date}; después, esta instalación vuelve al catálogo mensual gratuito.",
+ "keyInactive": "Esta clave ya no está activa. La aplicación sigue funcionando con el catálogo mensual gratuito.",
+ "manageSubscription": "Gestionar suscripción",
+ "openingPortal": "Abriendo…",
+ "removeKey": "Quitar la clave de este dispositivo",
+ "manageHint": "«Gestionar suscripción» abre el portal de facturación de Stripe: cancelar, actualizar tu tarjeta o descargar facturas. Quitar la clave solo desactiva este dispositivo; tu compra permanece intacta.",
+ "licenseKey": "Clave de licencia",
+ "licenseKeyPlaceholder": "fla_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
+ "activate": "Activar",
+ "activating": "Activando…",
+ "keyHint": "Tu clave está en el correo de compra y en la página posterior al pago. ¿La perdiste?",
+ "recoverKey": "Recupérala en el sitio web",
+ "upsellTitle": "Pásate al directo por 19 $ al año",
+ "upsellDescription": "Nuevos modelos gratuitos en cuanto existen, en lugar de esperar al día 1 del mes. Una clave, todos tus dispositivos. Cancela cuando quieras; el enrutador sigue siendo gratis para siempre.",
+ "goPremium": "Hazte Premium"
+ },
+ "languages": {
+ "en": "English",
+ "zh-CN": "中文 (简体)",
+ "fr": "Français",
+ "es": "Español",
+ "pt-BR": "Português (Brasil)"
+ }
+}
diff --git a/client/src/i18n/locales/fr.json b/client/src/i18n/locales/fr.json
new file mode 100644
index 00000000..068ce9c3
--- /dev/null
+++ b/client/src/i18n/locales/fr.json
@@ -0,0 +1,252 @@
+{
+ "nav": {
+ "models": "Modèles",
+ "playground": "Bac à sable",
+ "keys": "Clés",
+ "analytics": "Analytique",
+ "premium": "Premium",
+ "signOut": "Se déconnecter",
+ "openMenu": "Ouvrir le menu de navigation",
+ "theme": "Thème",
+ "switchLight": "Passer au thème clair",
+ "switchDark": "Passer au thème sombre",
+ "language": "Changer de langue",
+ "switchToChinese": "Passer au chinois",
+ "switchToEnglish": "Passer à l'anglais"
+ },
+ "auth": {
+ "createYourAccount": "Créez votre compte",
+ "signIn": "Se connecter",
+ "email": "E-mail",
+ "password": "Mot de passe",
+ "emailPlaceholder": "[email protected]",
+ "passwordPlaceholderSetup": "au moins 8 caractères",
+ "passwordPlaceholderLogin": "votre mot de passe",
+ "setupDescription": "Définissez l'e-mail et le mot de passe qui protégeront ce tableau de bord.",
+ "loginDescription": "Connectez-vous pour gérer vos clés, le routage et l'analytique.",
+ "createAccount": "Créer un compte",
+ "creating": "Création…",
+ "signingIn": "Connexion…",
+ "loading": "Chargement…",
+ "serverUnreachable": "Impossible de joindre le serveur. Vérifiez que le backend est démarré (npm run dev).",
+ "newPasswordAutoComplete": "new-password",
+ "currentPasswordAutoComplete": "current-password"
+ },
+ "common": {
+ "save": "Enregistrer",
+ "saving": "Enregistrement…",
+ "cancel": "Annuler",
+ "discard": "Abandonner",
+ "delete": "Supprimer",
+ "confirm": "Confirmer",
+ "copy": "Copier",
+ "copied": "Copié",
+ "show": "Afficher",
+ "hide": "Masquer",
+ "apply": "Appliquer",
+ "applied": "Appliqué",
+ "applying": "Application…",
+ "active": "Actif",
+ "inactive": "Inactif",
+ "never": "jamais",
+ "loading": "Chargement…",
+ "error": "Erreur",
+ "noData": "Aucune donnée pour l'instant"
+ },
+ "models": {
+ "title": "Modèles",
+ "chatModelsTab": "Modèles de chat",
+ "embeddingsTab": "Embeddings",
+ "monthlyTokenBudget": "Budget mensuel de tokens",
+ "remaining": "restant",
+ "of": "sur",
+ "showAllModels": "Afficher les {count} modèles",
+ "showLess": "Afficher moins",
+ "vision": "Vision",
+ "visionTitle": "Accepte les images en entrée",
+ "tools": "Outils",
+ "toolsTitle": "Émet des appels d'outils structurés, il est donc éligible aux requêtes avec outils",
+ "penalty": "pénalité de −{value}",
+ "obs": "{count} obs",
+ "tokPerMonth": "{count} tok/mois",
+ "rpmLimit": "{count} rpm",
+ "rpdLimit": "{count} rpd",
+ "noKey": "aucune clé",
+ "dragToReorder": "Glisser pour réordonner"
+ },
+ "strategies": {
+ "title": "Stratégie de routage",
+ "description": "Choisissez comment le routeur ordonne votre chaîne de repli. Le mode manuel suit l'ordre que vous définissez ; les autres sont des stratégies bandit qui apprennent du trafic réel.",
+ "manual": "Manuel",
+ "manualBlurb": "Routage dans l'ordre exact que vous définissez ci-dessous. Glissez les poignées pour réordonner. Aucun score ; la chaîne est suivie de haut en bas.",
+ "balanced": "Équilibré",
+ "balancedBlurb": "La fiabilité prime (50 %), la vitesse et l'intelligence étant pondérées à parts égales (25 % chacune). Un choix par défaut polyvalent et raisonnable.",
+ "smartest": "Le plus intelligent",
+ "smartestBlurb": "Préférer le modèle le plus capable qui fonctionne encore. Intelligence 55 %, fiabilité 35 %, vitesse 10 %.",
+ "fastest": "Le plus rapide",
+ "fastestBlurb": "Préférer le modèle le plus rapide qui fonctionne encore. Vitesse 55 %, fiabilité 35 %, intelligence 10 %.",
+ "reliable": "Le plus fiable",
+ "reliableBlurb": "Maximiser le taux de réussite avant tout. Fiabilité 70 %, vitesse et intelligence 15 % chacune.",
+ "custom": "Personnalisé",
+ "customBlurb": "Définissez votre propre équilibre entre fiabilité, vitesse et intelligence à l'aide de curseurs. Le même moteur que les préréglages, avec vos pondérations.",
+ "adjust": "Ajuster",
+ "customWeights": "Pondérations personnalisées",
+ "customWeightsHelp": "Les curseurs sont indépendants ; les parts s'équilibrent automatiquement à 100 %.",
+ "weightReliability": "Fiabilité",
+ "weightSpeed": "Vitesse",
+ "weightIntelligence": "Intelligence",
+ "weightRequired": "Au moins une pondération doit être supérieure à zéro.",
+ "scoreColumn": "Score"
+ },
+ "keys": {
+ "pageTitle": "Clés",
+ "pageDescription": "Ajoutez et renouvelez les clés API de chaque fournisseur en offre gratuite. Stockées chiffrées avec AES-256-GCM.",
+ "unifiedKey": "Votre clé API unifiée",
+ "unifiedKeyDescription": "Utilisez-la comme api_key OpenAI ; elle authentifie les requêtes vers ce proxy.",
+ "regenerate": "Régénérer",
+ "showKey": "Afficher",
+ "hideKey": "Masquer",
+ "copyKey": "Copier",
+ "copiedKey": "Copié",
+ "baseUrl": "URL de base",
+ "endpointChat": "Chat",
+ "endpointResponses": "Responses",
+ "endpointEmbeddings": "Embeddings",
+ "endpointEmbeddingsHint": "model : « auto » ou une famille de l'onglet Embeddings",
+ "selectPlatform": "Sélectionner un fournisseur",
+ "addKey": "Ajouter une clé",
+ "adding": "Ajout…",
+ "selectProvider": "Sélectionner un fournisseur…",
+ "accountId": "ID de compte",
+ "label": "Libellé",
+ "noKeyNeeded": "(aucune clé requise)",
+ "outboundProxy": "Proxy sortant",
+ "outboundProxyDescription": "Acheminer les requêtes LLM sortantes via un proxy. Prend en charge SOCKS5, HTTP et HTTPS.",
+ "proxyUrl": "URL du proxy",
+ "saveProxy": "Enregistrer",
+ "savingProxy": "Enregistrement…",
+ "proxyLoadFailed": "Impossible de charger les paramètres du proxy.",
+ "proxyEnvHint": "Également configurable via la variable d'environnement PROXY_URL (prioritaire). Laissez vide pour désactiver.",
+ "addCustom": "Ajouter un modèle personnalisé compatible OpenAI",
+ "addCustomDescription": "Pointez vers n'importe quel endpoint compatible OpenAI : llama.cpp, LM Studio, vLLM, un Ollama local ou une passerelle distante.",
+ "customBaseUrl": "URL de base",
+ "customModels": "Modèles",
+ "customDisplayName": "Nom affiché",
+ "customDisplayNamePerModel": "par modèle",
+ "customDisplayNameOptional": "facultatif",
+ "customApiKey": "Clé API",
+ "addModel": "Ajouter un modèle",
+ "addModels": "Ajouter {count} modèles",
+ "addingCustom": "Ajout…",
+ "getApiKey": "Obtenir une clé API",
+ "deleteKeyConfirm": "Supprimer cette clé ? Cette action est irréversible.",
+ "checkAll": "Tout vérifier",
+ "checking": "Vérification…",
+ "editLabel": "Modifier le libellé",
+ "saveLabel": "Enregistrer le libellé"
+ },
+ "status": {
+ "healthy": "sain",
+ "rateLimited": "limité",
+ "invalid": "invalide",
+ "error": "erreur",
+ "unchecked": "non vérifié"
+ },
+ "analytics": {
+ "title": "Analytique",
+ "description": "Volume de requêtes, latence, consommation de tokens et échecs.",
+ "range24h": "24 h",
+ "range7d": "7 j",
+ "range30d": "30 j",
+ "requests": "Requêtes",
+ "successRate": "Taux de réussite",
+ "inputTokens": "Tokens en entrée",
+ "outputTokens": "Tokens en sortie",
+ "avgLatency": "Latence moy.",
+ "estSavings": "Économies est.",
+ "requestsByProvider": "Requêtes par fournisseur",
+ "avgLatencyByProvider": "Latence moy. par fournisseur",
+ "requestsOverTime": "Requêtes au fil du temps",
+ "byModel": "Par modèle",
+ "byPlatform": "Par plateforme",
+ "errors": "Erreurs",
+ "errorDistribution": "Répartition des erreurs",
+ "pinnedRequests": "Requêtes épinglées",
+ "pinnedHonored": "Honorées",
+ "fallbackAttempts": "Tentatives de repli",
+ "savingsHint": "Vous avez réellement économisé {actual} $ sur les {range} derniers. C'est ce que les mêmes tokens auraient coûté sur des API payantes, tarifés par modèle. Le chiffre affiché projette votre rythme des {span} de données les plus récentes sur 30 jours complets."
+ },
+ "playground": {
+ "title": "Bac à sable",
+ "description": "Envoyez une complétion de chat via le routeur et voyez quel fournisseur la traite.",
+ "autoModel": "Auto (chaîne de repli)",
+ "send": "Envoyer",
+ "sending": "Envoi…",
+ "clear": "Effacer",
+ "inputPlaceholder": "Tapez un message… (⏎ pour envoyer, ⇧⏎ pour un retour à la ligne)",
+ "emptyTitle": "Envoyez un message pour commencer.",
+ "emptyDescription": "Utilise {model}. Changez de modèle dans le sélecteur ci-dessus.",
+ "noModels": "Aucun modèle pour l'instant. Ajoutez une clé API sur la page Clés pour remplir cette liste.",
+ "copyReply": "Copier la réponse",
+ "fallback": "repli",
+ "fallbacks": "replis",
+ "errorPrefix": "Erreur :"
+ },
+ "embeddings": {
+ "title": "Modèles",
+ "description": "Les embeddings basculent uniquement au sein d'une même famille : le même modèle servi par un autre fournisseur. Les vecteurs de modèles différents sont incompatibles, le routeur ne change donc jamais de modèle à votre insu.",
+ "defaultBadge": "Par défaut · auto",
+ "makeDefault": "Définir par défaut",
+ "moveUp": "Monter",
+ "moveDown": "Descendre",
+ "usageToday": "{count} req aujourd'hui",
+ "usageMonth": "{count} tok ce mois-ci",
+ "autoDescription": "model : « auto » sur POST /v1/embeddings achemine vers la famille par défaut. Nommer une famille (ou un id de modèle de fournisseur) épingle cette famille ; les fournisseurs qu'elle contient sont essayés dans l'ordre.",
+ "unsavedChanges": "Modifications non enregistrées",
+ "saveChanges": "Enregistrer les modifications",
+ "savingChanges": "Enregistrement…"
+ },
+ "premium": {
+ "title": "Premium",
+ "description": "Le catalogue de modèles en direct, sur tous vos appareils.",
+ "loading": "Chargement…",
+ "checkForUpdates": "Vérifier les mises à jour",
+ "syncing": "Synchronisation…",
+ "catalogFeed": "Flux du catalogue",
+ "liveFeed": "Flux en direct",
+ "monthlySnapshot": "Instantané mensuel",
+ "lastChecked": "Dernière vérification : {when}",
+ "liveDescription": "Les nouveaux modèles gratuits, les changements de quota et les correctifs arrivent ici quelques heures après leur déploiement. L'application vérifie automatiquement deux fois par jour ; rien à faire.",
+ "snapshotDescription": "Offre gratuite : le catalogue se rafraîchit à partir d'un instantané mensuel, vérifié automatiquement deux fois par jour. Premium bascule sur le flux en direct, mis à jour tous les 2 à 3 jours.",
+ "lastSyncProblem": "Problème lors de la dernière synchronisation : {error}",
+ "license": "Licence",
+ "planAnnual": "Premium Annuel",
+ "planLifetime": "Premium à vie",
+ "expired": "Expiré",
+ "inactive": "Inactif",
+ "lifetimeNote": "Licence à vie : n'expire jamais.",
+ "renewsOn": "Se renouvelle le {date}.",
+ "willNotRenew": "Ne se renouvellera pas. Premium jusqu'au {date}, puis cette installation reviendra au catalogue mensuel gratuit.",
+ "keyInactive": "Cette clé n'est plus active. L'application continue de fonctionner avec le catalogue mensuel gratuit.",
+ "manageSubscription": "Gérer l'abonnement",
+ "openingPortal": "Ouverture…",
+ "removeKey": "Retirer la clé de cet appareil",
+ "manageHint": "« Gérer l'abonnement » ouvre le portail de facturation Stripe : annuler, mettre à jour votre carte ou télécharger vos factures. Retirer la clé ne désactive que cet appareil ; votre achat reste intact.",
+ "licenseKey": "Clé de licence",
+ "licenseKeyPlaceholder": "fla_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
+ "activate": "Activer",
+ "activating": "Activation…",
+ "keyHint": "Votre clé figure dans votre e-mail d'achat et sur la page de confirmation. Égarée ?",
+ "recoverKey": "Récupérez-la sur le site web",
+ "upsellTitle": "Passez en direct pour 19 $ par an",
+ "upsellDescription": "De nouveaux modèles gratuits dès leur sortie, au lieu du 1er du mois. Une seule clé, tous vos appareils. Annulable à tout moment ; le routeur reste gratuit pour toujours.",
+ "goPremium": "Passer à Premium"
+ },
+ "languages": {
+ "en": "English",
+ "zh-CN": "中文 (简体)",
+ "fr": "Français",
+ "es": "Español",
+ "pt-BR": "Português (Brasil)"
+ }
+}
diff --git a/client/src/i18n/locales/pt-BR.json b/client/src/i18n/locales/pt-BR.json
new file mode 100644
index 00000000..4ffa8674
--- /dev/null
+++ b/client/src/i18n/locales/pt-BR.json
@@ -0,0 +1,252 @@
+{
+ "nav": {
+ "models": "Modelos",
+ "playground": "Playground",
+ "keys": "Chaves",
+ "analytics": "Análises",
+ "premium": "Premium",
+ "signOut": "Sair",
+ "openMenu": "Abrir o menu de navegação",
+ "theme": "Tema",
+ "switchLight": "Mudar para o tema claro",
+ "switchDark": "Mudar para o tema escuro",
+ "language": "Alterar idioma",
+ "switchToChinese": "Mudar para chinês",
+ "switchToEnglish": "Mudar para inglês"
+ },
+ "auth": {
+ "createYourAccount": "Crie sua conta",
+ "signIn": "Entrar",
+ "email": "E-mail",
+ "password": "Senha",
+ "emailPlaceholder": "[email protected]",
+ "passwordPlaceholderSetup": "no mínimo 8 caracteres",
+ "passwordPlaceholderLogin": "sua senha",
+ "setupDescription": "Defina o e-mail e a senha que protegerão este painel.",
+ "loginDescription": "Entre para gerenciar suas chaves, o roteamento e as análises.",
+ "createAccount": "Criar conta",
+ "creating": "Criando…",
+ "signingIn": "Entrando…",
+ "loading": "Carregando…",
+ "serverUnreachable": "Não foi possível acessar o servidor. Verifique se o backend está em execução (npm run dev).",
+ "newPasswordAutoComplete": "new-password",
+ "currentPasswordAutoComplete": "current-password"
+ },
+ "common": {
+ "save": "Salvar",
+ "saving": "Salvando…",
+ "cancel": "Cancelar",
+ "discard": "Descartar",
+ "delete": "Excluir",
+ "confirm": "Confirmar",
+ "copy": "Copiar",
+ "copied": "Copiado",
+ "show": "Mostrar",
+ "hide": "Ocultar",
+ "apply": "Aplicar",
+ "applied": "Aplicado",
+ "applying": "Aplicando…",
+ "active": "Ativo",
+ "inactive": "Inativo",
+ "never": "nunca",
+ "loading": "Carregando…",
+ "error": "Erro",
+ "noData": "Ainda não há dados"
+ },
+ "models": {
+ "title": "Modelos",
+ "chatModelsTab": "Modelos de chat",
+ "embeddingsTab": "Embeddings",
+ "monthlyTokenBudget": "Orçamento mensal de tokens",
+ "remaining": "restante",
+ "of": "de",
+ "showAllModels": "Mostrar os {count} modelos",
+ "showLess": "Mostrar menos",
+ "vision": "Visão",
+ "visionTitle": "Aceita imagens como entrada",
+ "tools": "Ferramentas",
+ "toolsTitle": "Emite chamadas de ferramentas estruturadas, por isso é elegível para solicitações com ferramentas",
+ "penalty": "penalidade de −{value}",
+ "obs": "{count} obs",
+ "tokPerMonth": "{count} tok/mês",
+ "rpmLimit": "{count} rpm",
+ "rpdLimit": "{count} rpd",
+ "noKey": "sem chave",
+ "dragToReorder": "Arraste para reordenar"
+ },
+ "strategies": {
+ "title": "Estratégia de roteamento",
+ "description": "Escolha como o roteador ordena sua cadeia de fallback. O modo manual segue a ordem que você define; os demais são estratégias bandit que aprendem com o tráfego real.",
+ "manual": "Manual",
+ "manualBlurb": "Roteia na ordem exata que você definir abaixo. Arraste as alças para reordenar. Sem pontuação; a cadeia é seguida de cima para baixo.",
+ "balanced": "Equilibrado",
+ "balancedBlurb": "A confiabilidade vem primeiro (50%), com velocidade e inteligência ponderadas igualmente (25% cada). Um padrão sensato e versátil.",
+ "smartest": "Mais inteligente",
+ "smartestBlurb": "Prefere o modelo mais capaz que ainda funcione. Inteligência 55%, confiabilidade 35%, velocidade 10%.",
+ "fastest": "Mais rápido",
+ "fastestBlurb": "Prefere o modelo mais rápido que ainda funcione. Velocidade 55%, confiabilidade 35%, inteligência 10%.",
+ "reliable": "Mais confiável",
+ "reliableBlurb": "Maximizar a taxa de sucesso acima de tudo. Confiabilidade 70%, velocidade e inteligência 15% cada.",
+ "custom": "Personalizado",
+ "customBlurb": "Defina seu próprio equilíbrio entre confiabilidade, velocidade e inteligência com controles deslizantes. O mesmo motor das predefinições, mas com seus pesos.",
+ "adjust": "Ajustar",
+ "customWeights": "Pesos personalizados",
+ "customWeightsHelp": "Os controles são independentes; as proporções se equilibram automaticamente em 100%.",
+ "weightReliability": "Confiabilidade",
+ "weightSpeed": "Velocidade",
+ "weightIntelligence": "Inteligência",
+ "weightRequired": "Pelo menos um peso deve ser maior que zero.",
+ "scoreColumn": "Pontuação"
+ },
+ "keys": {
+ "pageTitle": "Chaves",
+ "pageDescription": "Adicione e renove as chaves de API de cada provedor do nível gratuito. Armazenadas com criptografia AES-256-GCM.",
+ "unifiedKey": "Sua chave de API unificada",
+ "unifiedKeyDescription": "Use-a como sua api_key da OpenAI; ela autentica as solicitações a este proxy.",
+ "regenerate": "Regenerar",
+ "showKey": "Mostrar",
+ "hideKey": "Ocultar",
+ "copyKey": "Copiar",
+ "copiedKey": "Copiado",
+ "baseUrl": "URL base",
+ "endpointChat": "Chat",
+ "endpointResponses": "Responses",
+ "endpointEmbeddings": "Embeddings",
+ "endpointEmbeddingsHint": "model: \"auto\" ou uma família da aba Embeddings",
+ "selectPlatform": "Selecione um provedor",
+ "addKey": "Adicionar chave",
+ "adding": "Adicionando…",
+ "selectProvider": "Selecione um provedor…",
+ "accountId": "ID da conta",
+ "label": "Rótulo",
+ "noKeyNeeded": "(nenhuma chave necessária)",
+ "outboundProxy": "Proxy de saída",
+ "outboundProxyDescription": "Roteia as solicitações LLM de saída por um proxy. Compatível com SOCKS5, HTTP e HTTPS.",
+ "proxyUrl": "URL do proxy",
+ "saveProxy": "Salvar",
+ "savingProxy": "Salvando…",
+ "proxyLoadFailed": "Não foi possível carregar as configurações do proxy.",
+ "proxyEnvHint": "Também configurável pela variável de ambiente PROXY_URL (tem precedência). Deixe em branco para desativar.",
+ "addCustom": "Adicionar um modelo personalizado compatível com OpenAI",
+ "addCustomDescription": "Aponte para qualquer endpoint compatível com OpenAI: llama.cpp, LM Studio, vLLM, um Ollama local ou um gateway remoto.",
+ "customBaseUrl": "URL base",
+ "customModels": "Modelos",
+ "customDisplayName": "Nome de exibição",
+ "customDisplayNamePerModel": "por modelo",
+ "customDisplayNameOptional": "opcional",
+ "customApiKey": "Chave de API",
+ "addModel": "Adicionar modelo",
+ "addModels": "Adicionar {count} modelos",
+ "addingCustom": "Adicionando…",
+ "getApiKey": "Obter chave de API",
+ "deleteKeyConfirm": "Excluir esta chave? Esta ação não pode ser desfeita.",
+ "checkAll": "Verificar tudo",
+ "checking": "Verificando…",
+ "editLabel": "Editar rótulo",
+ "saveLabel": "Salvar rótulo"
+ },
+ "status": {
+ "healthy": "saudável",
+ "rateLimited": "limitado",
+ "invalid": "inválido",
+ "error": "erro",
+ "unchecked": "não verificado"
+ },
+ "analytics": {
+ "title": "Análises",
+ "description": "Volume de solicitações, latência, consumo de tokens e falhas.",
+ "range24h": "24 h",
+ "range7d": "7 d",
+ "range30d": "30 d",
+ "requests": "Solicitações",
+ "successRate": "Taxa de sucesso",
+ "inputTokens": "Tokens de entrada",
+ "outputTokens": "Tokens de saída",
+ "avgLatency": "Latência média",
+ "estSavings": "Economia est.",
+ "requestsByProvider": "Solicitações por provedor",
+ "avgLatencyByProvider": "Latência média por provedor",
+ "requestsOverTime": "Solicitações ao longo do tempo",
+ "byModel": "Por modelo",
+ "byPlatform": "Por plataforma",
+ "errors": "Erros",
+ "errorDistribution": "Distribuição de erros",
+ "pinnedRequests": "Solicitações fixadas",
+ "pinnedHonored": "Respeitadas",
+ "fallbackAttempts": "Tentativas de fallback",
+ "savingsHint": "Você economizou de fato {actual} $ nos últimos {range}. É quanto os mesmos tokens teriam custado em APIs pagas, com preço por modelo. O número exibido projeta seu ritmo dos {span} de dados mais recentes para 30 dias completos."
+ },
+ "playground": {
+ "title": "Playground",
+ "description": "Envie uma conclusão de chat pelo roteador e veja qual provedor a atende.",
+ "autoModel": "Auto (cadeia de fallback)",
+ "send": "Enviar",
+ "sending": "Enviando…",
+ "clear": "Limpar",
+ "inputPlaceholder": "Digite uma mensagem… (⏎ para enviar, ⇧⏎ para nova linha)",
+ "emptyTitle": "Envie uma mensagem para começar.",
+ "emptyDescription": "Usando {model}. Troque de modelo no seletor acima.",
+ "noModels": "Ainda não há modelos. Adicione uma chave de API na página Chaves para preencher esta lista.",
+ "copyReply": "Copiar resposta",
+ "fallback": "fallback",
+ "fallbacks": "fallbacks",
+ "errorPrefix": "Erro:"
+ },
+ "embeddings": {
+ "title": "Modelos",
+ "description": "Os embeddings fazem failover apenas dentro de uma mesma família: o mesmo modelo servido por outro provedor. Vetores de modelos diferentes são incompatíveis, então o roteador nunca troca de modelo sem você saber.",
+ "defaultBadge": "Padrão · auto",
+ "makeDefault": "Definir como padrão",
+ "moveUp": "Mover para cima",
+ "moveDown": "Mover para baixo",
+ "usageToday": "{count} sol. hoje",
+ "usageMonth": "{count} tok este mês",
+ "autoDescription": "model: \"auto\" em POST /v1/embeddings roteia para a família padrão. Nomear uma família (ou um id de modelo de provedor) fixa essa família; os provedores dentro dela são tentados em ordem.",
+ "unsavedChanges": "Alterações não salvas",
+ "saveChanges": "Salvar alterações",
+ "savingChanges": "Salvando…"
+ },
+ "premium": {
+ "title": "Premium",
+ "description": "O catálogo de modelos ao vivo, em todos os seus dispositivos.",
+ "loading": "Carregando…",
+ "checkForUpdates": "Verificar atualizações",
+ "syncing": "Sincronizando…",
+ "catalogFeed": "Feed do catálogo",
+ "liveFeed": "Feed ao vivo",
+ "monthlySnapshot": "Instantâneo mensal",
+ "lastChecked": "Última verificação: {when}",
+ "liveDescription": "Novos modelos gratuitos, mudanças de cota e correções chegam aqui poucas horas após serem lançados. O aplicativo verifica automaticamente duas vezes por dia; nada a fazer.",
+ "snapshotDescription": "Nível gratuito: o catálogo é atualizado a partir de um instantâneo mensal, verificado automaticamente duas vezes por dia. O Premium muda isso para o feed ao vivo, atualizado a cada 2 a 3 dias.",
+ "lastSyncProblem": "Problema na última sincronização: {error}",
+ "license": "Licença",
+ "planAnnual": "Premium Anual",
+ "planLifetime": "Premium Vitalício",
+ "expired": "Expirada",
+ "inactive": "Inativa",
+ "lifetimeNote": "Licença vitalícia: nunca expira.",
+ "renewsOn": "Renova em {date}.",
+ "willNotRenew": "Não será renovada. Premium até {date}; depois, esta instalação volta para o catálogo mensal gratuito.",
+ "keyInactive": "Esta chave não está mais ativa. O aplicativo continua funcionando com o catálogo mensal gratuito.",
+ "manageSubscription": "Gerenciar assinatura",
+ "openingPortal": "Abrindo…",
+ "removeKey": "Remover a chave deste dispositivo",
+ "manageHint": "\"Gerenciar assinatura\" abre o portal de faturamento da Stripe: cancelar, atualizar seu cartão ou baixar faturas. Remover a chave apenas desativa este dispositivo; sua compra permanece intacta.",
+ "licenseKey": "Chave de licença",
+ "licenseKeyPlaceholder": "fla_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
+ "activate": "Ativar",
+ "activating": "Ativando…",
+ "keyHint": "Sua chave está no e-mail de compra e na página pós-pagamento. Perdeu?",
+ "recoverKey": "Recupere-a no site",
+ "upsellTitle": "Vá para o ao vivo por US$ 19 por ano",
+ "upsellDescription": "Novos modelos gratuitos no momento em que existem, em vez de no dia 1º do mês. Uma chave, todos os dispositivos. Cancele quando quiser; o roteador continua gratuito para sempre.",
+ "goPremium": "Assinar o Premium"
+ },
+ "languages": {
+ "en": "English",
+ "zh-CN": "中文 (简体)",
+ "fr": "Français",
+ "es": "Español",
+ "pt-BR": "Português (Brasil)"
+ }
+}
diff --git a/client/src/i18n/locales/zh-CN.json b/client/src/i18n/locales/zh-CN.json
new file mode 100644
index 00000000..54f4eaca
--- /dev/null
+++ b/client/src/i18n/locales/zh-CN.json
@@ -0,0 +1,252 @@
+{
+ "nav": {
+ "models": "模型",
+ "playground": "试玩台",
+ "keys": "密钥",
+ "analytics": "分析",
+ "premium": "高级版",
+ "signOut": "退出登录",
+ "openMenu": "打开导航菜单",
+ "theme": "主题",
+ "switchLight": "切换到浅色主题",
+ "switchDark": "切换到深色主题",
+ "language": "切换语言",
+ "switchToChinese": "切换到中文",
+ "switchToEnglish": "Switch to English"
+ },
+ "auth": {
+ "createYourAccount": "创建账号",
+ "signIn": "登录",
+ "email": "邮箱",
+ "password": "密码",
+ "emailPlaceholder": "[email protected]",
+ "passwordPlaceholderSetup": "至少 8 个字符",
+ "passwordPlaceholderLogin": "您的密码",
+ "setupDescription": "设置用于保护此控制台的邮箱和密码。",
+ "loginDescription": "登录以管理您的密钥、路由和分析。",
+ "createAccount": "创建账号",
+ "creating": "创建中…",
+ "signingIn": "登录中…",
+ "loading": "加载中…",
+ "serverUnreachable": "无法连接到服务器。请确认后端正在运行(npm run dev)。",
+ "newPasswordAutoComplete": "new-password",
+ "currentPasswordAutoComplete": "current-password"
+ },
+ "common": {
+ "save": "保存",
+ "saving": "保存中…",
+ "cancel": "取消",
+ "discard": "放弃修改",
+ "delete": "删除",
+ "confirm": "确认",
+ "copy": "复制",
+ "copied": "已复制",
+ "show": "显示",
+ "hide": "隐藏",
+ "apply": "应用",
+ "applied": "已应用",
+ "applying": "应用中…",
+ "active": "已启用",
+ "inactive": "未启用",
+ "never": "从未",
+ "loading": "加载中…",
+ "error": "错误",
+ "noData": "暂无数据"
+ },
+ "models": {
+ "title": "模型",
+ "chatModelsTab": "对话模型",
+ "embeddingsTab": "嵌入模型",
+ "monthlyTokenBudget": "每月令牌额度",
+ "remaining": "剩余",
+ "of": "共",
+ "showAllModels": "显示全部 {count} 个模型",
+ "showLess": "收起",
+ "vision": "视觉",
+ "visionTitle": "支持图像输入",
+ "tools": "工具",
+ "toolsTitle": "可输出结构化工具调用,可用于带工具的请求",
+ "penalty": "−{value} 惩罚",
+ "obs": "{count} 次观察",
+ "tokPerMonth": "{count} 令牌/月",
+ "rpmLimit": "每分钟 {count} 次",
+ "rpdLimit": "每日 {count} 次",
+ "noKey": "无密钥",
+ "dragToReorder": "拖动以重新排序"
+ },
+ "strategies": {
+ "title": "路由策略",
+ "description": "选择路由器如何排列您的回退链。手动模式按您设置的顺序,其余为根据实时流量学习的策略。",
+ "manual": "手动",
+ "manualBlurb": "完全按下方设置的顺序路由。拖动手柄即可重新排序。不参与评分,按从上到下的顺序依次回退。",
+ "balanced": "均衡",
+ "balancedBlurb": "以稳定性为首(50%),速度与智能各占 25%。通用场景的合理默认。",
+ "smartest": "最智能",
+ "smartestBlurb": "在能正常工作的前提下优先选择能力最强的模型。智能 55%,稳定性 35%,速度 10%。",
+ "fastest": "最快",
+ "fastestBlurb": "在能正常工作的前提下优先选择最快的模型。速度 55%,稳定性 35%,智能 10%。",
+ "reliable": "最稳定",
+ "reliableBlurb": "把成功率放在第一位。稳定性 70%,速度与智能各占 15%。",
+ "custom": "自定义",
+ "customBlurb": "用滑块自定义稳定性、速度和智能之间的平衡。引擎与预设相同,只是权重由您决定。",
+ "adjust": "调整",
+ "customWeights": "自定义权重",
+ "customWeightsHelp": "滑块彼此独立;占比会自动平衡至 100%。",
+ "weightReliability": "稳定性",
+ "weightSpeed": "速度",
+ "weightIntelligence": "智能",
+ "weightRequired": "至少一个权重必须大于零。",
+ "scoreColumn": "评分"
+ },
+ "keys": {
+ "pageTitle": "密钥",
+ "pageDescription": "添加并轮换各个免费层提供商的 API 密钥。使用 AES-256-GCM 加密存储。",
+ "unifiedKey": "您的统一 API 密钥",
+ "unifiedKeyDescription": "将其用作 OpenAI 的 api_key 即可向本代理发起请求。",
+ "regenerate": "重新生成",
+ "showKey": "显示",
+ "hideKey": "隐藏",
+ "copyKey": "复制",
+ "copiedKey": "已复制",
+ "baseUrl": "Base URL",
+ "endpointChat": "对话",
+ "endpointResponses": "响应",
+ "endpointEmbeddings": "嵌入",
+ "endpointEmbeddingsHint": "model: \"auto\" 或「嵌入模型」标签中的系列",
+ "selectPlatform": "选择提供商",
+ "addKey": "添加密钥",
+ "adding": "添加中…",
+ "selectProvider": "请选择提供商…",
+ "accountId": "账户 ID",
+ "label": "标签",
+ "noKeyNeeded": "(无需密钥)",
+ "outboundProxy": "出站代理",
+ "outboundProxyDescription": "通过代理路由出站 LLM 请求。支持 SOCKS5、HTTP 与 HTTPS。",
+ "proxyUrl": "代理地址",
+ "saveProxy": "保存",
+ "savingProxy": "保存中…",
+ "proxyLoadFailed": "无法加载代理设置。",
+ "proxyEnvHint": "也可通过 PROXY_URL 环境变量配置(优先级更高)。留空表示禁用。",
+ "addCustom": "添加自定义 OpenAI 兼容模型",
+ "addCustomDescription": "指向任何 OpenAI 兼容端点:llama.cpp、LM Studio、vLLM、本地 Ollama 或远程网关。",
+ "customBaseUrl": "Base URL",
+ "customModels": "模型",
+ "customDisplayName": "显示名称",
+ "customDisplayNamePerModel": "按模型命名",
+ "customDisplayNameOptional": "可选",
+ "customApiKey": "API 密钥",
+ "addModel": "添加模型",
+ "addModels": "添加 {count} 个模型",
+ "addingCustom": "添加中…",
+ "getApiKey": "获取 API 密钥",
+ "deleteKeyConfirm": "确认删除此密钥?此操作无法撤销。",
+ "checkAll": "全部检查",
+ "checking": "检查中…",
+ "editLabel": "编辑标签",
+ "saveLabel": "保存标签"
+ },
+ "status": {
+ "healthy": "健康",
+ "rateLimited": "被限流",
+ "invalid": "无效",
+ "error": "错误",
+ "unchecked": "未检查"
+ },
+ "analytics": {
+ "title": "分析",
+ "description": "请求量、延迟、令牌用量与失败情况。",
+ "range24h": "24 小时",
+ "range7d": "7 天",
+ "range30d": "30 天",
+ "requests": "请求数",
+ "successRate": "成功率",
+ "inputTokens": "输入令牌",
+ "outputTokens": "输出令牌",
+ "avgLatency": "平均延迟",
+ "estSavings": "预估节省",
+ "requestsByProvider": "按提供商的请求数",
+ "avgLatencyByProvider": "按提供商的平均延迟",
+ "requestsOverTime": "请求趋势",
+ "byModel": "按模型",
+ "byPlatform": "按提供商",
+ "errors": "错误",
+ "errorDistribution": "错误分布",
+ "pinnedRequests": "固定请求",
+ "pinnedHonored": "已生效",
+ "fallbackAttempts": "回退尝试",
+ "savingsHint": "您在过去 {range} 实际节省了 ${actual},相当于按模型定价时这些令牌在付费 API 上的花费。显示的数字基于过去 {span} 的数据按比例推算到完整 30 天。"
+ },
+ "playground": {
+ "title": "试玩台",
+ "description": "通过路由器发送一次对话补全请求,看看是哪个提供商在服务。",
+ "autoModel": "自动(回退链)",
+ "send": "发送",
+ "sending": "发送中…",
+ "clear": "清空",
+ "inputPlaceholder": "输入消息…(⏎ 发送,⇧⏎ 换行)",
+ "emptyTitle": "发送消息即可开始。",
+ "emptyDescription": "正在使用 {model}。可在上方选择器中切换模型。",
+ "noModels": "暂无模型。请先在「密钥」页面添加 API 密钥。",
+ "copyReply": "复制回复",
+ "fallback": "次回退",
+ "fallbacks": "次回退",
+ "errorPrefix": "错误:"
+ },
+ "embeddings": {
+ "title": "模型",
+ "description": "嵌入模型只在同一系列内回退:同一模型由另一个提供商提供。不同模型的向量不兼容,因此路由器绝不会在请求中途切换模型。",
+ "defaultBadge": "默认 · auto",
+ "makeDefault": "设为默认",
+ "moveUp": "上移",
+ "moveDown": "下移",
+ "usageToday": "今日 {count} 次请求",
+ "usageMonth": "本月 {count} 令牌",
+ "autoDescription": "在 POST /v1/embeddings 中使用 model: \"auto\" 会路由到默认系列。指定系列名(或提供商模型 ID)会固定该系列,并按顺序尝试其中的提供商。",
+ "unsavedChanges": "有未保存的修改",
+ "saveChanges": "保存修改",
+ "savingChanges": "保存中…"
+ },
+ "premium": {
+ "title": "高级版",
+ "description": "在任何设备上获得实时模型目录。",
+ "loading": "加载中…",
+ "checkForUpdates": "检查更新",
+ "syncing": "同步中…",
+ "catalogFeed": "目录源",
+ "liveFeed": "实时源",
+ "monthlySnapshot": "月度快照",
+ "lastChecked": "上次检查:{when}",
+ "liveDescription": "新的免费模型、配额调整与缺陷修复会在发布后数小时内到达这里。应用每天自动检查两次,无需手动操作。",
+ "snapshotDescription": "免费版:目录每月从快照刷新,每天自动检查两次。高级版切换到实时源,每 2–3 天更新一次。",
+ "lastSyncProblem": "上次同步问题:{error}",
+ "license": "许可证",
+ "planAnnual": "高级版 · 年度",
+ "planLifetime": "高级版 · 终身",
+ "expired": "已过期",
+ "inactive": "未激活",
+ "lifetimeNote": "终身许可证:永不过期。",
+ "renewsOn": "将于 {date} 续费。",
+ "willNotRenew": "不会续费。高级版可用至 {date},之后此安装回退到免费月度目录。",
+ "keyInactive": "此密钥已失效。应用仍可继续使用免费月度目录。",
+ "manageSubscription": "管理订阅",
+ "openingPortal": "正在打开…",
+ "removeKey": "从本设备移除密钥",
+ "manageHint": "管理订阅会打开 Stripe 的账单门户:取消订阅、更新支付方式或下载发票。移除密钥仅停用本设备,不会影响您的购买。",
+ "licenseKey": "许可证密钥",
+ "licenseKeyPlaceholder": "fla_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
+ "activate": "激活",
+ "activating": "激活中…",
+ "keyHint": "您的密钥可在购买邮件与结账后页面找到。丢失了?",
+ "recoverKey": "在官网找回",
+ "upsellTitle": "升级为每年 19 美元的实时版",
+ "upsellDescription": "新免费模型一上线就可用,不必等到每月 1 日。一个密钥,所有设备。随时取消,路由器永远免费。",
+ "goPremium": "升级到高级版"
+ },
+ "languages": {
+ "en": "English",
+ "zh-CN": "中文 (简体)",
+ "fr": "Français",
+ "es": "Español",
+ "pt-BR": "Português (Brasil)"
+ }
+}
diff --git a/client/src/pages/AnalyticsPage.tsx b/client/src/pages/AnalyticsPage.tsx
index 07d1bb9b..6f2992fb 100644
--- a/client/src/pages/AnalyticsPage.tsx
+++ b/client/src/pages/AnalyticsPage.tsx
@@ -10,6 +10,7 @@ import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@
import { PageHeader } from '@/components/page-header'
import { Tooltip as HoverTooltip } from '@/components/tooltip'
import { formatSqliteUtcToLocalTime } from '@/lib/utils'
+import { useI18n } from '@/i18n'
type TimeRange = '24h' | '7d' | '30d'
@@ -48,6 +49,7 @@ const gridStyle = 'var(--border)'
const primaryFill = 'var(--foreground)'
export default function AnalyticsPage() {
+ const { t } = useI18n()
const [range, setRange] = useState<TimeRange>('7d')
const { data: summary } = useQuery({
@@ -105,11 +107,9 @@ export default function AnalyticsPage() {
const savings30d = extrapolated ? baseSavings * (30 / spanDays) : baseSavings
const rangeLabel = range === '24h' ? '24 hours' : range === '7d' ? '7 days' : '30 days'
const spanLabel = spanDays >= 2 ? `${Math.round(spanDays)} days` : `${Math.max(1, Math.round(spanDays * 24))} hours`
- const savingsHint =
- `You actually saved $${actualSavings.toFixed(2)} over the last ${rangeLabel}. That is what the same tokens would have cost on paid APIs, priced per model. ` +
- (extrapolated
- ? `The number shown projects your pace from the last ${spanLabel} of data to a full 30 days.`
- : `The number shown is your real 30-day total.`)
+ const savingsHint = extrapolated
+ ? t('analytics.savingsHint', { actual: actualSavings.toFixed(2), range: rangeLabel, span: spanLabel })
+ : `You actually saved $${actualSavings.toFixed(2)} over the last ${rangeLabel}. That is what the same tokens would have cost on paid APIs, priced per model. The number shown is your real 30-day total.`
// Pinned = the client named a specific model instead of auto-routing.
// Honored = that model actually served it (the rest failed over).
@@ -122,8 +122,8 @@ export default function AnalyticsPage() {
return (
<div>
<PageHeader
- title="Analytics"
- description="Request volume, latency, token usage, and failures."
+ title={t('analytics.title')}
+ description={t('analytics.description')}
actions={
<div className="flex gap-1 rounded-lg border p-0.5">
{(['24h', '7d', '30d'] as TimeRange[]).map(r => (
@@ -133,7 +133,7 @@ export default function AnalyticsPage() {
size="xs"
onClick={() => setRange(r)}
>
- {r}
+ {t(r === '24h' ? 'analytics.range24h' : r === '7d' ? 'analytics.range7d' : 'analytics.range30d')}
</Button>
))}
</div>
@@ -143,22 +143,22 @@ export default function AnalyticsPage() {
<div className="space-y-6">
{/* Summary stats */}
<div className="grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3">
- <Stat label="Requests" value={summary?.totalRequests ?? 0} hint={requestsHint} />
- <Stat label="Success rate" value={`${summary?.successRate ?? 0}%`} />
- <Stat label="Input tokens" value={formatTokens(summary?.totalInputTokens)} />
- <Stat label="Output tokens" value={formatTokens(summary?.totalOutputTokens)} />
- <Stat label="Avg latency" value={`${summary?.avgLatencyMs ?? 0} ms`} />
+ <Stat label={t('analytics.requests')} value={summary?.totalRequests ?? 0} hint={requestsHint} />
+ <Stat label={t('analytics.successRate')} value={`${summary?.successRate ?? 0}%`} />
+ <Stat label={t('analytics.inputTokens')} value={formatTokens(summary?.totalInputTokens)} />
+ <Stat label={t('analytics.outputTokens')} value={formatTokens(summary?.totalOutputTokens)} />
+ <Stat label={t('analytics.avgLatency')} value={`${summary?.avgLatencyMs ?? 0} ms`} />
{/* Priced per request at the served model's paid-API equivalent
rate (not a flat frontier-model rate) — see db/model-pricing.ts.
The value is a 30-day projection; the hover hint tells the whole
story (actual period amount + whether it was extrapolated). */}
- <Stat label="Est. savings" value={`$${savings30d.toFixed(2)}`} hint={savingsHint} />
+ <Stat label={t('analytics.estSavings')} value={`$${savings30d.toFixed(2)}`} hint={savingsHint} />
</div>
<div className="grid grid-cols-1 lg:grid-cols-2 gap-6">
- <Panel title="Requests by provider">
+ <Panel title={t('analytics.requestsByProvider')}>
{byPlatform.length === 0 ? (
- <p className="text-sm text-muted-foreground text-center py-8">No data yet</p>
+ <p className="text-sm text-muted-foreground text-center py-8">{t('common.noData')}</p>
) : (
<ResponsiveContainer width="100%" height={240}>
<BarChart data={byPlatform} margin={{ top: 6, right: 6, left: -12, bottom: 0 }}>
@@ -172,9 +172,9 @@ export default function AnalyticsPage() {
)}
</Panel>
- <Panel title="Avg latency by provider">
+ <Panel title={t('analytics.avgLatencyByProvider')}>
{byPlatform.length === 0 ? (
- <p className="text-sm text-muted-foreground text-center py-8">No data yet</p>
+ <p className="text-sm text-muted-foreground text-center py-8">{t('common.noData')}</p>
) : (
<ResponsiveContainer width="100%" height={240}>
<BarChart data={byPlatform} margin={{ top: 6, right: 6, left: -12, bottom: 0 }}>
@@ -189,9 +189,9 @@ export default function AnalyticsPage() {
</Panel>
<div className="lg:col-span-2">
- <Panel title="Requests over time">
+ <Panel title={t('analytics.requestsOverTime')}>
{timeline.length === 0 ? (
- <p className="text-sm text-muted-foreground text-center py-8">No data yet</p>
+ <p className="text-sm text-muted-foreground text-center py-8">{t('common.noData')}</p>
) : (
<ResponsiveContainer width="100%" height={240}>
<LineChart data={timeline} margin={{ top: 6, right: 6, left: -12, bottom: 0 }}>
@@ -211,7 +211,7 @@ export default function AnalyticsPage() {
<div className="lg:col-span-2">
<Panel title="Per-model breakdown">
{byModel.length === 0 ? (
- <p className="text-sm text-muted-foreground text-center py-8">No data yet</p>
+ <p className="text-sm text-muted-foreground text-center py-8">{t('common.noData')}</p>
) : (
<div className="max-h-[360px] overflow-y-auto -mx-4">
<Table>
diff --git a/client/src/pages/EmbeddingsPage.tsx b/client/src/pages/EmbeddingsPage.tsx
index 901b5307..2100f312 100644
--- a/client/src/pages/EmbeddingsPage.tsx
+++ b/client/src/pages/EmbeddingsPage.tsx
@@ -7,6 +7,7 @@ import { Switch } from '@/components/ui/switch'
import { PageHeader } from '@/components/page-header'
import { FloatingBar } from '@/components/floating-bar'
import { ModelsTabs } from '@/components/models-tabs'
+import { useI18n } from '@/i18n'
interface ProviderEntry {
id: number
@@ -43,6 +44,7 @@ function formatTokens(n: number): string {
}
export default function EmbeddingsPage() {
+ const { t } = useI18n()
const queryClient = useQueryClient()
// Local unsaved edits, same pattern as the chat fallback page.
const [localFamilies, setLocalFamilies] = useState<Family[] | null>(null)
@@ -110,8 +112,8 @@ export default function EmbeddingsPage() {
return (
<div>
<PageHeader
- title="Models"
- description="Embeddings fail over within a family only: the same model served by another provider. Vectors from different models are incompatible, so the router never swaps models on you."
+ title={t('embeddings.title')}
+ description={t('embeddings.description')}
divider={false}
actions={<ModelsTabs />}
/>
@@ -124,7 +126,7 @@ export default function EmbeddingsPage() {
</p>
{isLoading ? (
- <p className="text-sm text-muted-foreground">Loading…</p>
+ <p className="text-sm text-muted-foreground">{t('common.loading')}</p>
) : (
families.map(f => {
const u = usageByFamily.get(f.family)
@@ -144,19 +146,19 @@ export default function EmbeddingsPage() {
)}
{f.family === defaultFamily ? (
<span className="text-[10px] rounded-full px-1.5 py-0.5 bg-foreground text-background font-medium">
- Default · auto
+ {t('embeddings.defaultBadge')}
</span>
) : (
<button
onClick={() => setLocalDefault(f.family)}
className="text-[11px] text-muted-foreground hover:text-foreground underline decoration-dotted underline-offset-2 transition-colors"
>
- Make default
+ {t('embeddings.makeDefault')}
</button>
)}
</div>
<span className="text-xs text-muted-foreground tabular-nums">
- {u ? <>{u.requestsToday} req today · {formatTokens(u.tokensMonth)} tok this month</> : '—'}
+ {u ? <>{t('embeddings.usageToday', { count: u.requestsToday })} · {t('embeddings.usageMonth', { count: formatTokens(u.tokensMonth) })}</> : '—'}
</span>
</div>
@@ -170,7 +172,7 @@ export default function EmbeddingsPage() {
<span className="truncate font-mono text-[11px] text-muted-foreground">{p.modelId}</span>
{p.keyCount === 0 && (
<span className="text-[10px] rounded-full px-1.5 py-0.5 bg-amber-600/15 text-amber-700 dark:bg-amber-400/15 dark:text-amber-400">
- no key
+ {t('models.noKey')}
</span>
)}
</div>
@@ -181,7 +183,7 @@ export default function EmbeddingsPage() {
<button
onClick={() => moveProvider(f.family, i, -1)}
disabled={i === 0}
- aria-label="Move up"
+ aria-label={t('embeddings.moveUp')}
className="rounded-md p-1 text-muted-foreground/60 hover:text-foreground disabled:opacity-25 transition-colors"
>
<ArrowUp className="size-3.5" />
@@ -189,7 +191,7 @@ export default function EmbeddingsPage() {
<button
onClick={() => moveProvider(f.family, i, 1)}
disabled={i === f.providers.length - 1}
- aria-label="Move down"
+ aria-label={t('embeddings.moveDown')}
className="rounded-md p-1 text-muted-foreground/60 hover:text-foreground disabled:opacity-25 transition-colors"
>
<ArrowDown className="size-3.5" />
@@ -209,10 +211,10 @@ export default function EmbeddingsPage() {
)}
<FloatingBar show={hasChanges}>
- <span className="text-xs text-muted-foreground">Unsaved changes</span>
- <Button variant="outline" size="sm" onClick={discard}>Discard</Button>
+ <span className="text-xs text-muted-foreground">{t('embeddings.unsavedChanges')}</span>
+ <Button variant="outline" size="sm" onClick={discard}>{t('common.discard')}</Button>
<Button size="sm" onClick={handleSave} disabled={saveMutation.isPending}>
- {saveMutation.isPending ? 'Saving…' : 'Save changes'}
+ {saveMutation.isPending ? t('embeddings.savingChanges') : t('embeddings.saveChanges')}
</Button>
</FloatingBar>
</div>
diff --git a/client/src/pages/FallbackPage.tsx b/client/src/pages/FallbackPage.tsx
index c0b376e8..3bc091d6 100644
--- a/client/src/pages/FallbackPage.tsx
+++ b/client/src/pages/FallbackPage.tsx
@@ -18,6 +18,7 @@ import {
} from '@dnd-kit/sortable'
import { CSS } from '@dnd-kit/utilities'
import { ChevronDown, SlidersHorizontal } from 'lucide-react'
+import { useI18n } from '@/i18n'
import { apiFetch } from '@/lib/api'
import { Button } from '@/components/ui/button'
import { Popover, PopoverTrigger, PopoverContent } from '@/components/ui/popover'
@@ -73,20 +74,23 @@ interface RoutingData {
// A merged row: fallback-chain metadata + live bandit scores.
type Row = FallbackEntry & Partial<RoutingScore>
-const STRATEGIES: { key: RoutingStrategy; label: string; blurb: string }[] = [
- { key: 'priority', label: 'Manual', blurb: 'Route in the exact order you set below. Drag the handles to reorder. No scoring; the chain is followed top-to-bottom.' },
- { key: 'balanced', label: 'Balanced', blurb: 'Reliability leads (50%), with speed and intelligence weighted equally (25% each). A sensible all-round default.' },
- { key: 'smartest', label: 'Smartest', blurb: 'Prefer the most capable model that still works. Intelligence 55%, reliability 35%, speed 10%.' },
- { key: 'fastest', label: 'Fastest', blurb: 'Prefer the fastest model that still works. Speed 55%, reliability 35%, intelligence 10%.' },
- { key: 'reliable', label: 'Most reliable', blurb: 'Maximize success rate above all. Reliability 70%, speed and intelligence 15% each.' },
- { key: 'custom', label: 'Custom', blurb: 'Set your own balance of reliability, speed and intelligence with sliders. Same engine as the presets, just your weights.' },
+// `tKey` is the i18n suffix under `strategies.*` (label) and `strategies.*Blurb`.
+// It differs from the routing `key` for Manual, whose strategy id is 'priority'.
+const STRATEGIES: { key: RoutingStrategy; tKey: string }[] = [
+ { key: 'priority', tKey: 'manual' },
+ { key: 'balanced', tKey: 'balanced' },
+ { key: 'smartest', tKey: 'smartest' },
+ { key: 'fastest', tKey: 'fastest' },
+ { key: 'reliable', tKey: 'reliable' },
+ { key: 'custom', tKey: 'custom' },
]
// Slider axes share the colors used by the score table columns below.
-const WEIGHT_AXES: { key: keyof RoutingWeights; label: string; color: string }[] = [
- { key: 'reliability', label: 'Reliability', color: '#22c55e' },
- { key: 'speed', label: 'Speed', color: '#3b82f6' },
- { key: 'intelligence', label: 'Intelligence', color: '#a855f7' },
+// `tKey` is the i18n suffix under `strategies.weight*`.
+const WEIGHT_AXES: { key: keyof RoutingWeights; tKey: string; color: string }[] = [
+ { key: 'reliability', tKey: 'weightReliability', color: '#22c55e' },
+ { key: 'speed', tKey: 'weightSpeed', color: '#3b82f6' },
+ { key: 'intelligence', tKey: 'weightIntelligence', color: '#a855f7' },
]
// Slider popover for the 'custom' strategy. Sliders are independent (0-100)
@@ -97,6 +101,7 @@ function CustomWeightsPopover({ saved, onSave, saving }: {
onSave: (w: RoutingWeights) => void
saving: boolean
}) {
+ const { t } = useI18n()
const [values, setValues] = useState<RoutingWeights>(() => fromSaved(saved))
const [dirty, setDirty] = useState(false)
@@ -133,24 +138,25 @@ function CustomWeightsPopover({ saved, onSave, saving }: {
<Popover onOpenChange={open => { if (open) { setValues(fromSaved(saved)); setDirty(false) } }}>
<PopoverTrigger className="inline-flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted transition-colors">
<SlidersHorizontal className="size-3.5" />
- Adjust
+ {t('strategies.adjust')}
</PopoverTrigger>
<PopoverContent align="start" className="w-80">
<div className="space-y-4">
<div>
- <h3 className="text-sm font-medium">Custom weights</h3>
+ <h3 className="text-sm font-medium">{t('strategies.customWeights')}</h3>
<p className="mt-0.5 text-xs text-muted-foreground">
- Sliders are independent; shares auto-balance to 100%.
+ {t('strategies.customWeightsHelp')}
</p>
</div>
{WEIGHT_AXES.map(axis => {
const share = sum > 0 ? Math.round((values[axis.key] / sum) * 100) : 0
+ const axisLabel = t(`strategies.${axis.tKey}`)
return (
<div key={axis.key}>
<div className="mb-1 flex items-baseline justify-between text-xs">
<span className="inline-flex items-center gap-1.5">
<span className="size-2 rounded-sm" style={{ background: axis.color }} />
- {axis.label}
+ {axisLabel}
</span>
<span className="tabular-nums text-muted-foreground">{share}%</span>
</div>
@@ -163,14 +169,14 @@ function CustomWeightsPopover({ saved, onSave, saving }: {
onChange={e => update(axis.key, Number(e.target.value))}
className="w-full cursor-pointer"
style={{ accentColor: axis.color }}
- aria-label={`${axis.label} weight`}
+ aria-label={`${axisLabel} weight`}
/>
</div>
)
})}
{sum <= 0 && (
<p className="text-xs text-amber-600 dark:text-amber-500">
- At least one weight must be above zero.
+ {t('strategies.weightRequired')}
</p>
)}
<Button
@@ -179,7 +185,7 @@ function CustomWeightsPopover({ saved, onSave, saving }: {
disabled={!dirty || sum <= 0 || saving}
onClick={apply}
>
- {saving ? 'Applying…' : dirty ? 'Apply' : 'Applied'}
+ {saving ? t('common.applying') : dirty ? t('common.apply') : t('common.applied')}
</Button>
</div>
</PopoverContent>
@@ -237,6 +243,7 @@ function AxisBar({ value, color }: { value: number | undefined; color: string })
const LEGEND_COLLAPSED_PX = 126
function TokenUsageBar({ data }: { data: TokenUsageData }) {
+ const { t } = useI18n()
const { totalBudget, totalUsed, models } = data
const remaining = Math.max(0, totalBudget - totalUsed)
const remainingPct = totalBudget > 0 ? Math.round((remaining / totalBudget) * 100) : 0
@@ -267,11 +274,11 @@ function TokenUsageBar({ data }: { data: TokenUsageData }) {
return (
<section className="rounded-3xl border bg-card p-5">
<div className="flex items-baseline justify-between mb-3">
- <h2 className="text-sm font-medium">Monthly token budget</h2>
+ <h2 className="text-sm font-medium">{t('models.monthlyTokenBudget')}</h2>
<span className="text-xs text-muted-foreground tabular-nums">
- <span className="text-foreground font-medium">{formatTokens(remaining)}</span> remaining
+ <span className="text-foreground font-medium">{formatTokens(remaining)}</span> {t('models.remaining')}
<span className="mx-1.5">·</span>
- {remainingPct}% of {formatTokens(totalBudget)}
+ {remainingPct}% {t('models.of')} {formatTokens(totalBudget)}
</span>
</div>
@@ -320,7 +327,7 @@ function TokenUsageBar({ data }: { data: TokenUsageData }) {
onClick={() => setExpanded(e => !e)}
className="mt-2 flex w-full items-center justify-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors"
>
- {expanded ? 'Show less' : `Show all ${models.length} models`}
+ {expanded ? t('models.showLess') : t('models.showAllModels', { count: models.length })}
<ChevronDown className={`size-3.5 transition-transform duration-300 ${expanded ? 'rotate-180' : ''}`} />
</button>
)}
@@ -342,6 +349,7 @@ function RowContent({
dragHandle?: ReactNode
onToggle: (modelDbId: number, enabled: boolean) => void
}) {
+ const { t } = useI18n()
const guard = (row.headroom ?? 1) * (row.rateLimit ?? 1)
return (
<>
@@ -355,31 +363,31 @@ function RowContent({
<span className="text-xs text-muted-foreground">{row.platform}</span>
{row.supportsVision && (
<span
- title="Accepts image input"
+ title={t('models.visionTitle')}
className="text-[10px] rounded-full px-1.5 py-0.5 bg-cyan-600/15 text-cyan-700 dark:bg-cyan-400/15 dark:text-cyan-400"
>
- Vision
+ {t('models.vision')}
</span>
)}
{row.supportsTools && (
<span
- title="Emits structured tool calls, so it is eligible for tool-bearing requests"
+ title={t('models.toolsTitle')}
className="text-[10px] rounded-full px-1.5 py-0.5 bg-violet-600/15 text-violet-700 dark:bg-violet-400/15 dark:text-violet-400"
>
- Tools
+ {t('models.tools')}
</span>
)}
{(row.penalty ?? 0) > 0 && (
- <span className="text-[10px] text-amber-600 dark:text-amber-400">−{row.penalty} penalty</span>
+ <span className="text-[10px] text-amber-600 dark:text-amber-400">{t('models.penalty', { value: row.penalty })}</span>
)}
{row.totalRequests !== undefined && row.totalRequests > 0 && (
- <span className="text-[10px] text-muted-foreground/60 tabular-nums">{row.totalRequests} obs</span>
+ <span className="text-[10px] text-muted-foreground/60 tabular-nums">{t('models.obs', { count: row.totalRequests })}</span>
)}
</div>
<div className="text-[11px] text-muted-foreground/70 tabular-nums mt-0.5">
- {row.monthlyTokenBudget} tok/mo
- {row.rpmLimit ? ` · ${row.rpmLimit} rpm` : ''}
- {row.rpdLimit ? ` · ${row.rpdLimit} rpd` : ''}
+ {t('models.tokPerMonth', { count: row.monthlyTokenBudget })}
+ {row.rpmLimit ? ` · ${t('models.rpmLimit', { count: row.rpmLimit })}` : ''}
+ {row.rpdLimit ? ` · ${t('models.rpdLimit', { count: row.rpdLimit })}` : ''}
</div>
</td>
<td className="py-2 pr-3 align-middle"><AxisBar value={row.reliability} color="#22c55e" /></td>
@@ -399,13 +407,14 @@ function RowContent({
}
function SortableRow({ row, rank, onToggle }: { row: Row; rank: number; onToggle: (id: number, e: boolean) => void }) {
+ const { t } = useI18n()
const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({ id: row.modelDbId })
const handle = (
<button
{...attributes}
{...listeners}
className="cursor-grab active:cursor-grabbing text-muted-foreground/50 hover:text-foreground transition-colors"
- aria-label="Drag to reorder"
+ aria-label={t('models.dragToReorder')}
>
<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor">
<circle cx="9" cy="6" r="1.5" /><circle cx="15" cy="6" r="1.5" />
@@ -426,6 +435,7 @@ function SortableRow({ row, rank, onToggle }: { row: Row; rank: number; onToggle
}
export default function FallbackPage() {
+ const { t } = useI18n()
const queryClient = useQueryClient()
const [localEntries, setLocalEntries] = useState<FallbackEntry[] | null>(null)
@@ -513,13 +523,13 @@ export default function FallbackPage() {
<th className="py-2 pr-2 w-6 text-center font-medium">#</th>
<th className="py-2 pr-3 font-medium">Model</th>
<th className="py-2 pr-3 font-medium">
- <span className="inline-flex items-center gap-1"><span className="size-2 rounded-sm" style={{ background: '#22c55e' }} />Reliability</span>
+ <span className="inline-flex items-center gap-1"><span className="size-2 rounded-sm" style={{ background: '#22c55e' }} />{t('strategies.weightReliability')}</span>
</th>
<th className="py-2 pr-3 font-medium">
- <span className="inline-flex items-center gap-1"><span className="size-2 rounded-sm" style={{ background: '#3b82f6' }} />Speed</span>
+ <span className="inline-flex items-center gap-1"><span className="size-2 rounded-sm" style={{ background: '#3b82f6' }} />{t('strategies.weightSpeed')}</span>
</th>
<th className="py-2 pr-3 font-medium">
- <span className="inline-flex items-center gap-1"><span className="size-2 rounded-sm" style={{ background: '#a855f7' }} />Intelligence</span>
+ <span className="inline-flex items-center gap-1"><span className="size-2 rounded-sm" style={{ background: '#a855f7' }} />{t('strategies.weightIntelligence')}</span>
</th>
<th className="py-2 pr-3 font-medium">
<Tooltip text="Always-on guardrails: free-quota headroom × live rate-limit penalty. Below 1.0 means the model is being held back.">
@@ -528,7 +538,7 @@ export default function FallbackPage() {
</th>
<th className="py-2 pr-3 font-medium text-right">
<Tooltip text="Final routing score = weighted average of the three axes, multiplied by the guardrails. Higher routes first.">
- <span className="underline decoration-dotted underline-offset-2 cursor-help">Score</span>
+ <span className="underline decoration-dotted underline-offset-2 cursor-help">{t('strategies.scoreColumn')}</span>
</Tooltip>
</th>
<th className="py-2 pr-3 font-medium text-right">On</th>
@@ -539,7 +549,7 @@ export default function FallbackPage() {
return (
<div>
<PageHeader
- title="Models"
+ title={t('models.title')}
description="Pick a routing strategy. In Manual mode you drag to set the order; the other strategies route by live score across reliability, speed and intelligence."
divider={false}
actions={<ModelsTabs />}
@@ -552,7 +562,7 @@ export default function FallbackPage() {
{/* Strategy selector */}
<section className="rounded-3xl border bg-card p-5">
<div className="flex items-baseline justify-between mb-3">
- <h2 className="text-sm font-medium">Routing strategy</h2>
+ <h2 className="text-sm font-medium">{t('strategies.title')}</h2>
{routing?.weights && (
<span className="text-xs text-muted-foreground tabular-nums">
reliability {Math.round(routing.weights.reliability * 100)}% ·
@@ -564,7 +574,7 @@ export default function FallbackPage() {
<div className="inline-flex flex-wrap items-center gap-1 rounded-xl border p-1">
{STRATEGIES.map(s => (
- <Tooltip key={s.key} text={s.blurb}>
+ <Tooltip key={s.key} text={t(`strategies.${s.tKey}Blurb`)}>
<button
disabled={strategyMutation.isPending}
onClick={() => strategyMutation.mutate({ strategy: s.key })}
@@ -574,7 +584,7 @@ export default function FallbackPage() {
: 'text-muted-foreground hover:text-foreground hover:bg-muted'
}`}
>
- {s.label}
+ {t(`strategies.${s.tKey}`)}
</button>
</Tooltip>
))}
@@ -596,7 +606,7 @@ export default function FallbackPage() {
{/* Unified routing / fallback table */}
{isLoading ? (
- <p className="text-sm text-muted-foreground">Loading…</p>
+ <p className="text-sm text-muted-foreground">{t('common.loading')}</p>
) : ordered.length === 0 ? (
<div className="rounded-3xl border border-dashed p-8 text-center">
<p className="text-sm text-muted-foreground">
@@ -641,9 +651,9 @@ export default function FallbackPage() {
sliding up when there are unsaved changes and back down on save/discard. */}
<FloatingBar show={hasChanges}>
<span className="text-xs text-muted-foreground">Unsaved changes</span>
- <Button variant="outline" size="sm" onClick={() => setLocalEntries(null)}>Discard</Button>
+ <Button variant="outline" size="sm" onClick={() => setLocalEntries(null)}>{t('common.discard')}</Button>
<Button size="sm" onClick={handleSave} disabled={saveMutation.isPending}>
- {saveMutation.isPending ? 'Saving…' : 'Save changes'}
+ {saveMutation.isPending ? t('common.saving') : 'Save changes'}
</Button>
</FloatingBar>
diff --git a/client/src/pages/KeysPage.tsx b/client/src/pages/KeysPage.tsx
index 485f034f..13f4a67a 100644
--- a/client/src/pages/KeysPage.tsx
+++ b/client/src/pages/KeysPage.tsx
@@ -11,9 +11,11 @@ import { PageHeader } from '@/components/page-header'
import type { ApiKey, Platform } from '../../../shared/types'
import { Pencil, ExternalLink, Globe } from 'lucide-react'
import { formatSqliteUtcToLocalTime } from '@/lib/utils'
+import { useI18n } from '@/i18n'
// Small "Get API key" external link shown next to a provider (#137).
function GetKeyLink({ url }: { url: string }) {
+ const { t } = useI18n()
if (!url) return null
return (
<a
@@ -22,7 +24,7 @@ function GetKeyLink({ url }: { url: string }) {
rel="noopener noreferrer"
className="inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors"
>
- Get API key
+ {t('keys.getApiKey')}
<ExternalLink className="size-3" />
</a>
)
@@ -70,12 +72,12 @@ const statusDot: Record<string, string> = {
unknown: 'bg-muted-foreground/40',
}
-const statusLabel: Record<string, string> = {
- healthy: 'healthy',
- rate_limited: 'rate-limited',
- invalid: 'invalid',
- error: 'error',
- unknown: 'unchecked',
+const statusLabelKey: Record<string, string> = {
+ healthy: 'status.healthy',
+ rate_limited: 'status.rateLimited',
+ invalid: 'status.invalid',
+ error: 'status.error',
+ unknown: 'status.unchecked',
}
interface HealthPlatform {
@@ -94,6 +96,7 @@ interface HealthData {
}
function UnifiedKeySection() {
+ const { t } = useI18n()
const queryClient = useQueryClient()
const [showKey, setShowKey] = useState(false)
const [copied, setCopied] = useState(false)
@@ -124,7 +127,7 @@ function UnifiedKeySection() {
<section className="rounded-3xl border bg-card p-5">
<div className="flex items-start justify-between gap-4 mb-3">
<div>
- <h2 className="text-sm font-medium">Your unified API key</h2>
+ <h2 className="text-sm font-medium">{t('keys.unifiedKey')}</h2>
<p className="text-xs text-muted-foreground mt-0.5">
Use this as your OpenAI <code className="font-mono">api_key</code>; it authenticates requests to this proxy.
</p>
@@ -135,7 +138,7 @@ function UnifiedKeySection() {
onClick={() => regenerate.mutate()}
disabled={regenerate.isPending || isError}
>
- Regenerate
+ {t('keys.regenerate')}
</Button>
</div>
@@ -151,29 +154,30 @@ function UnifiedKeySection() {
{showKey ? apiKey : masked}
</code>
<Button variant="outline" size="sm" onClick={() => setShowKey(!showKey)}>
- {showKey ? 'Hide' : 'Show'}
+ {showKey ? t('keys.hideKey') : t('keys.showKey')}
</Button>
<Button variant="outline" size="sm" onClick={copy}>
- {copied ? 'Copied' : 'Copy'}
+ {copied ? t('keys.copiedKey') : t('keys.copyKey')}
</Button>
</div>
)}
<div className="mt-4 grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5 text-xs">
- <span className="text-muted-foreground">Base URL</span>
+ <span className="text-muted-foreground">{t('keys.baseUrl')}</span>
<code className="font-mono">{baseUrl}</code>
- <span className="text-muted-foreground">Chat</span>
+ <span className="text-muted-foreground">{t('keys.endpointChat')}</span>
<code className="font-mono">/v1/chat/completions</code>
- <span className="text-muted-foreground">Responses</span>
+ <span className="text-muted-foreground">{t('keys.endpointResponses')}</span>
<code className="font-mono">/v1/responses</code>
- <span className="text-muted-foreground">Embeddings</span>
- <code className="font-mono">/v1/embeddings <span className="text-muted-foreground">(model: "auto" or a family from the Embeddings tab)</span></code>
+ <span className="text-muted-foreground">{t('keys.endpointEmbeddings')}</span>
+ <code className="font-mono">/v1/embeddings <span className="text-muted-foreground">({t('keys.endpointEmbeddingsHint')})</span></code>
</div>
</section>
)
}
function ProxySettingsSection() {
+ const { t } = useI18n()
const queryClient = useQueryClient()
const [proxyUrl, setProxyUrl] = useState('')
@@ -211,10 +215,10 @@ function ProxySettingsSection() {
<div>
<h2 className="text-sm font-medium flex items-center gap-2">
<Globe className="size-3.5 text-muted-foreground" />
- Outbound proxy
+ {t('keys.outboundProxy')}
</h2>
<p className="text-xs text-muted-foreground mt-0.5">
- Route outbound LLM requests through a proxy. Supports SOCKS5, HTTP, and HTTPS.
+ {t('keys.outboundProxyDescription')}
</p>
</div>
<div className="flex items-center gap-2">
@@ -225,18 +229,18 @@ function ProxySettingsSection() {
/>
{active && enabled && (
<span className="text-[11px] px-2 py-0.5 rounded-full bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 font-medium">
- Active
+ {t('common.active')}
</span>
)}
</div>
</div>
{isError ? (
- <p className="text-xs text-muted-foreground">Could not load proxy settings.</p>
+ <p className="text-xs text-muted-foreground">{t('keys.proxyLoadFailed')}</p>
) : (
<form onSubmit={submit} className="flex items-end gap-3">
<div className="space-y-1.5 flex-1">
- <Label className="text-xs">Proxy URL</Label>
+ <Label className="text-xs">{t('keys.proxyUrl')}</Label>
<Input
value={proxyUrl}
onChange={e => setProxyUrl(e.target.value)}
@@ -245,7 +249,7 @@ function ProxySettingsSection() {
/>
</div>
<Button type="submit" size="sm" disabled={saveProxy.isPending}>
- {saveProxy.isPending ? 'Saving…' : 'Save'}
+ {saveProxy.isPending ? t('keys.savingProxy') : t('keys.saveProxy')}
</Button>
</form>
)}
@@ -280,6 +284,7 @@ function parseModelList(raw: string): string[] {
}
function CustomProviderSection() {
+ const { t } = useI18n()
const queryClient = useQueryClient()
const [baseUrl, setBaseUrl] = useState('')
const [model, setModel] = useState('')
@@ -317,7 +322,7 @@ function CustomProviderSection() {
return (
<section>
- <h2 className="text-sm font-medium mb-1">Add a custom OpenAI-compatible model</h2>
+ <h2 className="text-sm font-medium mb-1">{t('keys.addCustom')}</h2>
<p className="text-xs text-muted-foreground mb-3">
Point at any OpenAI-compatible endpoint: llama.cpp, LM Studio, vLLM, a local Ollama, or a remote
gateway. List one model per line (or comma-separated) to add several at once; they all share the
@@ -325,7 +330,7 @@ function CustomProviderSection() {
</p>
<form onSubmit={submit} className="flex flex-wrap items-end gap-3 rounded-3xl border p-4 bg-card">
<div className="space-y-1.5 flex-1 min-w-[240px]">
- <Label className="text-xs">Base URL</Label>
+ <Label className="text-xs">{t('keys.customBaseUrl')}</Label>
<Input
value={baseUrl}
onChange={e => setBaseUrl(e.target.value)}
@@ -334,7 +339,7 @@ function CustomProviderSection() {
/>
</div>
<div className="space-y-1.5">
- <Label className="text-xs">Models</Label>
+ <Label className="text-xs">{t('keys.customModels')}</Label>
<Textarea
value={model}
onChange={e => setModel(e.target.value)}
@@ -344,27 +349,27 @@ function CustomProviderSection() {
/>
</div>
<div className="space-y-1.5">
- <Label className="text-xs">Display name</Label>
+ <Label className="text-xs">{t('keys.customDisplayName')}</Label>
<Input
value={displayName}
onChange={e => setDisplayName(e.target.value)}
- placeholder={multiple ? 'per-model' : 'optional'}
+ placeholder={multiple ? t('keys.customDisplayNamePerModel') : t('keys.customDisplayNameOptional')}
disabled={multiple}
className="w-[150px]"
/>
</div>
<div className="space-y-1.5">
- <Label className="text-xs">API key</Label>
+ <Label className="text-xs">{t('keys.customApiKey')}</Label>
<Input
type="password"
value={apiKey}
onChange={e => setApiKey(e.target.value)}
- placeholder="optional"
+ placeholder={t('keys.customDisplayNameOptional')}
className="w-[150px] font-mono text-xs"
/>
</div>
<Button type="submit" size="sm" disabled={!baseUrl || models.length === 0 || addCustom.isPending}>
- {addCustom.isPending ? 'Adding…' : multiple ? `Add ${models.length} models` : 'Add model'}
+ {addCustom.isPending ? t('keys.addingCustom') : multiple ? t('keys.addModels', { count: models.length }) : t('keys.addModel')}
</Button>
</form>
{addCustom.isError && (
@@ -375,6 +380,7 @@ function CustomProviderSection() {
}
export default function KeysPage() {
+ const { t } = useI18n()
const queryClient = useQueryClient()
const [platform, setPlatform] = useState<Platform | ''>('')
const [apiKey, setApiKey] = useState('')
@@ -524,12 +530,12 @@ export default function KeysPage() {
return (
<div>
<PageHeader
- title="Keys"
+ title={t('keys.pageTitle')}
description="Provider credentials and the unified API key your apps connect with."
actions={
keys.length > 0 && (
<Button variant="outline" size="sm" onClick={() => checkAll.mutate()} disabled={checkAll.isPending}>
- {checkAll.isPending ? 'Checking…' : 'Check all'}
+ {checkAll.isPending ? t('keys.checking') : t('keys.checkAll')}
</Button>
)
}
@@ -562,7 +568,7 @@ export default function KeysPage() {
</div>
{needsAccountId && (
<div className="space-y-1.5">
- <Label className="text-xs">Account ID</Label>
+ <Label className="text-xs">{t('keys.accountId')}</Label>
<Input
value={accountId}
onChange={e => setAccountId(e.target.value)}
@@ -572,7 +578,7 @@ export default function KeysPage() {
</div>
)}
<div className="space-y-1.5 flex-1 min-w-[240px]">
- <Label className="text-xs">{needsAccountId ? 'API token' : 'API key'}</Label>
+ <Label className="text-xs">{needsAccountId ? 'API token' : t('keys.customApiKey')}</Label>
<Input
type="password"
value={isKeyless ? '' : apiKey}
@@ -588,16 +594,16 @@ export default function KeysPage() {
)}
</div>
<div className="space-y-1.5">
- <Label className="text-xs">Label</Label>
+ <Label className="text-xs">{t('keys.label')}</Label>
<div className="flex flex-wrap items-center space-x-3">
<Input
value={label}
onChange={e => setLabel(e.target.value)}
- placeholder="optional"
+ placeholder={t('keys.customDisplayNameOptional')}
className="w-[160px]"
/>
<Button type="submit" size="sm" disabled={!platform || (!isKeyless && !apiKey) || (needsAccountId && !accountId) || addKey.isPending}>
- {addKey.isPending ? 'Adding…' : isKeyless ? 'Enable' : 'Add key'}
+ {addKey.isPending ? t('keys.adding') : isKeyless ? 'Enable' : t('keys.addKey')}
</Button>
</div>
</div>
@@ -612,7 +618,7 @@ export default function KeysPage() {
<section>
<h2 className="text-sm font-medium mb-3">Configured providers</h2>
{isLoading ? (
- <p className="text-sm text-muted-foreground">Loading…</p>
+ <p className="text-sm text-muted-foreground">{t('common.loading')}</p>
) : keys.length === 0 ? (
<div className="rounded-3xl border border-dashed p-8 text-center">
<p className="text-sm text-muted-foreground">
@@ -677,7 +683,7 @@ export default function KeysPage() {
{k.label && <span className="text-xs text-muted-foreground">{k.label}</span>}
</>
)}
- <span className="text-xs text-muted-foreground">{statusLabel[status] ?? status}</span>
+ <span className="text-xs text-muted-foreground">{statusLabelKey[status] ? t(statusLabelKey[status]) : status}</span>
<div className="flex-1" />
{lastChecked && (
<span className="text-[11px] text-muted-foreground tabular-nums">
diff --git a/client/src/pages/PlaygroundPage.tsx b/client/src/pages/PlaygroundPage.tsx
index 72a9f820..e591ce91 100644
--- a/client/src/pages/PlaygroundPage.tsx
+++ b/client/src/pages/PlaygroundPage.tsx
@@ -6,6 +6,7 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@
import { PageHeader } from '@/components/page-header'
import { Markdown } from '@/components/markdown'
import { CopyButton } from '@/components/copy-button'
+import { useI18n } from '@/i18n'
interface FallbackEntry {
modelDbId: number
@@ -30,6 +31,7 @@ interface ChatMessage {
}
export default function PlaygroundPage() {
+ const { t } = useI18n()
const [messages, setMessages] = useState<ChatMessage[]>([])
const [input, setInput] = useState('')
const [loading, setLoading] = useState(false)
@@ -91,7 +93,7 @@ export default function PlaygroundPage() {
const err = await res.json().catch(() => ({ error: { message: `HTTP ${res.status}` } }))
setMessages([...newMessages, {
role: 'assistant',
- content: `Error: ${err.error?.message ?? 'Unknown error'}`,
+ content: `${t('playground.errorPrefix')} ${err.error?.message ?? 'Unknown error'}`,
}])
return
}
@@ -116,7 +118,7 @@ export default function PlaygroundPage() {
} catch (err: any) {
setMessages([...newMessages, {
role: 'assistant',
- content: `Error: ${err.message}`,
+ content: `${t('playground.errorPrefix')} ${err.message}`,
}])
} finally {
setLoading(false)
@@ -137,14 +139,14 @@ export default function PlaygroundPage() {
}
const activeModelLabel = selectedModel === 'auto'
- ? 'Auto (fallback chain)'
+ ? t('playground.autoModel')
: availableModels.find(m => m.modelId === selectedModel)?.displayName ?? selectedModel
return (
<div className="flex flex-col h-[calc(100vh-8rem)]">
<PageHeader
- title="Playground"
- description="Send a chat completion through the router and see which provider serves it."
+ title={t('playground.title')}
+ description={t('playground.description')}
actions={
<>
<Select value={selectedModel} onValueChange={(v) => { const m = v ?? 'auto'; setSelectedModel(m); localStorage.setItem('playground.model', m) }}>
@@ -152,7 +154,7 @@ export default function PlaygroundPage() {
<SelectValue />
</SelectTrigger>
<SelectContent>
- <SelectItem value="auto">Auto (fallback chain)</SelectItem>
+ <SelectItem value="auto">{t('playground.autoModel')}</SelectItem>
{availableModels.map(m => (
<SelectItem key={m.modelDbId} value={m.modelId}>
<span className="flex items-center gap-2">
@@ -165,14 +167,14 @@ export default function PlaygroundPage() {
// Models only appear once a platform has an enabled key. Without
// one, the list is just "Auto" and looks broken — say why. (#269)
<div className="px-2 py-1.5 text-xs text-muted-foreground">
- No models yet. Add an API key on the Keys page to populate this list.
+ {t('playground.noModels')}
</div>
)}
</SelectContent>
</Select>
{messages.length > 0 && (
<Button variant="outline" size="sm" onClick={handleClear}>
- Clear
+ {t('playground.clear')}
</Button>
)}
</>
@@ -184,9 +186,9 @@ export default function PlaygroundPage() {
{messages.length === 0 ? (
<div className="flex items-center justify-center h-full text-center">
<div className="space-y-2 max-w-sm">
- <p className="text-base font-medium">Send a message to get started.</p>
+ <p className="text-base font-medium">{t('playground.emptyTitle')}</p>
<p className="text-sm text-muted-foreground">
- Using <span className="text-foreground">{activeModelLabel}</span>. Switch models in the selector above.
+ {t('playground.emptyDescription', { model: activeModelLabel })}
</p>
</div>
</div>
@@ -209,7 +211,7 @@ export default function PlaygroundPage() {
{msg.role === 'assistant' && msg.content && (
<CopyButton
text={msg.content}
- label="Copy reply"
+ label={t('playground.copyReply')}
className="absolute right-1.5 top-1.5 size-6 opacity-0 transition-opacity focus-visible:opacity-100 group-hover:opacity-100"
/>
)}
@@ -219,7 +221,7 @@ export default function PlaygroundPage() {
{msg.meta.model && <span className="font-mono">· {msg.meta.model}</span>}
{msg.meta.latency != null && <span>· {msg.meta.latency} ms</span>}
{msg.meta.fallbackAttempts != null && msg.meta.fallbackAttempts > 0 && (
- <span>· {msg.meta.fallbackAttempts} fallback{msg.meta.fallbackAttempts > 1 ? 's' : ''}</span>
+ <span>· {msg.meta.fallbackAttempts} {msg.meta.fallbackAttempts > 1 ? t('playground.fallbacks') : t('playground.fallback')}</span>
)}
</div>
)}
@@ -249,7 +251,7 @@ export default function PlaygroundPage() {
value={input}
onChange={e => setInput(e.target.value)}
onKeyDown={handleKeyDown}
- placeholder="Type a message… (⏎ to send, ⇧⏎ for newline)"
+ placeholder={t('playground.inputPlaceholder')}
rows={1}
className="flex-1 resize-none rounded-lg border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-ring/50 min-h-[40px] max-h-[160px]"
style={{ height: 'auto', overflow: 'hidden' }}
@@ -260,7 +262,7 @@ export default function PlaygroundPage() {
}}
/>
<Button onClick={handleSend} disabled={loading || !input.trim()} size="default">
- {loading ? 'Sending…' : 'Send'}
+ {loading ? t('playground.sending') : t('playground.send')}
</Button>
</div>
</div>
diff --git a/client/src/pages/PremiumPage.tsx b/client/src/pages/PremiumPage.tsx
index 0b08c280..3325063b 100644
--- a/client/src/pages/PremiumPage.tsx
+++ b/client/src/pages/PremiumPage.tsx
@@ -7,6 +7,7 @@ import { Button } from '@/components/ui/button'
import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label'
import { Badge } from '@/components/ui/badge'
+import { useI18n } from '@/i18n'
interface LicenseStatus {
valid: boolean
@@ -34,11 +35,6 @@ interface PremiumStatus {
siteUrl: string
}
-const PLAN_LABEL: Record<string, string> = {
- annual: 'Premium Annual',
- lifetime: 'Premium Lifetime',
-}
-
function fmtWhen(ms: number | null): string {
if (!ms) return 'never'
return new Date(ms).toLocaleString()
@@ -50,6 +46,7 @@ function fmtDate(iso: string | null): string {
}
export default function PremiumPage() {
+ const { t } = useI18n()
const queryClient = useQueryClient()
const [keyInput, setKeyInput] = useState('')
@@ -93,8 +90,8 @@ export default function PremiumPage() {
if (isLoading || !data) {
return (
<div>
- <PageHeader title="Premium" description="The live model catalog, on every device." />
- <p className="text-sm text-muted-foreground">Loading…</p>
+ <PageHeader title={t('premium.title')} description={t('premium.description')} />
+ <p className="text-sm text-muted-foreground">{t('premium.loading')}</p>
</div>
)
}
@@ -106,12 +103,12 @@ export default function PremiumPage() {
return (
<div>
<PageHeader
- title="Premium"
- description="The live model catalog, on every device."
+ title={t('premium.title')}
+ description={t('premium.description')}
actions={
<Button variant="outline" size="sm" onClick={() => syncNow.mutate()} disabled={syncNow.isPending}>
<RefreshCw className={syncNow.isPending ? 'animate-spin' : ''} />
- {syncNow.isPending ? 'Syncing…' : 'Check for updates'}
+ {syncNow.isPending ? t('premium.syncing') : t('premium.checkForUpdates')}
</Button>
}
/>
@@ -119,61 +116,65 @@ export default function PremiumPage() {
<div className="space-y-8">
{/* Catalog feed state */}
<section>
- <h2 className="text-sm font-medium mb-3">Catalog feed</h2>
+ <h2 className="text-sm font-medium mb-3">{t('premium.catalogFeed')}</h2>
<div className="rounded-3xl border bg-card p-5">
<div className="flex flex-wrap items-center gap-x-6 gap-y-3">
<div className="flex items-center gap-2">
<span className={`inline-block size-2 rounded-full ${live ? 'bg-emerald-500' : 'bg-muted-foreground/40'}`} />
- <span className="text-sm font-medium">{live ? 'Live feed' : 'Monthly snapshot'}</span>
+ <span className="text-sm font-medium">{live ? t('premium.liveFeed') : t('premium.monthlySnapshot')}</span>
<Badge variant="outline" className="font-mono text-[11px]">
{catalog.appliedVersion ?? 'bundled'}
</Badge>
</div>
- <span className="text-xs text-muted-foreground">Last checked: {fmtWhen(catalog.lastSyncMs)}</span>
+ <span className="text-xs text-muted-foreground">{t('premium.lastChecked', { when: fmtWhen(catalog.lastSyncMs) })}</span>
</div>
<p className="text-xs text-muted-foreground mt-3">
{live
- ? 'New free models, quota changes, and quirk fixes land here within hours of being shipped. The app checks automatically twice a day; nothing to do.'
- : 'Free tier: the catalog refreshes from a monthly snapshot, checked automatically twice a day. Premium switches this to the live feed, updated every 2-3 days.'}
+ ? t('premium.liveDescription')
+ : t('premium.snapshotDescription')}
</p>
{catalog.lastError && (
- <p className="text-destructive text-xs mt-2">Last sync problem: {catalog.lastError}</p>
+ <p className="text-destructive text-xs mt-2">{t('premium.lastSyncProblem', { error: catalog.lastError })}</p>
)}
</div>
</section>
{/* License */}
<section>
- <h2 className="text-sm font-medium mb-3">License</h2>
+ <h2 className="text-sm font-medium mb-3">{t('premium.license')}</h2>
{hasKey ? (
<div className="rounded-3xl border bg-card p-5 space-y-4">
<div className="flex flex-wrap items-center gap-3">
<span className="font-mono text-sm">{maskedKey}</span>
{licensed ? (
<Badge className="bg-emerald-500/15 text-emerald-600 dark:text-emerald-400 border-transparent">
- {PLAN_LABEL[license?.plan ?? ''] ?? 'Premium'}
+ {license?.plan === 'annual'
+ ? t('premium.planAnnual')
+ : license?.plan === 'lifetime'
+ ? t('premium.planLifetime')
+ : 'Premium'}
</Badge>
) : (
<Badge variant="outline" className="text-destructive border-destructive/40">
- {license?.reason === 'expired' ? 'Expired' : 'Inactive'}
+ {license?.reason === 'expired' ? t('premium.expired') : t('premium.inactive')}
</Badge>
)}
</div>
<p className="text-xs text-muted-foreground">
- {licensed && license?.plan === 'lifetime' && 'Lifetime license: never expires.'}
+ {licensed && license?.plan === 'lifetime' && t('premium.lifetimeNote')}
{licensed && license?.plan === 'annual' && !license.cancelAtPeriodEnd && license.expiresAt &&
- `Renews on ${fmtDate(license.expiresAt)}.`}
+ t('premium.renewsOn', { date: fmtDate(license.expiresAt) })}
{licensed && license?.plan === 'annual' && license.cancelAtPeriodEnd && license.expiresAt &&
- `Will not renew. Premium until ${fmtDate(license.expiresAt)}, then this install falls back to the free monthly catalog.`}
+ t('premium.willNotRenew', { date: fmtDate(license.expiresAt) })}
{!licensed &&
- 'This key is no longer active. The app keeps working on the free monthly catalog.'}
+ t('premium.keyInactive')}
</p>
<div className="flex flex-wrap items-center gap-2">
<Button variant="outline" size="sm" onClick={() => openPortal.mutate()} disabled={openPortal.isPending}>
<ExternalLink />
- {openPortal.isPending ? 'Opening…' : 'Manage subscription'}
+ {openPortal.isPending ? t('premium.openingPortal') : t('premium.manageSubscription')}
</Button>
<Button
variant="ghost"
@@ -182,12 +183,11 @@ export default function PremiumPage() {
disabled={removeKey.isPending}
className="text-muted-foreground"
>
- Remove key from this device
+ {t('premium.removeKey')}
</Button>
</div>
<p className="text-[11px] text-muted-foreground">
- Manage subscription opens Stripe&apos;s billing portal: cancel, update your card, or download
- invoices. Removing the key only deactivates this device; your purchase is untouched.
+ {t('premium.manageHint')}
</p>
{openPortal.isError && (
<p className="text-destructive text-xs">{(openPortal.error as Error).message}</p>
@@ -203,7 +203,7 @@ export default function PremiumPage() {
}}
>
<div className="space-y-1.5 flex-1 min-w-[260px]">
- <Label className="text-xs">License key</Label>
+ <Label className="text-xs">{t('premium.licenseKey')}</Label>
<Input
value={keyInput}
onChange={(e) => setKeyInput(e.target.value)}
@@ -213,16 +213,16 @@ export default function PremiumPage() {
/>
</div>
<Button type="submit" size="sm" disabled={!keyInput.trim() || activate.isPending}>
- {activate.isPending ? 'Activating…' : 'Activate'}
+ {activate.isPending ? t('premium.activating') : t('premium.activate')}
</Button>
</form>
{activate.isError && (
<p className="text-destructive text-xs">{(activate.error as Error).message}</p>
)}
<p className="text-xs text-muted-foreground">
- Your key is in your purchase email and on the post-checkout page. Lost it?{' '}
+ {t('premium.keyHint')}{' '}
<a className="underline hover:text-foreground" href={`${siteUrl}/manage.html`} target="_blank" rel="noopener noreferrer">
- Recover it on the website
+ {t('premium.recoverKey')}
</a>
.
</p>
@@ -237,10 +237,9 @@ export default function PremiumPage() {
<div className="flex items-start gap-3">
<Sparkles className="size-4 mt-0.5 text-muted-foreground" />
<div>
- <p className="text-sm font-medium">Go live for $19 a year</p>
+ <p className="text-sm font-medium">{t('premium.upsellTitle')}</p>
<p className="text-xs text-muted-foreground mt-0.5">
- New free models the moment they exist, instead of on the 1st of the month. One key, every
- device. Cancel anytime; the router stays free forever.
+ {t('premium.upsellDescription')}
</p>
</div>
</div>
@@ -251,7 +250,7 @@ export default function PremiumPage() {
className="shrink-0"
>
<Button size="sm">
- Go Premium
+ {t('premium.goPremium')}
<ExternalLink />
</Button>
</a>