PostgreSQL backup tool with Point-In-Time-Recovery and restore verification
TypeScript backupbackupsdatabasedatabase-backupdevopsdockergolangkubernetesmariadbmongodbmysqlpgpostgrespostgresqls3self-hostedsystem-administrationtoolsweb-ui
REFACTOR (docs): Archive the frontend translation change and add its spec
Rostislav Duginbdd0dd77baf4
diff --git a/openspec/changes/translate-frontend-ui/.openspec.yaml b/openspec/changes/archive/2026-09-19-translate-frontend-ui/.openspec.yamlsimilarity index 100%rename from openspec/changes/translate-frontend-ui/.openspec.yamlrename to openspec/changes/archive/2026-09-19-translate-frontend-ui/.openspec.yamldiff --git a/openspec/changes/translate-frontend-ui/README.md b/openspec/changes/archive/2026-09-19-translate-frontend-ui/README.mdsimilarity index 100%rename from openspec/changes/translate-frontend-ui/README.mdrename to openspec/changes/archive/2026-09-19-translate-frontend-ui/README.mddiff --git a/openspec/changes/archive/2026-09-19-translate-frontend-ui/design.md b/openspec/changes/archive/2026-09-19-translate-frontend-ui/design.mdnew file mode 100644index 00000000..84251135--- /dev/null+++ b/openspec/changes/archive/2026-09-19-translate-frontend-ui/design.md@@ -0,0 +1,422 @@+## Context++See proposal.md - Why.++The state that shapes the approach:++- `frontend/src` is 32,700 lines. Strings are inlined at their point of use, with no copy layer. A crude grep finds 299 text attributes, 411 JSX text nodes and 136 literals in `.ts` files; the real count is closer to 1,500 once multi-line JSX, template literals, option arrays and `alert()` calls are included. Running `i18next/no-literal-string` (plugin 6.1.5) over today's `src`, tests excluded, reports 1,010 literals in `jsx-text-only` mode, 1,957 in `jsx-only` and 2,812 in `all`. The higher counts mix copy with structural strings; see the lint decision. Per slice, `jsx-text-only` counts `features/settings` 20, `databases` 246, `restores` 21, `healthcheck` 15, `workspaces` 44, `users` 73, `verification` 103, `notifiers` 127, `backups` 199, `storages` 136, `widgets/main` 14, `shared/ui` 8 and `pages` 4.+- Copy is not confined to `ui/` segments. `entity/databases/model/postgresql/ConnectionStringParser.ts:45,64,112-124` returns error prose, `entity/notifiers/models/getNotifierNameFromType.ts` returns display names, and `entity/storages/models/getStorageNameFromType.ts:6` returns `'local storage'` in lower case so it can sit in the middle of a sentence. The dictionary has to be reachable from `entity/` and `shared/`, which puts it in `shared/`.+- About thirty label tables and option arrays are module-level constants, evaluated once when the module is imported: `features/notifiers/lib/notificationTypeLabels.ts:3,13`, the weekday, interval, period and notification tables at `features/backups/logical/ui/ShowLogicalBackupConfigComponent.tsx:30-62`, the retention options at `features/backups/logical/ui/EditLogicalBackupConfigComponent.tsx:64`. The short weekday names alone exist in six copies: `ShowLogicalBackupConfigComponent.tsx:30`, `EditLogicalBackupConfigComponent.tsx:54`, `PhysicalIntervalEditor.tsx:23`, `ShowPhysicalBackupConfigComponent.tsx:30`, `EditBackupVerificationConfigComponent.tsx:38`, `ShowBackupVerificationConfigComponent.tsx:24`.+- Status labels already exist in several shapes. `features/backups/physical/model/physicalBackupStatus.ts:39` and `features/backups/logical/model/restoreVerificationStatus.ts:25` hold label tables; the second is a `Partial` with no `NOT_VERIFIED` entry, because that status never shows a tag: `LogicalBackupsComponent.tsx:56` returns nothing for it before any lookup. `features/verification/agents/model/agentStatus.ts:28` labels `AgentStatus`, a union type the frontend derives from heartbeat timestamps (`agentStatus.ts:7`). Four components render statuses with their own copy of the words: `VerificationDetailDrawer.tsx:51`, `VerificationsComponent.tsx:58`, `LogicalBackupsComponent.tsx:386`, `PhysicalBackupsComponent.tsx:55`.+- Other enums reach the screen through label functions and switches: `getStorageNameFromType`, `getNotifierNameFromType`, `getDatabaseTypeLabel`, `entity/databases/model/sshtunnel/sshTunnelAuthTypeLabels.ts:3`, and role labels in three shapes: `getRoleDisplayText` in `features/users/ui/ProfileComponent.tsx:16` and in `features/workspaces/ui/WorkspaceMembershipComponent.tsx:292`, and inline option labels in `features/users/ui/UsersComponent.tsx:237,241` with a second select from `:330`.+- Copy carries inline markup: across `.tsx` files there are 40 `<code>`, 15 `<strong>`, 7 `<a>` and 2 `<b>` elements inside text, and 50 `<br />`. `entity/databases/model/postgresql/physical/physicalConnectionErrorContent.ts:4-20` builds its own rich text out of text runs flagged `isBold`.+- Some sentences are assembled from pieces: `Notify to {…}` at `features/notifiers/ui/NotifierCardComponent.tsx:27`, `Type: {…}` at `features/storages/ui/StorageCardComponent.tsx:27`, `Last backup {…fromNow()}` at `features/databases/ui/DatabaseCardComponent.tsx:75`.+- Two places build English plurals by hand: `features/workspaces/ui/WorkspaceMembershipComponent.tsx:517` (`member${… !== 1 ? 's' : ''}`) and `features/workspaces/ui/WorkspaceSettingsComponent.tsx:148` (`database(s)`).+- `main.tsx:11` enables dayjs's `relativeTime`, and there are 27 `fromNow()` calls in 19 files, among them `DatabaseCardComponent.tsx:75`, `features/settings/ui/AuditLogsComponent.tsx:160,198` and `features/users/ui/UserAuditLogsSidebarComponent.tsx:135`.+- Components take `message` and `modal` from `App.useApp()` (for example `LogicalBackupsComponent.tsx:83`), so the locale given to AntD's `ConfigProvider` reaches confirmation dialogs and toasts without extra wiring.+- `ThemeProvider` (`shared/theme/`) already establishes the pattern for a user preference: React context, `localStorage`, a toggle in the header. Locale follows it rather than inventing a second shape.+- `ThemeToggleComponent` already renders at three call sites: `widgets/main/MainScreenComponent.tsx:254`, `widgets/main/SidebarComponent.tsx:132` and `features/users/ui/AuthNavbarComponent.tsx:49`. Merging the language control into it covers the navbar, the narrow-viewport sidebar and the pre-login screen in one move.+- The website's `website/app/components/LanguageSelectorComponent.tsx` is working prior art, including an `isSplitEnd` variant that glues the selector to a neighbouring button as one split control. `website/app/i18n.ts:41` lists the pages the website publishes in every language (`TRANSLATED_PATHS`), and translated pages keep the English anchor ids (`website/app/[lang]/access-management/content/ru.tsx:290` has `id="global-settings"`). The frontend has 24 references to databasus.com: links to documentation pages, to the home page (`features/users/ui/AuthNavbarComponent.tsx:9,15`, `widgets/main/MainScreenComponent.tsx:200`), which `TRANSLATED_PATHS` lists as `""`, to the untranslated `/sponsorship` (`shared/ui/SponsorshipLinkComponent.tsx:12`), and one example icon URL used as a form placeholder (`EditMattermostNotifierComponent.tsx:196`).+- ESLint uses flat config (`tseslint.config(...)`). There is no `overrides` key; per-directory rules are additional config objects. `eslint-plugin-react` is installed, but its `jsx-no-literals` rule is not enabled: `react.configs.recommended` (`frontend/eslint.config.js:29`) leaves it off.+- `shared/api/apiHelper.ts:32-35` already parses `json.code` into `ApiError.code`, and `EditPostgreSqlPhysicalSpecificDataComponent.tsx:204` already branches on it. The error-code contract exists in one place and needs generalizing, not inventing. The failure paths around it put English plumbing in front of the user. When the error body carries no message, `apiHelper.ts:44-46` fills `ApiError.message` with the code itself, or with `${url}: request failed with status ${status}` when there is no JSON body; the `response.text()` fallback at `:37-41` never succeeds, because `response.json()` has already consumed the body. HTTP 502 and 504 throw a plain `Error('failed to fetch')` (`:20-21`). When the server cannot be reached at all, `fetch` rejects (`:59`) and, after the retries, the browser's own `TypeError` ("Failed to fetch", "NetworkError when attempting to fetch resource.") is rethrown unchanged (`:68`). `ApiError` (`shared/api/ApiError.ts:7`) carries only `message` and `code`. The `alert(e.message)` calls show all of this to the user, and so do the components that put an error's message into their own state, such as `setError((e as Error).message)` in `features/users/ui/ResetPasswordComponent.tsx:108`: 121 places read an error's message. One of them decides by matching text: `describeRestoreError` (`features/backups/physical/ui/PhysicalRestoreComponent.tsx:34-44`) picks a hint by searching the message for `409` and `422`, which only the fallback text contains, and for the English words `in progress` and `gap` in the backend's message. Separately, `features/users/ui/RequestResetPasswordComponent.tsx:54` shows the backend's success text for a password reset request as-is.+- `shared/ui/ConfirmationComponent.tsx:27` renders its `description` prop as HTML through `dangerouslySetInnerHTML`. Eight files use the component, and `features/restores/ui/RestoresComponent.tsx:366` relies on that: its description carries `<strong>` and `<br/><br/>` markup.+- There are 14 test files. Vitest runs in the `node` environment with no DOM (`frontend/vitest.config.ts:5`), so tests cover functions, not rendered screens. Three of them assert English error text: `ConnectionStringParser.test.ts:159`, `MySqlConnectionStringParser.test.ts:186`, `MongodbConnectionStringParser.test.ts:308`.+- CI runs `pnpm test` on a full checkout (`.github/workflows/ci-release.yml:155-161`). The Docker image build copies only `frontend/` and runs `pnpm build` (`Dockerfile:12,21`).++The website solved the same problem differently, with five full page copies per page and no dictionaries. That works there because each URL needs its own static HTML for search engines and the pages are prose. Applying it here would mean 525 component copies held structurally in sync. The application diverges deliberately.++### Rules that constrain the approach++- Root `AGENTS.md:38-40`: target-language text lives in `frontend/src/shared/i18n/locales/<locale>.ts` and nowhere else under `frontend/`. This decides three things below: each locale is exactly one file, the language switcher's native names come from the dictionaries, and the glossary of interface terms cannot live under `frontend/`.+- `frontend/AGENTS.md` FSD MUST rule 4 says shared holds only infrastructure, and the dictionaries are domain-scoped (`backups`, `databases`, `storages`). The reading this design adopts: the provider, `t()` and the locale wiring are infrastructure, and copy strings carry no domain calculation, so `shared/i18n` is the right layer. The alternative reading, that copy is domain content belonging in `entity/`, would scatter one dictionary across seven slices and break the single-source-of-truth typing that the whole approach rests on. Recorded here so it is a decision rather than an oversight. The table of website pages sits in `shared/i18n` on the same grounds; `frontend/AGENTS.md:135` already places route constants in `shared/`.+- `frontend/AGENTS.md:138` puts app-wide providers in an `app/` layer. The frontend has no such layer: `App.tsx` and `main.tsx` sit at the root of `src/`, and `ThemeProvider` lives in `shared/theme/`. `LocaleProvider` follows `ThemeProvider` into `shared/i18n`, because its context and `useLocale` must be importable from `entity/` and `features/`. Splitting the provider component into the root of `src/` and keeping only the context and hook in `shared/i18n` was rejected: it divides one unit between two places to honour a layer the codebase does not have, and makes the two preference providers differ in shape.+- FSD MUST rules 1 and 2 (downward-only imports, public API through `index.ts`) decide where label tables go: next to the type they label, exported through that slice's `index.ts`.+- FSD MUST rule 5 (one type per file in `model/`) gives `LocalizedText` its own file.+- `frontend/AGENTS.md:103` (plain hyphen in user-visible strings) is scoped to English; see the translation-rules decision.+- `website/AGENTS.md:47-55` ("Translation quality") governs how each non-English dictionary is written.++## Goals / Non-Goals++**Goals:**++- A forgotten translation is a compile error, not a runtime fallback.+- The migration is a burn-down with a machine-checkable finish line, not an open-ended sweep.+- Each language reads as if written in it, so the key is the identity and the English text is just the English value.+- Switching the language re-renders what is on screen without losing it: open drawers stay open, unsaved form input stays. (Modal dialogs and masked drawers cover the navbar, so the control is reachable only from the page itself or from the narrow-viewport sidebar, which contains it.)++**Non-Goals:**++- Right-to-left languages. None of the six need it, and no layout work assumes it.+- Lazy-loading dictionaries per feature slice. One dictionary per language, loaded whole. Revisit if a dictionary passes a few hundred KB.+- Machine translation in the build. Translations are written and reviewed, like the website's.+- Messages that change with grammatical number. See "Counts are phrased so one string fits every number".++## Decisions++### Dictionaries, not per-language component copies++See Context. Component reuse is the deciding factor: the same `EditStorageComponent` serves six languages, so language must be a runtime lookup rather than a file variant.++### `i18next` + `react-i18next`++Alternatives considered:++- **LinguiJS.** Rejected on the key strategy. Lingui uses the English source text as the key, so editing an English phrase silently invalidates all five translations. Since each language is written independently rather than rendered literally, keys must be stable and text-independent.+- **A hand-rolled `t()`, roughly 60 lines.** Attractive given the project's tight dependency budget (AntD only, one icon set). Plural rules do not decide it, since counts are phrased without plural forms. What decides it is `Trans`, which renders the ~60 sentences with inline markup, and `useTranslation`, which re-renders a component when the language changes. A hand-rolled version would rebuild both.+- **`react-intl` / FormatJS.** Comparable, but a heavier compile step for ICU messages than this codebase needs.++Versions: `i18next` 26.4.2, `react-i18next` 17.0.14 and `eslint-plugin-i18next` 6.1.5 are current as of 2026-09-18, and the change pins those major versions.++Required configuration:++- `nsSeparator: false`, otherwise a key containing a colon is misparsed as a namespace reference.+- `interpolation.escapeValue: false`, since React escapes `t()` output rendered as a child.+- `react.transKeepBasicHtmlNodesFor: []`. By default react-i18next turns `<br>`, `<strong>`, `<i>` and `<p>` in dictionary text into elements even when no component supplies them (`src/defaults.js:10` in 17.0.14). With an empty list only supplied tags become elements, so dictionaries use named tags such as `<bold>` and `<code>` that each call site maps, and a stray `<strong>` in a translation shows as text.+- `react.transDefaultProps: { shouldUnescape: true, tOptions: { interpolation: { escapeValue: true } } }`, because `Trans` is the exception to the `escapeValue` line above. It interpolates `values` into the sentence before parsing the sentence for tags, so with escaping off a value such as `<strong>bold</strong>` or `<code>x</code>` becomes a real element. Attributes are dropped, so `<img src=x onerror=…>` stays inert, but the value no longer appears as entered. With these defaults every `Trans` escapes values before parsing and unescapes them into plain React text afterwards, so `<strong>bold</strong>` and `Tom & Jerry` render literally, and tags the component does not supply (`<host>:<port>`) render as text.+- `fallbackLng: 'en'` as a last-resort runtime guard only. Completeness is enforced by types (below); the fallback exists for a dictionary that failed to load, not for a missing key.+- Resources passed inline at `init`. With inline resources, initialization finishes synchronously (`i18next` 26.4.2, `dist/esm/i18next.js:1909`), so the first render already has the stored language's dictionary.++`returnNull: false` is not listed: it is the default since i18next 23 (`dist/esm/i18next.js:1714` in 26.4.2).++### Translated text stays text++The two `Trans` settings above keep dictionary text and interpolated values from becoming markup. Two more rules and one accepted limitation follow. Everything in this section was checked with react-i18next 17.0.14 and i18next 26.4.2 through `react-dom/server`.++`Trans` has one more quirk the settings do not fix: it interpolates text again after parsing, so a value that itself contains `{{name}}` is expanded a second time (`a {{name}} b` rendered as `a a {{name}} b b`). A user-entered value therefore never enters `Trans` through `values`. The dictionary holds a self-closing tag in its place (`Delete <workspaceName/>?`), and the component supplies an element whose child is the value (`components={{ workspaceName: <strong>{name}</strong> }}`). React renders that child as text, and `Trans` neither parses nor interpolates it. An empty pair `<workspaceName></workspaceName>` does not work: it drops the element's own children. `values` stays for data the product controls: numbers, dates, product names.++Plain `t()` has a milder form of the same quirk, and it is accepted. In a message with two placeholders, a value that contains the other placeholder's `{{…}}` text gets that text expanded, and the message's own placeholder is left raw: `Workspace {{name}} deleted ({{count}})` with the name `a {{count}}` and a count of 3 comes out as `Workspace a 3 deleted ({{count}})`. `skipOnVariables`, on by default, does not prevent it. The output is still text, never markup.++No translated text is rendered as HTML. One component does so today, `ConfirmationComponent.tsx:27`. Its `description` becomes a `ReactNode` rendered as a child, and the description at `RestoresComponent.tsx:366` becomes a `Trans` key with `<bold>` plus a second key for the question after the line breaks. This lands before the first slice, because callers in `features/databases` and later slices migrate before the component's own slice does. The spec states the behavior as its own security requirement, task 1.7 pins it with a unit test, and the final verification checks that `dangerouslySetInnerHTML` no longer appears in `src`.++Alternatives considered:++- **Routing every user-entered value through `Trans` elements, including in plain `t()` messages.** It would fix the `t()` quirk, but it would also rule out consumers that need a plain string, such as `alert()` and the document title, to fix a case that only occurs when a name contains placeholder syntax.+- **Keeping `ConfirmationComponent`'s HTML description and escaping values before they reach it.** Every caller would have to escape correctly, and one miss is an injection point.++### Type safety comes from the locale files, not the library++This is the load-bearing decision, and no library provides it out of the box: i18next falls back at runtime, Lingui reports gaps in a CLI run. Both are checks a person can ignore.++Two independent layers:++```+shared/i18n/locales/en.ts <- source of truth for the key set+ export const en = { backups: { logical: { title: 'Logical backups' } } }+ | |+ layer 1: valid keys layer 2: complete dictionaries+ declare module 'i18next' { locales/ru.ts:+ interface CustomTypeOptions { import type { en } from './en'+ resources: { translation: typeof en }+ } export const ru: typeof en = { ... }+ }+ t('backups.logical.titel') fails missing key OR stray key fails tsc -b+```++`const ru: typeof en` is an exact structural check including nesting: it rejects a missing key and a leftover one alike.++While the slices are migrated, each dictionary is split into one file per namespace (`locales/en/<ns>.ts`, `locales/ru/<ns>.ts`), so slices migrated in parallel edit different files. Each Russian namespace is typed `typeof <ns>En` and written as one literal, so a missing, stray or nested stray key still fails `tsc` with the key named. The split is temporary: a task before the remaining languages folds every namespace back into one literal per locale and deletes the folders, which leaves the shape described here. `en` is declared without `as const`, so values widen to `string` and translations are not forced to match the English text.++The check that rejects a stray key (TypeScript's excess-property check) applies only to an object literal written in place. A nested object that arrives through a variable or a spread escapes it: `const ru: typeof en = { backups: ruBackups }` accepts a stray key inside `ruBackups` (checked with tsc 5.8). Each dictionary therefore stays one literal in one file, which is also the only shape the root `AGENTS.md:38` permits. Splitting by domain would be possible with `satisfies` on every part, but the rule names one file per locale, and a file of a couple of thousand lines is still navigable by key.++Code that stores a key rather than calling `t()` directly types it as `TranslationKey`, an alias for i18next's `ParseKeys` (`typescript/t.d.ts:151`), so a table of keys gets the same check as a call site.++The `import type` link from each translation to `en` is erased at build time, so the English dictionary does not end up in the Russian bundle.++Consequence worth naming: a language cannot be added partially. Either its dictionary is complete or the build is red. That is why the four remaining languages come last, after the key set has settled.++### Placeholders are checked by a test, not by types++Because `en` widens its values to `string`, i18next cannot see which `{{placeholders}}` a message uses. A Russian value that drops `{{name}}`, or a Chinese one that renames it, passes `tsc -b` and renders a sentence with a hole in it.++A unit test walks every key of `en` and asserts that each other dictionary's value uses the same set of `{{…}}` names and the same set of `Trans` tags.++Alternatives considered:++- **`as const` on `en`.** i18next would then type interpolation values, but `typeof en` would demand the English text itself in every translation, which makes the completeness check unusable.+- **Template-literal types that extract placeholders from ~1,500 strings.** Correct, but slow for `tsc` on every build to do what a 30-line test does.++What stays unchecked is the parameter name at a `t()` call site; review covers it.++### Counts are phrased so one string fits every number++i18next stores plural forms as sibling keys with suffixes: English needs `_one` and `_other`, Russian `_one`, `_few`, `_many` and `_other`, Chinese only `_other`. Under `const ru: typeof en`, Russian's `_few` is a stray key: tsc rejects it with TS2561 (checked with tsc 5.8). The type check and i18next's plurals cannot both hold.++Only two places pluralize today (see Context), so counts are phrased as a label and a number, `Members: 5` / `Участников: 5` / `Membres : 5`, or as a sentence whose wording does not depend on the number. The convention goes into `frontend/AGENTS.md`.++Alternatives considered:++- **i18next plurals as designed.** Rejected: Russian cannot express them under the completeness check, and Chinese would be forced to carry an `_one` it never uses.+- **An English dictionary carrying every suffix any language needs.** `en` would hold `_few` and `_many` values nobody reads, and each new language could add suffixes to every plural key in `en`.+- **ICU messages through `i18next-icu`.** One key per message, so `typeof en` keeps working, but it adds a dependency and a message syntax for two call sites. If copy that depends on grammatical number grows, this is the route to take.+- **A mapped type that expands `_one`/`_other` into each language's forms.** Correct, but type machinery for two call sites.++### Keys are domain-scoped, not path-scoped++`t('backups.logical.emptyState.title')`, not `t('features.backups.logical.ui.EditLogicalBackupConfigComponent.emptyState.title')`.++Top-level namespaces follow the domain, not the file tree: `backups`, `databases`, `storages`, `notifiers`, `verification`, `workspaces`, `users`, `settings`, `status`, `errors`, `common`, `language`. A path-shaped key would look tidy today and rot at the first component move, and FSD already permits a component to migrate between `pages/`, `features/` and `entity/` as consumers appear.++### Code outside components hands out keys, not text++A module-level constant is evaluated once, when its module is first imported. If `NOTIFICATION_TYPE_OPTIONS` called `t()`, the options would stay in the language that was active at import time. A parser that returns translated prose has a similar problem: the error sits in component state and stays in the old language after a switch.++So constants, label tables and functions outside components hold or return keys, and the component resolves them with `t()` while rendering. A stored key that needs inline markup goes through `TransByKey` in `shared/i18n`: `Trans` cannot type-check an `i18nKey` typed as the whole key union (TypeScript stops with TS2590 once the union is a few hundred keys long), so the wrapper takes a `TranslationKey` and hands it on. A function that needs parameters returns a `LocalizedText`, `{ key: TranslationKey; params?: Record<string, string | number> }`, defined in its own file in `shared/i18n`. The connection string parsers return `{ error: LocalizedText }`, and their tests assert the key instead of English words. Eleven of their failure messages append the thrown error's text today (`Failed to parse connection string: ${(e as Error).message}`, for example at `ConnectionStringParser.ts:137`); the keys that replace them drop that detail, because it is the browser's English text, which the backend-errors decision also keeps off the screen.++Alternatives considered:++- **Calling `i18n.t` inside the constant or function.** A constant freezes the language of its first import, a stored result keeps the old language after a switch, and tests would need an initialized i18n instance to read English text back.+- **Getter functions such as `getWeekdayOptions()`, called during render.** They work, but every call site must remember to call inside render, and nothing flags a call hoisted to module level. A table of keys cannot go stale.++### Enum labels become typed tables of keys++Every enum shown to the user gets a `Record<Enum, TranslationKey>`: the six status enums shown as labels (`VerificationStatus`, `RestoreStatus`, `LogicalBackupStatus`, `PhysicalBackupStatus`, `RestoreVerificationStatus`, `HealthStatus`), `AgentStatus`, and the labelled enums listed in Context (storage and notifier types, database types, SSH auth types, notification types, intervals, periods, retention policies, roles). `AddMemberStatusEnum` gets no table: it only decides which branch the add-member flow takes (`WorkspaceMembershipComponent.tsx:172-175`) and is never shown.++It is an explicit `Record`, not a template key:++```ts+// no: a dynamic key defeats the type check entirely+t(`status.verification.${status}`)++// yes: adding an enum member leaves the Record incomplete and fails the build+export const VERIFICATION_STATUS_LABEL_KEYS: Record<VerificationStatus, TranslationKey> = { ... }+```++Tables are named `<TYPE>_LABEL_KEYS`, following the existing `SCREAMING_SNAKE` tables, and the converted ones are renamed to match: `PHYSICAL_BACKUP_STATUS_LABELS` becomes `PHYSICAL_BACKUP_STATUS_LABEL_KEYS`, `AGENT_STATUS_LABELS` becomes `AGENT_STATUS_LABEL_KEYS`, and so on.++A table lives next to the type it labels, in its own file (`VerificationStatusLabelKeys.ts` beside `entity/verification/runs/models/VerificationStatus.ts`), re-exported from the slice's `index.ts`. For the enums in `entity/`, the label parts of `physicalBackupStatus.ts` and `restoreVerificationStatus.ts` move to the enum's slice; their badge styles are presentation and stay in the feature. `AgentStatus` is a feature's own type, so its table stays in `features/verification/agents/model/`.++A new table replaces the old label source outright. `getStorageNameFromType`, `getNotifierNameFromType`, the `getRoleDisplayText` switches and the six weekday copies are deleted by the slice task that migrates their last consumer; no function keeps returning English text alongside the table.++The rejected alternative is keeping tables where they are used. Two features showing the same enum would each hold a table, and the copies drift; that is how the four status render functions came about.++`RESTORE_VERIFICATION_STATUS_LABELS` becomes `RESTORE_VERIFICATION_STATUS_LABEL_KEYS: Record<RestoreVerificationStatus, TranslationKey | null>` with `NOT_VERIFIED: null`. "No tag" becomes an explicit value, and adding a member still fails the build. Keeping the `Partial` would silently exempt this enum from the guarantee.++Weekdays get one table of seven keys that replaces the six copies, next to the interval model in `entity/intervals`. Taking the names from `Intl.DateTimeFormat` or dayjs instead was rejected: they come back in lower case in Russian, French, Spanish and Portuguese (`пн`, `lun.`) and with trailing periods in some, so each language would need casing fix-ups that cost more than seven keys.++Period labels such as `3 months` are one key per enum value. Each is a fixed phrase, so they need no plural handling.++Components keep their own markup (a tag here, an icon and span there) and take the words from one place. This deduplicates as a side effect; that is a bonus, not the goal.++### Sentences stay whole++A translator can only reorder a sentence that reaches them as one piece. Two rules follow.++Inline markup goes through `Trans`. The dictionary holds the whole sentence with named tags (`Run <code>pg_dump</code> on the server`), and the component supplies the elements: `components={{ code: <code />, docsLink: <a href={…} /> }}`. A translator can move the tag to wherever the language puts it. With the project's `Trans` configuration (see the i18next decision), only the tags the component supplies become elements, and a user-entered value is supplied as an element's child rather than interpolated. Where `<br />` separates two sentences, they become two keys. The physical connection errors follow the same rule: each note becomes one key with `<bold>` tags instead of a list of text runs, and commands stay literal. `managedNote(username)` renders as plain text (`EditPostgreSqlPhysicalSpecificDataComponent.tsx:445`), so it becomes a key resolved with `t()` and `{{username}}`, not a `Trans` sentence.++Values are interpolated into a full sentence, never concatenated with translated fragments. An inserted value is a name or a piece of data that does not inflect: a user-entered name, a product name (Telegram, S3, Google Drive), a number or a date. When the inserted word is a common noun that a language would inflect, like `getStorageNameFromType.ts:6`'s `'local storage'`, each value gets its own sentence key (`storages.card.type.local`).++Alternatives considered:++- **Splitting a sentence around its markup into several keys.** The fragments are glued in English order, and Russian or Chinese needs a different one.+- **HTML strings in the dictionary, rendered with `dangerouslySetInnerHTML`.** Rejected on security grounds: it bypasses React's escaping and turns every dictionary value into an injection point.+- **ICU `select` for inflected values.** Same dependency trade-off as for plurals, for a handful of sites.++### Locale-dependent output is read through hooks++When `LocaleProvider` publishes a new locale, React re-renders the components that consume its context, and `react-i18next` re-renders the components that call `useTranslation`. A component that calls `dayjs(date).fromNow()` or a number formatter without either keeps the old language until something else re-renders it.++Translated text therefore comes from `useTranslation`, and relative times and grouped numbers come from `useLocale()`, which exposes `formatNumber` and `formatRelativeTime`. The 27 `fromNow()` calls switch to `formatRelativeTime` as their slices are migrated, so afterwards `fromNow()` appears only inside the formatter; the lint rule cannot see this, so the final verification checks it with grep. The provider switches `dayjs.locale` and `i18n.changeLanguage` before it publishes the new value. The tree is never remounted.++Alternatives considered:++- **`key={locale}` on the tree.** The simplest guarantee that everything updates, but every switch remounts the application: open drawers close and unsaved form input is lost.+- **Setting the global `dayjs.locale` and nothing else.** Components update only on their next unrelated render.++### The lint rule is what makes the migration finite++`eslint-plugin-i18next`, rule `i18next/no-literal-string`, in `all` mode over `*.{ts,tsx}`.++The plugin's default mode is `jsx-text-only` (`lib/options/defaults.js:3` in 6.1.5), which covers the same ground as `react/jsx-no-literals`: JSX text nodes only. Measured on today's `src`, it misses 133 `placeholder` attributes, 126 `title` attributes, 53 `message.error` and `message.success` texts, 45 parser error strings, 44 option labels in arrays, and the button and body texts of confirmation dialogs (`okText`, `cancelText`, `actionText`, `description`). `jsx-only` adds attributes but still misses every call and every `.ts` file. Only `all` covers the copy that lives outside JSX.++`all` also reports structural strings, and they fall into recurring classes: `size` (234 reports, mostly `"small"`), `key` and `dataIndex` (76), request headers (33), query parameter names (46), icon paths and colour values. Exclusions are configured per class:++- JSX attributes: an exclude-list of props that never carry copy (`size`, `type`, `mode`, `rowKey`, `color`, `variant`, `placement`, `direction`, `autoComplete`, `path`, `value`, `htmlType`, …). An exclude-list rather than an include-list, because a copy prop missing from an include-list goes unchecked without anyone noticing, while a non-copy prop missing from an exclude-list shows up as a lint error that someone fixes.+- Callees: `console.*`, header and query-parameter builders, `document.createElement`, and state setters that take identifiers.+- Object properties: `key`, `dataIndex`, `type`, `format`, `icon`, `cache`, `okType`, `defaultSortOrder`.+- Words: URLs and absolute paths.+- Files: `*.test.ts`, and `api/` segments, which hold request plumbing. The user-visible text there, `failed to fetch` at `shared/api/apiHelper.ts:21` and the status fallback at `apiHelper.ts:44-46`, is replaced by frontend-side error codes that `translateApiError` resolves (task 3.1), so the exclusion hides no copy.++The exact lists are pinned in task 2.1 from these report classes. One-off cases take an inline suppression with a stated reason, which keeps the config from turning into a dumping ground.++Three details of the configuration came out of building it:++- The plugin skips every literal inside a variable with a SCREAMING_SNAKE name and every default parameter value, and no option turns that off. Module-level label tables are where copy hides, so `eslint.config.js` wraps the rule and routes both node types through the handler for an ordinary variable. A technical constant such as a `localStorage` key takes an inline suppression.+- The rule runs with type information (`parserOptions.project`). A literal whose expected type is a union of string literals is skipped, which removes the `TranslationKey` values in label tables and props such as `size="small"` without an exclusion each. The flip side: a prop typed `'Save' | 'Cancel'` would pass, so copy is never typed as a literal union.+- Callee exclusions (`replace`, `split`, `join`, `get`, ...) also skip the string the method is called on, so `'Deleted {name}'.replace('{name}', name)` passes. No copy is built that way, and the sentence rules forbid it anyway; review covers it.+- The dictionaries (`locales/**`) are ignored, since they are the copy. During the migration a temporary `eslint.i18n-check.js` applies the rule to directories not yet enabled, so a slice can be checked before its entry lands; it is deleted when the entries collapse.++The rule is enabled per directory as each slice lands:++```js+{+ files: ['src/features/settings/**/*.{ts,tsx}'],+ plugins: { i18next },+ rules: { 'i18next/no-literal-string': ['error', i18nextLiteralStringOptions] },+},+```++When the last slice is migrated, the per-directory entries collapse into one entry over `src/**/*.{ts,tsx}`. That entry passing `pnpm lint` is the finish line: no user-facing literal is left anywhere in `src`.++Slices are migrated smallest first, so the infrastructure is debugged on `features/settings` rather than `features/databases`.++### The language control is merged with the theme control++The website's selector is the reference: a compact button showing the current language, a dropdown listing all six by native name, opening on `onMouseEnter` and closing on `onMouseLeave`, with the panel using top padding rather than a margin so the hover area between button and list stays contiguous. That detail is not cosmetic; a gap makes the dropdown close while the pointer crosses it.++Rather than adding a second standalone button, the language selector and the theme selector become one paired control, split down the middle, the way the website glues its selector to the GitHub button. Two reasons: the navbar has no room for a third control at narrow widths, and the two settings are the same kind of thing (a per-browser display preference), so grouping them is honest rather than decorative.++The paired control, `LanguageThemeControlComponent` in `shared/ui`, composes a new `LanguageSelectorComponent` (named after the website's) with the existing `ThemeToggleComponent`, which stays as the theme half and gains the split styling. The paired control takes `ThemeToggleComponent`'s place at its three existing call sites, which is what satisfies the spec's placement requirement without a separate placement task.++Alternatives considered:++- **A separate language button beside the theme button.** Simpler to build, but adds a third control to a navbar that already competes for width, and the website has already established the paired shape.+- **Language inside the theme dropdown as a submenu.** Fewer pixels, but buries a setting a first-time visitor needs to find immediately, and nested dropdowns on hover are fragile.++The language half is an AntD `Dropdown` with `trigger={['hover', 'click']}` rather than a copy of the website's hand-built panel. It matches the theme half's menu in both themes and keeps keyboard support, and AntD's leave delay keeps the list open while the pointer crosses from the button to the list; click is there for touch screens, which have no hover. The theme half keeps its click trigger.++### Each dictionary names its own language++The language list shows `English`, `Русский`, `Español`, `Português`, `中文`, `Français` in every interface language. Each dictionary holds its own language's name under `language.nativeName`, and the control reads the name from each locale's resources. All dictionaries are in the bundle anyway (see Risks), so this costs nothing at runtime.++Alternatives considered:++- **A constant like `LOCALE_NATIVE_NAMES` in `website/app/i18n.ts:31`.** It would put target-language text outside the dictionaries, which root `AGENTS.md:40` forbids, and would need a second rule amendment.+- **Every dictionary holding all six names.** Thirty-six strings, each written identically six times.++### Three surfaces that are not React state++Three things follow the language but sit outside the component tree, and each needs wiring the dictionary alone does not give:++- `index.html` hardcodes `<html lang="en">` and an English `<title>`. Both are set from the provider once the locale resolves. The `lang` attribute is what screen readers switch voices on and what stops the browser offering to translate a page already in the reader's language; the title is what a bookmark keeps.+- Eight `toLocaleString()` calls carry no locale argument, so they follow the browser rather than the selection. On an English browser with Russian selected, dates would read Russian and numbers English on the same screen. They are in `LogicalBackupsComponent.tsx:513,515`, `PhysicalBackupsComponent.tsx:49,52`, `VerificationDetailDrawer.tsx:45,48,157` and `StarButtonComponent.tsx:56`. The formatter moves to `shared/i18n` and takes the selected locale.+- The unit words stay English (`MB`, `GB`), only the digits regroup.++Two decisions this raises:++`index.html` is a static Vite entry, so its `lang` and `<title>` can only follow the language at runtime. They are set from `LocaleProvider` rather than from a separate `useDocumentLanguage` hook: the provider already owns the resolved locale and runs before first paint, and a second hook would need a consumer in the tree to fire at all, which is exactly the coupling the provider exists to avoid. The markup keeps English values as the pre-hydration fallback.++Chinese does not follow the website's number rule, and the spec deliberately says so. `website/AGENTS.md` fixes `zh 180 万` for millions, qualified as the form for prose. `(1800000).toLocaleString('zh')` returns `1,800,000`; the 万 form needs `Intl.NumberFormat` with `notation: 'compact'`. A row count in a table cell is not prose, and a compact form loses precision a size or a count needs, so the interface shows full grouped numerals in every language and reserves 万 for the website's marketing copy. Verified: `en 1,800,000`, `ru 1 800 000`, `fr 1 800 000`, `es/pt 1.800.000`, `zh 1,800,000`.++### Two axes: words follow the language, clocks follow the region++The product ships one control, and it selects a language. Formatting conventions are a second, independent axis, and conflating them silently is how a plan like this goes wrong. The split adopted here:++- Words follow the selected language. Labels, month and weekday names, component-library text, status labels.+- Digit grouping follows the selected language too. A user who picks French and reads `1,234.5` will file it as a bug, and the product gives them no other control to fix it. This is a deliberate simplification, not a claim that grouping is linguistic.+- Clock format and date order keep following the browser. `shared/time/getUserTimeFormat.ts:3,43` and `shared/time/utils.ts:5` derive 12-hour versus 24-hour and the day/month order from `navigator.language`, and they stay that way. Language does not determine these: English speakers use 12-hour in the United States and 24-hour in the United Kingdom, so deriving a clock from a language selection would be guessing. The browser reports the user's actual region, which is the better signal.++The residual oddity is that a French selection can show French month names above 12-hour AM/PM times. That is correct rather than inconsistent: the words are in the reader's language and the clock is in their region's convention.++Durations (`formatDuration`, `2h 15m 3s`) need no work under this split. They are technical readouts whose digits never reach a grouping threshold, and their unit letters stay English along with the other unit words.++### Locale persistence mirrors the theme++`localStorage` under `databasus-locale`. No user profile field: the backend has no notion of a user language, and adding one only becomes necessary when notifier emails need translating, which is outside this change.++Reading the stored value during provider initialization (as `ThemeProvider` does with `getStoredTheme`) is what satisfies the "no flash of English" scenario in the spec.++The supported languages are the dictionaries that exist: one list, `en` and `ru` while the slices are migrated, growing by one entry as each remaining dictionary is written. A stored value that is not in the list is treated as absent, so a removed language or an edited value falls back to detection instead of breaking the interface.++Initial detection reads the browser, not the operating system: a page cannot observe the system setting. What it has is `navigator.languages`, the browser's ordered preference list, which usually but not always follows the system.++The rule: walk `navigator.languages` in order, take the first entry whose primary subtag matches a supported language, fall back to English. Walking the list matters. A user whose preferences are `["de", "ru"]` genuinely prefers Russian over English, and checking only `navigator.language` would hand them English. The resolution is a pure function, `resolveInitialLocale({ storedLocale, browserLanguages, supportedLocales })`, so each rule has a unit test. It takes one object because two of its inputs are lists of language codes, and positional arguments of the same type swap without a compile error.++Region subtags are stripped, which forces two mappings that should be stated rather than discovered:++- `zh-TW` and `zh-HK` resolve to the Simplified Chinese dictionary, though their users read Traditional. Simplified is what the website ships and what this change ships.+- `pt-PT` resolves to the Brazilian Portuguese dictionary, matching `website/AGENTS.md`, which fixes Portuguese as pt-BR.++Both are the least-bad option while only one variant exists per language, and both are a reason to add a variant later rather than a defect to fix now. `website/app/i18n.ts` already carries the same kind of mapping in `HTML_LANG_CODES` (`zh: "zh-CN"`).++### Website links follow the selected language++When the website publishes a linked page in the selected language, the link opens `https://databasus.com/<lang>/<path>/`; otherwise, and always for English, it opens the English page. The trailing slash is the website's URL form (`website/AGENTS.md:43`). Anchors carry over unchanged because translated pages keep the English ids.++A typed table in `shared/i18n`, `WEBSITE_PAGES`, lists every website page the application links to: the documentation pages, the home page (path `""`) and the untranslated `sponsorship` page. Each entry has its path, an optional anchor and whether the website translates it. `getWebsitePageUrl(page, locale)` builds the URL. The link text is copy and lives in the dictionaries. The example icon URL in the Mattermost form is a placeholder value, not a link, and stays literal.++The table must agree with `TRANSLATED_PATHS` in `website/app/i18n.ts:41`. A unit test imports that file's source with Vite's `?raw` suffix, extracts the list, and asserts that every entry's translated flag matches its membership in both directions. This was checked in a scratch copy of the frontend:++- Vite refuses files outside the project root by default, so `frontend/vitest.config.ts` needs `server.fs.allow: ['..']`.+- A `?raw` import is typed by the `vite/client` ambient declarations (`src/vite-env.d.ts:1`), so `tsc -b` passes in the Docker build, where `website/` is absent.+- CI runs `pnpm test` on a full checkout, where the file exists.++The consequence: a website change that stops or starts translating a linked page fails the frontend test until the table follows. `website/AGENTS.md` gets a note next to its `TRANSLATED_PATHS` rule so the failure is not a surprise.++Alternatives considered:++- **Prefixing every link with the language.** Untranslated pages such as `notifiers/mattermost` and `sponsorship` would return 404.+- **A copy of the list with no test.** A page the website stops translating would 404 in the application, and nobody would notice.+- **Importing `website/app/i18n.ts` as a module.** `tsc -b` in the Docker build would fail without `website/`, tying the image build to the website tree.+- **Fetching a list from databasus.com at runtime.** Self-hosted installations may run without internet access, and the website would have to publish a new file.++### Backend errors: fix the frontend half of the contract now++The backend returns roughly 416 free-text English messages; 67 of the frontend's 78 `alert()` calls show `e.message`. Translating them is out of scope, but the frontend's handling is not: it standardizes on translating by `ApiError.code` and falling back to the backend's message. The backend can then acquire codes incrementally without any further frontend rework. `ConnectionErrorCode` in `backend/internal/features/databases/databases/postgresql/shared/connection_error.go` is the existing precedent on the backend side.++`ApiError.message` holds the backend's message and nothing else. `ApiError` gains a `status` field holding the HTTP status of every error response, and failures the backend never describes get frontend-side codes in the same `snake_case` form as `ConnectionErrorCode`:++- `network_unreachable` when the `fetch` call itself rejects (`apiHelper.ts:59`). Only that call's rejection is wrapped. The `catch` at `apiHelper.ts:62` also receives the `ApiError`s thrown by the response check, and those pass through unchanged; wrapping the whole `catch` would turn every backend error into `network_unreachable`.+- `request_failed` for HTTP 502 and 504 (`apiHelper.ts:20-21`) and for any error response without a JSON body (`apiHelper.ts:44-46`).++A code is never copied into the message, and the dead `response.text()` fallback at `apiHelper.ts:37-41` is deleted. In the same task, `describeRestoreError` switches to deciding by `status` alone: its number match stops working the moment the fallback text is gone, and its word matches (`in progress`, `gap`) are the matching on English text that this decision rejects. The hints it appends become keys. The password-reset success text is replaced by a frontend key when the `users` slice is migrated, since the frontend already knows the request succeeded.++`translateApiError(error, t)` lives in `shared/i18n/translateApiError.ts` and takes the calling component's `t`, so it is a pure function a unit test can drive. It resolves in order: a known code gives its translation (`request_failed` includes the status); otherwise the backend's message is shown as-is; otherwise a general translated message. It never shows the message of an error that is not an `ApiError`, since that text comes from the browser or a library, not from the backend. Each slice routes every place that shows an error's message through it, whether that is `alert()`, `message.error()` or a component's own error state. The lint rule cannot see these reads, because none of them holds a literal, so the final verification finds them with grep.++One read of a message remains, and it is not display: the S3 storage form opens its advanced settings when a connection test fails with a certificate error, and it recognizes that failure by the backend's text. The behavior predates this change; a backend error code for it would remove the last match on English text.++`translateApiError` covers codes whose content is one message. The physical connection errors keep their own lookup keyed by the same codes, because they render a title, a summary, steps and commands rather than one message; the component falls back to `translateApiError` for any other code.++Alternatives considered:++- **Matching on the English message text.** Needs no backend work, but breaks without warning the first time the backend rewords a message.+- **Leaving the frontend side to the backend change.** Every `alert(e.message)` would be reworked twice: once here to translate the surrounding copy, and again when codes arrive.+- **Keeping the current fallback that writes the code, or the URL and status, into the message.** The user would keep seeing raw codes and request URLs, which the spec rules out.++### Translations follow the website's rules, not the English hyphen rule++`frontend/AGENTS.md:103` asks for a plain hyphen in every user-visible string. That rule now applies to `en.ts` only. The other dictionaries follow the locale conventions in `website/AGENTS.md:53`, the ones the website's translations already use: Russian keeps «—» where the grammar wants it and writes «е» rather than «ё»; Spanish addresses the reader as usted; French uses vous, a space before `%` and a plain space before `: ; ! ?`; Chinese uses 你, full-width punctuation and a space at every boundary between Chinese and Latin characters; Portuguese is Brazilian (`website/AGENTS.md:41`).++The canonical interface terms per language (backup, storage, notifier, workspace, restore, health check, verification) are recorded in the "Translation quality" section of `website/AGENTS.md`: the Russian ones after the `databases` slice, the others as each dictionary is written. That section already records one such choice, «рабочие пространства» (`website/AGENTS.md:52`), and the follow-up that re-quotes interface labels in the docs will need the same words.++Alternatives considered:++- **The hyphen rule in every language.** Russian and French copy would read as translated, which the website's rules exist to prevent.+- **A glossary under `frontend/`.** Root `AGENTS.md:40` allows target-language text there only in the dictionaries, and dictionary comments must be English, so they cannot hold the terms either.++## Risks / Trade-offs++- **The branch drifts from `develop`.** The migration touches nearly every component, and features landing on `develop` meanwhile conflict with it string by string. → Merge `develop` into the branch often rather than rebasing it. After each merge, `pnpm lint` flags the literals the new work added to already-migrated directories, and they move into the dictionaries before the next slice starts.+- **The migration stalls half-finished.** On a branch, a stall costs a rotting branch rather than a half-translated product. → Slices are small, each ends with lint, tests and build green, and the riskiest slice comes second so a design flaw surfaces early.+- **Text expansion breaks layouts.** Russian and French run 20-30% longer than English, and AntD forms with fixed `labelCol` will wrap or clip. → Visual checks are done in Russian, not English. Russian is migrated alongside English from the first slice precisely so this surfaces immediately rather than at the end.+- **Chinese is shorter and denser**, which hides different problems (line height, mixed CJK and Latin spacing). → Spot-check Chinese on the table-heavy screens once its dictionary lands.+- **Tests assert English text.** Three parser tests check error wording. → They assert keys once the parsers return `LocalizedText`.+- **The exclusion list for technical strings grows into a loophole.** → Exclusions are per recurring class and measured; one-offs take an inline suppression with a reason.+- **Six dictionaries in one bundle.** Measured: about 1,130 messages per language, and the main bundle grows from 516 KB to 673 KB gzipped. → Shipped all six; loading each non-English dictionary and its AntD/dayjs locale with a dynamic import is a contained follow-up if that cost matters.+- **The type-level completeness check makes adding a language all-or-nothing.** → Accepted deliberately. A partially translated language is worse than an absent one, and this is the mechanism that guarantees it cannot ship.+- **The documentation-link test couples frontend CI to the website.** A website contributor can break a frontend test. → Accepted, since the alternative is silent 404s; the note in `website/AGENTS.md` explains the failure.+- **Phrasing without plurals constrains copywriting.** → Accepted for two call sites. ICU messages are the route if such copy grows.++## Migration Plan++No data migration and no deployment coupling: this is a frontend build.++The whole change is built on one long-lived branch and merged into `develop` once every task is done, final verification and review included. Nothing between the first slice and the last reaches users, so the language list needs no release gate. Inside the branch each slice is its own commit; after the merge, rollback is reverting the merge commit.++Sequencing is by slice, smallest first, English and Russian together:++```+settings(4) -> databases(159) -> restores(13) -> healthcheck(19) -> workspaces(34)+ -> users(48) -> verification(60) -> notifiers(102) -> backups(119) -> storages(136)+ -> entity/, widgets/, pages/, shared/ui/+```++Counts are the crude-grep numbers and understate the real ones. The per-slice lint counts in Context rank a few neighbouring slices differently (`healthcheck` below `restores`, `storages` below `backups`); the order is kept, because swapping neighbours of similar size changes nothing about what each slice proves.++`databases` is second rather than last on purpose. Strict smallest-first validates the key namespace only on trivial slices, so a design flaw surfacing in the largest one would mean reworking every slice already migrated. Doing it right after the infrastructure is proven costs fluency and buys the ability to revise the key layout while only one other slice depends on it.++Spanish, Portuguese, Chinese and French are written only after the key set has stopped moving. Translating earlier means redoing the work each time a key is renamed.++## Open Questions++- Which AntD locale bundles to import statically versus dynamically. Affects bundle size only, decidable once real numbers exist.+- Whether `common.*` should hold shared verbs (`Save`, `Cancel`, `Delete`) or whether each domain repeats them. Sharing risks a verb that reads correctly in one context and wrong in another, in languages with grammatical gender or aspect. Resolvable during the first two slices, with the default being: share only where every language confirms the wording carries over.diff --git a/openspec/changes/archive/2026-09-19-translate-frontend-ui/proposal.md b/openspec/changes/archive/2026-09-19-translate-frontend-ui/proposal.mdnew file mode 100644index 00000000..b7ad4476--- /dev/null+++ b/openspec/changes/archive/2026-09-19-translate-frontend-ui/proposal.md@@ -0,0 +1,100 @@+## Why++The marketing website ships in six languages, but the product behind it is English only. A user who arrives through the Russian or Chinese landing page logs in and hits an entirely English interface. The website translation set the audience expectation; the application has to meet it.++There is also a window that closes. Today's 32,700 lines of frontend code carry roughly 1,500 hardcoded strings, and that number grows with every feature. Extraction gets more expensive the longer it waits, and nothing currently stops a new hardcoded string from landing.++## Governing docs++This change answers to [`AGENTS.md`](../../../AGENTS.md) at the repo root and to [`frontend/AGENTS.md`](../../../frontend/AGENTS.md). It also amends the root doc's language rule, which [`assets/readme/AGENTS.md`](../../../assets/readme/AGENTS.md) restates, so that doc is in scope for consistency even though no README translation changes. It touches no backend or agent code, so those module docs do not apply.++[`website/AGENTS.md`](../../../website/AGENTS.md) applies in two ways, though no website code changes:++- Its "Translation quality" rules govern how every non-English dictionary is written, including locale typography, and they gain the interface's canonical terms per language.+- Its `app/i18n.ts` is the source of truth for which pages exist in which language. The frontend links to those pages and a frontend test reads that file, so the doc gains a note that adding or removing a translated path affects the frontend.++### **BREAKING** rule change, approved and applied++The root doc's "Language in code" section permitted translated end-user content in three places and nowhere else: the website page copies, the README translations, and the six language-switcher labels in the root `README.md`. It forbade any language other than English inside `frontend/src/`, fallback copy and error messages included.++This change puts Russian, Spanish, Portuguese, Chinese and French text into `frontend/src/shared/i18n/locales/*.ts`, which that wording forbade. The rule now names a fourth permitted location, and nothing about the change is implementable without it.++The amendment adds exactly one location, `frontend/src/shared/i18n/locales/<locale>.ts`, and changes nothing else: identifiers, file names, dictionary keys, comments, log messages, API strings, test assertions and commit messages stay English, and every other file under `frontend/src/` stays English including fallback copy and error messages. It is recorded in the root `AGENTS.md` under "Language in code" (task 2.2).++The language control's native names (`Русский`, `中文`) need no further amendment: each dictionary names its own language, so they live inside the permitted files.++## What Changes++- Add an i18n layer under `frontend/src/shared/i18n`: `i18next` + `react-i18next`, a `LocaleProvider` mirroring the existing `ThemeProvider`, and a language control in the navbar.+- Ship the same six languages as the website: `en` (source of truth) plus `ru`, `es`, `pt`, `zh`, `fr`.+- Author locale dictionaries as TypeScript modules typed against the English one, so a missing or stray key fails `tsc -b` instead of silently falling back at runtime. A unit test checks that every translation of a key uses the same `{{placeholders}}` as the English one.+- Replace every user-facing hardcoded string in `frontend/src` with a dictionary lookup, slice by slice. Code outside components, including module-level label tables and parsers in `entity/`, returns keys rather than text, so a language switch re-renders everything without a reload.+- Phrase counts so one string fits every number (`Members: 5` rather than `5 members`). No message depends on grammatical plural forms.+- Keep sentences whole: a sentence with inline markup (`<code>`, `<strong>`, links) is one key rendered through `Trans`, and values are interpolated into a full sentence rather than concatenated from fragments.+- Render translated text only as text. The confirmation dialog stops rendering its description as HTML, and a user-entered name in a translated sentence never becomes markup.+- Add `eslint-plugin-i18next` with `i18next/no-literal-string` in `all` mode over `.ts` and `.tsx`, enabled per directory as each slice is migrated and collapsed into one entry over `src` once every slice is done.+- Route AntD's own strings through `ConfigProvider locale` and date formatting through `dayjs.locale`, both following the selected language.+- Group numbers by the selected language instead of the browser's, so digits and dates on the same screen stop disagreeing.+- Set the document's language attribute and title from the selected language at runtime. `frontend/index.html` keeps `lang="en"` and the English `<title>` as the values shown before the script runs.+- Translate every enum shown to the user through typed tables of keys: the status enums, replacing four copy-pasted `renderStatusTag` / `renderStatus` / `renderStatusBadge` variants, and the other labelled enums (storage and notifier types, intervals, periods, retention policies, roles, weekdays). Enum values stay English: they are wire protocol.+- Open links to databasus.com pages in the selected language when the website publishes that page in it, and in English otherwise.+- Show a translated message for failures the backend does not describe (network errors, responses without an error body) instead of a raw error code or a request URL.+- **BREAKING** for contributors, not users: once the migration merges, a user-facing string literal anywhere in `frontend/src` fails the lint job.++### The language control++The website's `LanguageSelectorComponent` is the reference: a compact button in the navbar showing the current language, a dropdown that opens on hover and lists the six languages by their native names.++Here it is merged with the existing theme control into one paired button, language on one side and Dark/Light/System on the other, in the style the website already uses to glue the language selector to the GitHub button (`isSplitEnd`).++That merge also settles placement. `ThemeToggleComponent` already renders in three places, and the paired control replaces it at all three:++- `widgets/main/MainScreenComponent.tsx:254` - the main navbar+- `widgets/main/SidebarComponent.tsx:132` - the sidebar, for narrow viewports+- `features/users/ui/AuthNavbarComponent.tsx:49` - the authentication screen++So the language is selectable before login, not only after it. The choice is stored in `localStorage`, and on a first visit with nothing stored the interface starts in the highest-ranked language the browser prefers that the product actually ships.++### Delivery++The migration is built on one long-lived branch and merges into `develop` whole, once every slice, all five translations and the final verification are done. No build in between reaches users, so nobody sees a half-translated interface and the language list needs no release gate. See design.md - Migration Plan.++### Out of scope++- The backend. Its ~416 free-text error responses keep reaching the user in English: 67 of the frontend's 78 `alert()` calls show `e.message`. This change only fixes the frontend's side of the contract: translate by `ApiError.code` when one is present, fall back to `message` when it is not, so the backend work later is additive.+- Other text the backend authors and the frontend shows as-is: audit log entries (`AuditLog.message`, stored in the database), backup and restore failure messages (`failMessage`, `lastBackupErrorMessage`), and the notifications the backend sends by email, Telegram, Slack and the other channels.+- Replacing `alert()` with AntD notifications (78 call sites). A real improvement, a separate change.+- Re-quoting interface labels in the website docs and the README translations. Both quote English labels (`"Hourly"`, `"New Database"`) because, in the words of `website/AGENTS.md:55` and `assets/readme/AGENTS.md:29-31`, "the interface is English". Once this change merges, a Russian docs page still quotes `"Hourly"` while the Russian interface shows the Russian label. The follow-up change that re-quotes the docs also rewrites those two rules; the canonical interface terms this change records in `website/AGENTS.md` are its input.+- Unit words stay English: `h`/`m`/`s` in `formatDuration`, `MB` and `GB` in sizes. `formatDuration` needs no change at all, its digits being too small to group. The digits in sizes and counts are in scope and follow the selected language.+- Clock format and date order stay derived from the browser, not from the selected language. See design.md - Two axes.+- Technical strings: engine names, `pg_dump` and friends, connection strings, command blocks, cron expressions.+- Persisting the language choice server side. It lives in `localStorage`, like the theme.++## Capabilities++### New Capabilities++- `frontend-localization`: the frontend renders its interface in a user-selected language, keeps dictionaries provably complete, and prevents untranslated strings from being added.++### Modified Capabilities++None. This is the repository's first change; `openspec/specs/` is empty.++## Impact++- `frontend/package.json`: adds `i18next` 26, `react-i18next` 17, `eslint-plugin-i18next` 6. Measured cost: the main bundle grows from 516 KB to 673 KB gzipped (+157 KB), for the libraries, the AntD and dayjs locales and all six dictionaries, which ship in the main bundle (see design.md - Risks).+- `frontend/eslint.config.js`: gains one config object per migrated directory, collapsed into a single object over `src` at the end.+- `frontend/vitest.config.ts`: allows tests to read `../website`, for the documentation-link check.+- `frontend/src/App.tsx`: `LocaleProvider` wraps the tree, `ConfigProvider` receives an AntD locale.+- `frontend/index.html`: unchanged. Its `lang="en"` and English `<title>` remain the values shown before the script runs, and the provider overwrites them from the selected locale.+- Eight `toLocaleString()` call sites: number grouping follows the selected language rather than the browser's.+- `frontend/src/shared/ui/ThemeToggleComponent.tsx`: stays as the theme half of the new paired control; its three call sites render the paired control instead.+- `frontend/src/shared/api/apiHelper.ts`: `ApiError` carries frontend-side codes and the HTTP status for failures the backend does not describe, a network failure becomes an `ApiError` instead of the browser's `TypeError`, and the message holds only the backend's message.+- `frontend/src/shared/ui/ConfirmationComponent.tsx`: `description` becomes React content instead of an HTML string; the eight files that use it change with it.+- `frontend/src/features/**` (105 files, 23,800 lines), `frontend/src/entity/**`, `frontend/src/widgets/**`, `frontend/src/pages/**`: every user-facing literal moves to a dictionary key.+- 23 links to databasus.com pages (documentation, the home page, sponsorship): they go through a helper that picks the page's language.+- `AGENTS.md` (root): the "Language in code" rule gains a fourth permitted location. See the rule change above.+- `frontend/AGENTS.md`: gains the i18n convention, and its plain-hyphen rule is scoped to English copy.+- `website/AGENTS.md`: its translation-quality rules extend to the frontend dictionaries and gain the canonical interface terms per language; its `TRANSLATED_PATHS` rule gains a note about the frontend's links to website pages.+- Three frontend tests assert English error text (the PostgreSQL, MySQL and MongoDB connection string parsers). They switch to asserting keys.+- No backend, agent, or API changes.diff --git a/openspec/changes/translate-frontend-ui/specs/frontend-localization/spec.md b/openspec/changes/archive/2026-09-19-translate-frontend-ui/specs/frontend-localization/spec.mdsimilarity index 74%rename from openspec/changes/translate-frontend-ui/specs/frontend-localization/spec.mdrename to openspec/changes/archive/2026-09-19-translate-frontend-ui/specs/frontend-localization/spec.mdindex 05e43260..59151c27 100644--- a/openspec/changes/translate-frontend-ui/specs/frontend-localization/spec.md+++ b/openspec/changes/archive/2026-09-19-translate-frontend-ui/specs/frontend-localization/spec.md@@ -16,6 +16,11 @@ Technical strings are excluded and stay identical in every language: command lin- **THEN** every visible label, button and message re-renders in Russian without a page reload- **AND** command blocks, connection strings and engine names remain byte-identical to what English showed+#### Scenario: Switching language keeps what is on screen++- **WHEN** a user switches the language while a form on the page holds unsaved input, or from the language control inside the open narrow-viewport sidebar+- **THEN** the form keeps its input and the sidebar stays open, both now labelled in the new language+### Requirement: The language control sits beside the theme controlThe language control SHALL be presented together with the light/dark theme control as a single paired element, and SHALL appear everywhere that element appears: the main navigation bar, the narrow-viewport sidebar, and the authentication screen. A user SHALL be able to choose a language before signing in.@@ -125,6 +130,25 @@ The page SHALL declare the selected language to the browser, and its title SHALL- **WHEN** the interface renders in a non-English language- **THEN** the browser tab and any bookmark made from it show a title in that language+### Requirement: Website links open in the selected language++When the interface links to a page on the product website, the link SHALL open that page in the selected language if the website publishes it in that language, and the English page otherwise. A link to a section of a page SHALL land on that section in either case.++#### Scenario: The website has the page in the selected language++- **WHEN** a user with Russian selected follows a link to the installation guide+- **THEN** the Russian version of the installation guide opens++#### Scenario: The website has the page only in English++- **WHEN** a user with Russian selected follows a link to a page the website publishes only in English+- **THEN** the English page opens rather than a missing page++#### Scenario: A link to a section++- **WHEN** a user with Chinese selected follows a link to a section of a translated page+- **THEN** the Chinese page opens scrolled to that section+### Requirement: Status labels are translated while wire values stay stableStatus values exchanged with the backend SHALL remain unchanged English identifiers. Their displayed labels SHALL be translated.@@ -159,23 +183,38 @@ Each non-English dictionary SHALL be checked against the English dictionary at b- **WHEN** code requests a key that does not exist in the English dictionary- **THEN** the type check fails-### Requirement: Migrated code cannot regress to hardcoded strings+### Requirement: New code cannot add hardcoded strings-Once a directory has been migrated, the lint job SHALL reject a user-facing string literal added to it. Directories not yet migrated are exempt until they are.+The lint job SHALL reject a user-facing string literal added anywhere in the frontend source. Technical strings and test files are exempt.-#### Scenario: A hardcoded string is added to migrated code+#### Scenario: A hardcoded string is added-- **WHEN** a contributor adds a literal label, placeholder or message to a migrated directory+- **WHEN** a contributor adds a literal label, placeholder or message to any frontend source file- **THEN** the lint job fails and points at the literal-#### Scenario: A technical string is added to migrated code+#### Scenario: A technical string is added-- **WHEN** a contributor adds a command block, connection string or engine name to a migrated directory+- **WHEN** a contributor adds a command block, connection string or engine name to a frontend source file- **THEN** the lint job accepts it, either through the configured exclusions or through an inline suppression carrying a reason+### Requirement: Translated text and inserted values render as plain text++Every translated message SHALL reach the page as text, never as markup. A value inserted into a translated sentence, such as a workspace, user or database name, SHALL be shown as text and SHALL never become markup, even when it contains characters that look like HTML. The only markup in a translated sentence is the formatting the interface itself supplies, such as code spans, bold text and links.++#### Scenario: A name that looks like markup++- **WHEN** a workspace is named `<img src=x onerror=alert(1)>` or `<strong>bold</strong>` and a translated sentence mentions it, including a sentence that carries the interface's own formatting+- **THEN** the sentence shows that name literally, as text+- **AND** no element is created from it and no script runs++#### Scenario: A translation that contains markup-like text++- **WHEN** a translated message contains angle brackets that are not part of the interface's own formatting+- **THEN** they are shown as characters rather than interpreted as elements+### Requirement: Backend errors are translated by code, with the message as fallback-The frontend SHALL translate an error response by its stable error code when the backend supplies one, and SHALL display the backend's message text only when no code is present. This change does not add codes to the backend.+The frontend SHALL translate an error response by its stable error code when the backend supplies one, and SHALL display the backend's message text only when no code is present or the frontend has no translation for it. This change does not add codes to the backend.#### Scenario: The backend supplies a known error code@@ -191,3 +230,13 @@ The frontend SHALL translate an error response by its stable error code when the- **WHEN** a request fails with an error code the frontend has no translation for- **THEN** the user sees the backend's message text rather than a raw code or a blank message++#### Scenario: The backend supplies an unrecognized code and no message++- **WHEN** a request fails with an error code the frontend has no translation for and no message+- **THEN** the user sees a general error message in the selected language rather than the raw code++#### Scenario: The request fails without an answer from the backend++- **WHEN** the server cannot be reached, or answers with an error status but no error description+- **THEN** the user sees a message in the selected language rather than a request address or a status linediff --git a/openspec/changes/archive/2026-09-19-translate-frontend-ui/tasks.md b/openspec/changes/archive/2026-09-19-translate-frontend-ui/tasks.mdnew file mode 100644index 00000000..6e248da9--- /dev/null+++ b/openspec/changes/archive/2026-09-19-translate-frontend-ui/tasks.md@@ -0,0 +1,88 @@+## 1. i18n infrastructure++- [x] 1.1 Add `i18next` 26, `react-i18next` 17 and `eslint-plugin-i18next` 6 to `frontend/package.json`, and verify `pnpm install` succeeds and `pnpm build` still passes+- [x] 1.2 Create `shared/i18n/locales/en.ts` as a single object literal with the top-level namespaces (`common`, `status`, `errors`, `language` holding `nativeName`, plus one per domain), and verify `pnpm build` passes+- [x] 1.3 Add the `i18next` module augmentation typing `resources` as `typeof en`, export `TranslationKey` as an alias of i18next's `ParseKeys`, and verify that `t('does.not.exist')` and a `TranslationKey` holding an unknown key both fail `pnpm build` while real keys pass+- [x] 1.4 Create `shared/i18n/locales/ru.ts` as a single object literal typed `const ru: typeof en`, and verify that deleting one key and adding one stray key each make `pnpm build` fail with that key named+- [x] 1.5 Configure the i18next instance with inline resources, `nsSeparator: false`, `interpolation.escapeValue: false`, `fallbackLng: 'en'`, `react.transKeepBasicHtmlNodesFor: []` and `react.transDefaultProps` escaping `Trans` values (`shouldUnescape: true`, `tOptions.interpolation.escapeValue: true`), and verify `t()` is typed `string` at call sites and `pnpm build` passes+- [x] 1.6 Add the placeholder parity test, which asserts for every key of `en` that each other dictionary uses the same `{{…}}` names and the same `Trans` tags, and verify `pnpm test` passes and fails when a placeholder is removed from a `ru.ts` value+- [x] 1.7 Add a unit test that renders, through `react-dom/server` with the project's i18next configuration, translated sentences containing the names `<img src=x onerror=alert(1)>`, `<strong>bold</strong>` and `a {{name}} b`: from `t()` as React text, through `Trans` `values`, and through `Trans` with the name as the child of a supplied element for a self-closing dictionary tag. Include a dictionary sentence with a `<strong>` the component does not supply. Verify `pnpm test` passes; that every name is shown as text; that the element route shows each name exactly as entered; that the only elements produced are the ones the component supplies; and that the `<strong>` cases fail when `react.transDefaultProps` or `react.transKeepBasicHtmlNodesFor` from 1.5 is removed+- [x] 1.8 Add `LocalizedText` (`{ key: TranslationKey; params? }`) in its own file in `shared/i18n` together with the way components render it, and verify `pnpm build` rejects a `LocalizedText` with an unknown key+- [x] 1.9 Add `resolveInitialLocale({ storedLocale, browserLanguages, supportedLocales })` in `shared/i18n`, and verify with `pnpm test` that `["de", "ru"]` resolves to `ru`, a list with no supported language resolves to `en`, `zh-TW` and `zh-HK` resolve to `zh` and `pt-PT` to `pt` when those are supported, a stored supported value outranks the browser list, and a stored unsupported value is ignored+- [x] 1.10 Add `LocaleProvider` and `useLocale` in `shared/i18n`, mirroring `shared/theme/ThemeProvider.tsx`: the supported list is the dictionaries that exist (`en` and `ru` for now), `databasus-locale` is read from `localStorage` during initialization and resolved with `resolveInitialLocale`, and a switch updates `dayjs.locale` and `i18n.changeLanguage` before publishing the new locale. Verify `pnpm build` and `pnpm test` pass+- [x] 1.11 Wrap the tree in `LocaleProvider` in `App.tsx` and pass the matching AntD locale to `ConfigProvider`. With `databasus-locale` set to `ru` in `localStorage`, verify that on first paint table pagination, an empty table and the month and weekday names in a `DatePicker` are already Russian, with no flash of English+- [x] 1.12 Set `document.documentElement.lang` and the document title from the selected locale at runtime, keeping `lang="en"` and the English `<title>` in `frontend/index.html` as the values shown before the script runs. With `databasus-locale` set to `ru`, verify the tab title is Russian and the reported language is `ru` once the page has loaded+- [x] 1.13 Add `formatNumber` and `formatRelativeTime` in `shared/i18n`, exposed through `useLocale()`, and verify with unit tests that an English browser with French selected groups digits the French way, that Chinese groups Western-style rather than in the 万 form, that unit words are not the formatter's concern, and that a relative time comes out in Russian when Russian is selected+- [x] 1.14 Confirm that `shared/time/getUserTimeFormat.ts:4,44` and `shared/time/utils.ts:5` keep deriving clock format and date order from `navigator.language`, and record in `frontend/AGENTS.md` why those three reads are correct where a bare `toLocaleString()` is not, so a later reader does not "fix" them+- [x] 1.15 Build `LanguageSelectorComponent` and `LanguageThemeControlComponent` in `shared/ui`, keeping `ThemeToggleComponent` as the theme half with split styling. The language half shows the current language and opens, on hover, a list of the supported languages, each named by its own dictionary's `language.nativeName`; the list is an AntD `Dropdown` opening on hover and click, whose leave delay keeps it open while the pointer crosses from the button to the list. Verify the list stays open while the pointer moves onto it+- [x] 1.16 Render `LanguageThemeControlComponent` instead of `ThemeToggleComponent` at all three call sites (`widgets/main/MainScreenComponent.tsx:254`, `widgets/main/SidebarComponent.tsx:132`, `features/users/ui/AuthNavbarComponent.tsx:49`) and verify the control renders in the navbar, in the narrow-viewport sidebar and on the authentication screen+- [x] 1.17 Add `WEBSITE_PAGES` and `getWebsitePageUrl(page, locale)` in `shared/i18n`, allow `..` in `server.fs.allow` in `frontend/vitest.config.ts`, and add the test that compares the table with `TRANSLATED_PATHS` read from `website/app/i18n.ts?raw`. Verify `pnpm test` passes and fails when an untranslated page such as `notifiers/mattermost` is marked translated, and that `pnpm build` passes in a copy of `frontend/` with no `website/` beside it, as in the Docker build+- [x] 1.18 Verify end to end with English and Russian that a language chosen before signing in survives the sign-in, that a browser preferring German and then Russian starts in Russian, that a browser with no supported language starts in English, that an explicit choice outranks the browser preference on later visits, and that switching the language keeps the unsaved input in a form on the page and keeps the narrow-viewport sidebar open when the switch is made from it+- [x] 1.19 Change `description` in `shared/ui/ConfirmationComponent.tsx` from an HTML string rendered with `dangerouslySetInnerHTML` (`:27`) to a `ReactNode` rendered as a child, and turn the description at `features/restores/ui/RestoresComponent.tsx:366` into a `Trans` key with `<bold>` plus a second key for the question after the line breaks. Verify `pnpm build` passes, the restore cancellation dialog still shows the bold warning and the question on its own paragraph, and the other confirmation dialogs show their text unchanged++## 2. Lint enforcement and conventions++- [x] 2.1 Define the `i18next/no-literal-string` options in `frontend/eslint.config.js` as one shared object, not yet applied to any directory: `all` mode and the exclusion lists for the report classes in design.md (JSX attributes, callees, object properties, URL and path words, `*.test.ts` and `api/` segments). Verify by applying it temporarily that `pnpm lint` reports the `message.success` texts at `features/settings/ui/SettingsComponent.tsx:77,253` and the fallback strings at `:46` and `:79`, reports the `placeholder` attributes in `features/storages`, and reports none of the excluded classes in either; then remove the temporary entries and verify `pnpm lint` passes+- [x] 2.2 Amend the "Language in code" section of the root `AGENTS.md` to permit target-language text in `frontend/src/shared/i18n/locales/<locale>.ts` and nowhere else under `frontend/src/`, and verify the amended wording still forbids translated fallback copy and error messages outside that directory. Do not start section 5 until this task is done and approved+- [x] 2.3 Document the i18n convention in `frontend/AGENTS.md`: keys are domain-scoped; English is the key source of truth; each dictionary is one object literal in one file; code outside components holds keys, not text; label tables are named `<TYPE>_LABEL_KEYS` and sit next to the type they label; sentences stay whole, with `Trans` for inline markup and interpolation instead of concatenation; a user-entered value in a `Trans` sentence is a self-closing tag whose supplied element holds the value, never a `values` entry; counts are phrased without plural forms; translated text is never rendered as HTML; locale-dependent output is read through `useTranslation` or `useLocale`, including relative times through `formatRelativeTime`; API errors are shown through `translateApiError`; technical strings stay literal. Scope the plain-hyphen rule to `en.ts` and point the other dictionaries to `website/AGENTS.md` - Translation quality. Verify the section states each rule and links to that section+- [x] 2.4 In `website/AGENTS.md`, state that "Translation quality" also governs the frontend dictionaries, and add to the `TRANSLATED_PATHS` rule that a frontend test checks the application's links to website pages against that list, so adding or removing a translated path can fail it. Verify both notes are present++## 3. Error handling contract++- [x] 3.1 Add an `errors` namespace keyed by error code. In `shared/api/apiHelper.ts`, make `ApiError.message` hold only the backend's message, add a `status` field set on every `ApiError` from an error response, and give the failures the backend does not describe frontend-side codes: wrap only the rejection of the `fetch` call at `:59` as an `ApiError` with `network_unreachable`, letting the `ApiError`s that reach the `catch` at `:62` pass through unchanged, and throw `request_failed` for HTTP 502 and 504 at `:20-21` and for an error response without a JSON body at `:44-46`. Delete the dead `response.text()` fallback at `:37-41`. Switch `describeRestoreError` (`PhysicalRestoreComponent.tsx:34-44`) to deciding by `status` alone, dropping its search of the message for `409`, `422`, `in progress` and `gap`, and turn the hints it appends into keys. Add `translateApiError(error, t)` in `shared/i18n/translateApiError.ts`, which resolves a known code to its translation, otherwise shows the backend's message, otherwise a general translated message, and never shows the message of an error that is not an `ApiError`. Verify with unit tests. For `translateApiError`: a known code, an unknown code with a message, an unknown code without a message, no code with a message, `network_unreachable`, `request_failed` with its status, and a plain `TypeError`. For `apiHelper`, with `globalThis.fetch` stubbed: a rejection gives `network_unreachable`, a 502 gives `request_failed` with status 502, a non-JSON 500 gives `request_failed` with status 500, and a JSON error with a code keeps its code, message and status. Cover both the default path, where the first try is the last, and a call made with `isRetryOnError`, which is retried up to 30 times at 3-second intervals (`apiHelper.ts:6-7,76,88`) and needs fake timers+- [x] 3.2 Convert the text in `physicalConnectionErrorContent` to keys while keeping its lookup by `ConnectionErrorCode`: titles and summaries become keys, each note becomes one key rendered through `Trans` with `<bold>` tags instead of text runs, `managedNote` becomes a key with `{{username}}`, and commands stay literal. Route every other code in `EditPostgreSqlPhysicalSpecificDataComponent.tsx` through `translateApiError`. Verify `pnpm test` passes and that each physical connection error still shows its specific copy++## 4. Enum labels++- [x] 4.1 Add a `status` namespace and a `<TYPE>_LABEL_KEYS` table next to each of the six status enums in `entity/` that are shown as labels (`AddMemberStatusEnum` is never shown, so it gets none), moving the label parts of `physicalBackupStatus.ts` and `restoreVerificationStatus.ts` there (with `NOT_VERIFIED: null` replacing the `Partial`), and convert `AGENT_STATUS_LABELS` to `AGENT_STATUS_LABEL_KEYS` in place. Verify that adding an enum member without a label fails `pnpm build`+- [x] 4.2 Replace the four status render functions (`VerificationDetailDrawer.tsx:51`, `VerificationsComponent.tsx:58`, `LogicalBackupsComponent.tsx:386`, `PhysicalBackupsComponent.tsx:55`) with lookups against the shared tables, keeping each component's own markup, and verify the four screens show the same English labels as before, and Russian labels when Russian is selected+- [x] 4.3 Add `<TYPE>_LABEL_KEYS` tables next to the other labelled types: storage and notifier types, database types, SSH tunnel auth types, notification types, intervals, periods, retention policies, user and workspace roles, and one weekday table in `entity/intervals`. This task only adds the tables; the old sources (`getStorageNameFromType`, `getNotifierNameFromType`, the `getRoleDisplayText` switches, the six weekday copies and the other text tables) are deleted by the section 5 task that migrates their last consumer. Verify that adding an enum member without a label fails `pnpm build`++## 5. Slice migration (English and Russian together)++Ordering is deliberate and not by size alone. `features/settings` comes first to prove the infrastructure on the smallest slice. `features/databases` comes second, out of size order, because it is the largest and most varied slice: if the key namespace design breaks anywhere it breaks there, and finding that out after nine migrated slices would mean reworking all of them. The cost is doing the hardest slice before the pattern is fluent. The rest then run ascending.++A slice is done when:++- its copy is in the dictionaries, following the `frontend/AGENTS.md` convention from 2.3;+- its consumers of the section 4 tables use keys, and any old label function or copy whose last consumer it held is deleted;+- its `fromNow()` calls go through `formatRelativeTime`, its `toLocaleString()` calls through `formatNumber`, and every place that shows an error's message, whether through `alert()`, `message.error()` or its own error state, through `translateApiError`;+- its links to databasus.com pages go through `getWebsitePageUrl`;+- it has a lint entry using the options from 2.1;+- `pnpm format` leaves no changes, and `pnpm lint`, `pnpm test` and `pnpm build` pass;+- the reviewer subagent has audited the slice's diff and every CHANGES REQUIRED finding is resolved.++- [x] 5.1 Migrate `features/settings`, and verify the slice is done and that the relative times in the audit log (`AuditLogsComponent.tsx:160,198`) re-render in the new language on a live switch+- [x] 5.2 Migrate `features/databases`, the largest slice. Then review whether the namespace design survived it and revise the key layout before continuing if it did not, and record the Russian canonical interface terms in `website/AGENTS.md` - Translation quality. Verify the slice is done+- [x] 5.3 Migrate `features/restores`, and verify the slice is done+- [x] 5.4 Migrate `features/healthcheck`, and verify the slice is done+- [x] 5.5 Migrate `features/workspaces`, phrasing the counts at `WorkspaceMembershipComponent.tsx:517` and `WorkspaceSettingsComponent.tsx:148` so one string fits every number, and verify the slice is done+- [x] 5.6 Migrate `features/users`, replacing the backend's success text shown at `RequestResetPasswordComponent.tsx:54` with a frontend key, and verify the slice is done+- [x] 5.7 Migrate `features/verification`, including the bare `toLocaleString()` calls at `VerificationDetailDrawer.tsx:45,48,157`, and verify the slice is done+- [x] 5.8 Migrate `features/notifiers`, and verify the slice is done+- [x] 5.9 Migrate `features/backups`, including the bare `toLocaleString()` calls at `LogicalBackupsComponent.tsx:513,515` and `PhysicalBackupsComponent.tsx:49,52`, and verify the slice is done+- [x] 5.10 Migrate `features/storages`, and verify the slice is done+- [x] 5.11 Migrate the remaining copy in `entity/`, `widgets/`, `pages/` and `shared/ui/`, including the bare `toLocaleString()` at `StarButtonComponent.tsx:56`. The connection string parsers return `{ error: LocalizedText }`, the parse-failure keys drop the thrown error's text that eleven messages append today (for example `ConnectionStringParser.ts:137`), and their tests (`ConnectionStringParser.test.ts`, `MySqlConnectionStringParser.test.ts`, `MongodbConnectionStringParser.test.ts`) assert keys instead of English words. Verify the slice is done+- [x] 5.12 Replace the per-directory lint entries with one entry over `src/**/*.{ts,tsx}`, delete the temporary `eslint.i18n-check.js`, and verify `pnpm lint` passes and fails when a literal label is added to any file under `src`, including inside a SCREAMING_SNAKE constant+- [x] 5.13 Fold the per-namespace files `locales/en/*.ts` and `locales/ru/*.ts` back into one object literal in `locales/en.ts` and one in `locales/ru.ts`, delete both folders, and verify `pnpm build` still names a missing and a stray key and `pnpm test` passes++## 6. Remaining languages++Each dictionary follows the locale conventions in `website/AGENTS.md` - Translation quality. Writing one includes adding the language to the supported list, the AntD locale map and the dayjs locale map, and recording its canonical interface terms next to the Russian ones. Like a slice, each ends with `pnpm format` leaving no changes, `pnpm build` and `pnpm test` passing (no missing or stray keys, placeholders in parity), and a reviewer audit with every CHANGES REQUIRED finding resolved.++- [x] 6.1 Confirm the key set has stopped changing after section 5, then write `es.ts`, and verify the checks above and that a first visit from a browser preferring Spanish starts in Spanish+- [x] 6.2 Write `pt.ts` (Brazilian Portuguese), and verify the checks above and that a first visit from a browser preferring `pt-PT` starts in Portuguese+- [x] 6.3 Write `fr.ts`, and verify the checks above and that a first visit from a browser preferring French starts in French+- [x] 6.4 Write `zh.ts` (Simplified), and verify the checks above and that a first visit from a browser preferring `zh-TW` starts in Simplified Chinese+- [x] 6.5 Verify the language list shows all six native names in every interface language and that each language renders end to end++## 7. Verification++- [x] 7.1 Walk every screen in Russian and French looking for clipped or wrapped labels in AntD forms with fixed `labelCol`, and fix the layouts that break+- [x] 7.2 Spot-check Chinese on the table-heavy screens (backups, databases, verification runs) for line height and CJK-Latin spacing+- [x] 7.3 Confirm in every language that command blocks, connection strings, cron expressions, engine names and the unit words in duration and size readouts are byte-identical to English, while the digits inside those readouts follow the selected language+- [x] 7.4 Confirm in every language that the browser tab title and the document language attribute match the selection, that `grep -rn "toLocaleString()" frontend/src` finds nothing, that `grep -rn "\.fromNow()" frontend/src` finds only the call inside `formatRelativeTime`, that `grep -rnE "(\b(e|err)|[Ee]rror\)?)\.message\b" frontend/src` finds nothing outside `shared/i18n/translateApiError.ts` and test files except `EditS3StorageComponent.tsx`, which reads an `ApiError`'s message only to decide whether to open the advanced settings on a TLS certificate failure and never shows it (behavior that predates this change; a backend error code would replace it), and that `grep -rn "dangerouslySetInnerHTML" frontend/src` finds nothing+- [x] 7.5 Confirm in every language that each link to a databasus.com page opens that page in the selected language when the website publishes it and the English page otherwise, landing on its anchor, and that `grep -rnF "databasus.com" frontend/src` finds page URLs only in `WEBSITE_PAGES`, apart from the example icon URL in the Mattermost form+- [x] 7.6 Switch the language on a screen with a half-filled form, from the navbar and from the narrow-viewport sidebar, and confirm the input and the open sidebar stay as they were, now in the new language+- [x] 7.7 Run `pnpm lint`, `pnpm format`, `pnpm test` and `pnpm build` from `frontend/` and confirm all pass+- [x] 7.8 Run the reviewer subagent over the change's full diff against `develop` and resolve every CHANGES REQUIRED findingdiff --git a/openspec/changes/translate-frontend-ui/design.md b/openspec/changes/translate-frontend-ui/design.mddeleted file mode 100644index 8f466027..00000000--- a/openspec/changes/translate-frontend-ui/design.md+++ /dev/null@@ -1,221 +0,0 @@-## Context--See proposal.md - Why.--The state that shapes the approach:--- `frontend/src` is 32,700 lines. Strings are inlined at their point of use, with no copy layer. A crude grep finds 299 text attributes, 411 JSX text nodes and 136 literals in `.ts` files; the real count is closer to 1,500 once multi-line JSX, template literals, option arrays and `alert()` calls are included.-- Copy is not confined to `ui/` segments. `entity/databases/model/postgresql/ConnectionStringParser.ts` returns error prose, `entity/notifiers/models/getNotifierNameFromType.ts` returns display names. The dictionary has to be reachable from `entity/` and `shared/`, which puts it in `shared/`.-- Two rules in `frontend/AGENTS.md` bear on where the dictionaries go. FSD MUST rule 4 says shared holds only infrastructure, and the dictionaries are domain-scoped (`backups`, `databases`, `storages`). The reading this design adopts: the provider, `t()` and the locale wiring are infrastructure, and copy strings carry no domain calculation, so `shared/i18n` is the right layer. The alternative reading, that copy is domain content belonging in `entity/`, would scatter one dictionary across seven slices and break the single-source-of-truth typing that the whole approach rests on. Recorded here so it is a decision rather than an oversight.-- `ThemeProvider` (`shared/theme/`) already establishes the pattern for a user preference: React context, `localStorage`, a toggle in the header. Locale follows it rather than inventing a second shape.-- `ThemeToggleComponent` already renders at three call sites: `widgets/main/MainScreenComponent.tsx:254`, `widgets/main/SidebarComponent.tsx:132` and `features/users/ui/AuthNavbarComponent.tsx:49`. Merging the language control into it covers the navbar, the narrow-viewport sidebar and the pre-login screen in one move.-- The website's `website/app/components/LanguageSelectorComponent.tsx` is working prior art, including an `isSplitEnd` variant that glues the selector to a neighbouring button as one split control.-- ESLint uses flat config (`tseslint.config(...)`). There is no `overrides` key; per-directory rules are additional config objects.-- `shared/api/apiHelper.ts` already parses `json.code` into `ApiError.code`, and `EditPostgreSqlPhysicalSpecificDataComponent.tsx:204` already branches on it. The error-code contract exists in one place and needs generalizing, not inventing.--The website solved the same problem differently, with five full page copies per page and no dictionaries. That works there because each URL needs its own static HTML for search engines and the pages are prose. Applying it here would mean 525 component copies held structurally in sync. The application diverges deliberately.--## Goals / Non-Goals--**Goals:**--- A forgotten translation is a compile error, not a runtime fallback.-- The migration is a burn-down with a machine-checkable finish line, not an open-ended sweep.-- Each language reads as if written in it, so the key is the identity and the English text is just the English value.--**Non-Goals:**--- Right-to-left languages. None of the six need it, and no layout work assumes it.-- Lazy-loading dictionaries per feature slice. One dictionary per language, loaded whole. Revisit if a dictionary passes a few hundred KB.-- Machine translation in the build. Translations are written and reviewed, like the website's.--## Decisions--### Dictionaries, not per-language component copies--See Context. Component reuse is the deciding factor: the same `EditStorageComponent` serves six languages, so language must be a runtime lookup rather than a file variant.--### `i18next` + `react-i18next`--Alternatives considered:--- **LinguiJS.** Rejected on the key strategy. Lingui uses the English source text as the key, so editing an English phrase silently invalidates all five translations. Since each language is written independently rather than rendered literally, keys must be stable and text-independent.-- **A hand-rolled `t()`, roughly 60 lines.** Attractive given the project's tight dependency budget (AntD only, one icon set). Rejected because Russian needs three plural forms, and interpolation, plural selection, and namespacing grow into a quarter of a library within a year. If usage stays limited to `{name}` substitution and plurals, this decision is cheap to revisit.-- **`react-intl` / FormatJS.** Comparable, but a heavier compile step for ICU messages than this codebase needs.--Required configuration, because the defaults are wrong here:--- `returnNull: false`, otherwise `t()` is typed `string | null` and every call site needs a guard.-- `nsSeparator: false`, otherwise a key containing a colon is misparsed as a namespace reference.-- `interpolation.escapeValue: false`, since React escapes already.-- `fallbackLng: 'en'` as a last-resort runtime guard only. Completeness is enforced by types (below); the fallback exists for a dictionary that failed to load, not for a missing key.--### Type safety comes from the locale files, not the library--This is the load-bearing decision, and no library provides it out of the box: i18next falls back at runtime, Lingui reports gaps in a CLI run. Both are checks a person can ignore.--Two independent layers:--```-shared/i18n/locales/en.ts <- source of truth for the key set- export const en = { backups: { logical: { title: 'Logical backups' } } }- | |- layer 1: valid keys layer 2: complete dictionaries- declare module 'i18next' { locales/ru.ts:- interface CustomTypeOptions { import type { en } from './en'- resources: { translation: typeof en }- } export const ru: typeof en = { ... }- }- t('backups.logical.titel') fails missing key OR stray key fails tsc -b-```--`const ru: typeof en` is an exact structural check including nesting: it rejects a missing key and a leftover one alike. `en` is declared without `as const`, so values widen to `string` and translations are not forced to match the English text.--The `import type` link from each translation to `en` is erased at build time, so the English dictionary does not end up in the Russian bundle.--Consequence worth naming: a language cannot be added partially. Either its dictionary is complete or the build is red. That is why the four remaining languages come last, after the key set has settled.--### Keys are domain-scoped, not path-scoped--`t('backups.logical.emptyState.title')`, not `t('features.backups.logical.ui.EditLogicalBackupConfigComponent.emptyState.title')`.--Top-level namespaces follow the domain, not the file tree: `backups`, `databases`, `storages`, `notifiers`, `verification`, `workspaces`, `users`, `settings`, `status`, `errors`, `common`. A path-shaped key would look tidy today and rot at the first component move, and FSD already permits a component to migrate between `pages/`, `features/` and `entity/` as consumers appear.--### Status labels become typed lookup tables--Today the same five words are copy-pasted with different markup:--```-features/verification/runs/ui/VerificationDetailDrawer.tsx:51 renderStatusTag() -> <Tag color="green">Successful</Tag>-features/verification/runs/ui/VerificationsComponent.tsx:58 renderStatus() -> <span>Successful</span>-```--Seven enums are affected: `VerificationStatus`, `RestoreStatus`, `LogicalBackupStatus`, `PhysicalBackupStatus`, `RestoreVerificationStatus`, `HealthStatus`, `AddMemberStatusEnum`.--The label lookup lives in `entity/*/model/` in its own file next to the enum (`VerificationStatusLabelKeys.ts` beside `VerificationStatus.ts`), re-exported from the slice's `index.ts` so consumers reach it through the slice's public API. FSD MUST rule 5 governs types rather than constants, so co-locating the `Record` inside the enum's own file would also be legal; naming the choice here keeps the seven slices from diverging.--It is an explicit `Record`, not a template key:--```ts-// no: a dynamic key defeats the type check entirely-t(`status.verification.${status}`)--// yes: adding an enum member leaves the Record incomplete and fails the build-const verificationStatusLabelKeys: Record<VerificationStatus, TranslationKey> = { ... }-```--Components keep their own markup (a tag here, an icon and span there) and take the words from one place. This deduplicates as a side effect; that is a bonus, not the goal.--### The lint rule is what makes the migration finite--`eslint-plugin-i18next`, rule `i18next/no-literal-string`. The already-installed `react/jsx-no-literals` is not enough: it sees JSX text nodes and misses `placeholder="..."`, `okText="..."` and `alert('...')`, which together are more than half the strings.--Enabled per directory, appended to the flat config as each slice lands:--```js-{- files: ['src/features/settings/**/*.tsx'],- plugins: { i18next },- rules: { 'i18next/no-literal-string': 'error' },-},-```--Exclusions are needed for 51 sites containing `pg_dump`, `pg_basebackup`, `mongodump`, `localhost` or `https://`, 27 sites with code and command blocks, and AntD props that look like prose but are not (`color`, `type`, `size`, `variant`). Configured exclusions cover the recurring ones; one-off cases take an inline suppression with a stated reason, which keeps the config from turning into a dumping ground. The exact option names are version-specific and get pinned when the plugin is installed.--Slices are migrated smallest first, so the infrastructure is debugged on `features/settings` (4 strings) rather than `features/databases` (159).--### The language control is merged with the theme control--The website's selector is the reference: a compact button showing the current language, a dropdown listing all six by native name, opening on `onMouseEnter` and closing on `onMouseLeave`, with the panel using top padding rather than a margin so the hover area between button and list stays contiguous. That detail is not cosmetic; a gap makes the dropdown close while the pointer crosses it.--Rather than adding a second standalone button, the language selector and the theme selector become one paired control, split down the middle, the way the website glues its selector to the GitHub button. Two reasons: the navbar has no room for a third control at narrow widths, and the two settings are the same kind of thing (a per-browser display preference), so grouping them is honest rather than decorative.--The paired control replaces `ThemeToggleComponent` at its three existing call sites, which is what satisfies the spec's placement requirement without a separate placement task.--Alternatives considered:--- **A separate language button beside the theme button.** Simpler to build, but adds a third control to a navbar that already competes for width, and the website has already established the paired shape.-- **Language inside the theme dropdown as a submenu.** Fewer pixels, but buries a setting a first-time visitor needs to find immediately, and nested dropdowns on hover are fragile.--Trigger consistency is an open question below.--### Three surfaces that are not React state--Three things follow the language but sit outside the component tree, and each needs wiring the dictionary alone does not give:--- `index.html` hardcodes `<html lang="en">` and an English `<title>`. Both are set from the provider once the locale resolves. The `lang` attribute is what screen readers switch voices on and what stops the browser offering to translate a page already in the reader's language; the title is what a bookmark keeps.-- Eight `toLocaleString()` calls carry no locale argument, so they follow the browser rather than the selection. On an English browser with Russian selected, dates would read Russian and numbers English on the same screen. They are in `LogicalBackupsComponent.tsx:513,515`, `PhysicalBackupsComponent.tsx:49,52`, `VerificationDetailDrawer.tsx:45,48,157` and `StarButtonComponent.tsx:56`. The formatter moves to `shared/i18n` and takes the selected locale.-- The unit words stay English (`MB`, `GB`), only the digits regroup.--Two decisions this raises:--`index.html` is a static Vite entry, so its `lang` and `<title>` can only follow the language at runtime. They are set from `LocaleProvider` rather than from a separate `useDocumentLanguage` hook: the provider already owns the resolved locale and runs before first paint, and a second hook would need a consumer in the tree to fire at all, which is exactly the coupling the provider exists to avoid. The markup keeps English values as the pre-hydration fallback.--Chinese does not follow the website's number rule, and the spec deliberately says so. `website/AGENTS.md` fixes `zh 180 万` for millions, qualified as the form for prose. `(1800000).toLocaleString('zh')` returns `1,800,000`; the 万 form needs `Intl.NumberFormat` with `notation: 'compact'`. A row count in a table cell is not prose, and a compact form loses precision a size or a count needs, so the interface shows full grouped numerals in every language and reserves 万 for the website's marketing copy. Verified: `en 1,800,000`, `ru 1 800 000`, `fr 1 800 000`, `es/pt 1.800.000`, `zh 1,800,000`.--### Two axes: words follow the language, clocks follow the region--The product ships one control, and it selects a language. Formatting conventions are a second, independent axis, and conflating them silently is how a plan like this goes wrong. The split adopted here:--- Words follow the selected language. Labels, month and weekday names, component-library text, status labels.-- Digit grouping follows the selected language too. A user who picks French and reads `1,234.5` will file it as a bug, and the product gives them no other control to fix it. This is a deliberate simplification, not a claim that grouping is linguistic.-- Clock format and date order keep following the browser. `shared/time/getUserTimeFormat.ts:3,43` and `shared/time/utils.ts:5` derive 12-hour versus 24-hour and the day/month order from `navigator.language`, and they stay that way. Language does not determine these: English speakers use 12-hour in the United States and 24-hour in the United Kingdom, so deriving a clock from a language selection would be guessing. The browser reports the user's actual region, which is the better signal.--The residual oddity is that a French selection can show French month names above 12-hour AM/PM times. That is correct rather than inconsistent: the words are in the reader's language and the clock is in their region's convention.--Durations (`formatDuration`, `2h 15m 3s`) need no work under this split. They are technical readouts whose digits never reach a grouping threshold, and their unit letters stay English along with the other unit words.--### Locale persistence mirrors the theme--`localStorage` under `databasus-locale`. No user profile field: the backend has no notion of a user language, and adding one only becomes necessary when notifier emails need translating, which is outside this change.--Reading the stored value during provider initialization (as `ThemeProvider` does with `getStoredTheme`) is what satisfies the "no flash of English" scenario in the spec.--Initial detection reads the browser, not the operating system: a page cannot observe the system setting. What it has is `navigator.languages`, the browser's ordered preference list, which usually but not always follows the system.--The rule: walk `navigator.languages` in order, take the first entry whose primary subtag matches a supported language, fall back to English. Walking the list matters. A user whose preferences are `["de", "ru"]` genuinely prefers Russian over English, and checking only `navigator.language` would hand them English.--Region subtags are stripped, which forces two mappings that should be stated rather than discovered:--- `zh-TW` and `zh-HK` resolve to the Simplified Chinese dictionary, though their users read Traditional. Simplified is what the website ships and what this change ships.-- `pt-PT` resolves to the Brazilian Portuguese dictionary, matching `website/AGENTS.md`, which fixes Portuguese as pt-BR.--Both are the least-bad option while only one variant exists per language, and both are a reason to add a variant later rather than a defect to fix now. `website/app/i18n.ts` already carries the same kind of mapping in `HTML_LANG_CODES` (`zh: "zh-CN"`).--### Backend errors: fix the frontend half of the contract now--The backend returns roughly 416 free-text English messages, surfaced by 20+ `alert(e.message)` calls. Translating them is out of scope, but the frontend's handling is not: it standardizes on translating by `ApiError.code` and falling back to `message`. The backend can then acquire codes incrementally without any further frontend rework. `ConnectionErrorCode` in `backend/internal/features/databases/databases/postgresql/shared/connection_error.go` is the existing precedent on the backend side.--## Risks / Trade-offs--- **The migration stalls half-finished.** → The per-directory lint rule makes progress visible and irreversible, and each slice is an independently shippable commit. The interface is bilingual in the meantime, which is worse than English but better than a long-lived branch.-- **Text expansion breaks layouts.** Russian and French run 20-30% longer than English, and AntD forms with fixed `labelCol` will wrap or clip. → Visual checks are done in Russian, not English. Russian is migrated alongside English from the first slice precisely so this surfaces immediately rather than at step 4.-- **Chinese is shorter and denser**, which hides different problems (line height, mixed CJK and Latin spacing). → Spot-check Chinese on the table-heavy screens once its dictionary lands.-- **Existing tests assert English text.** Twelve test files exist; some assert on user-facing copy. → Assert on keys or on stable identifiers rather than rendered prose, changed per slice as it is migrated.-- **The exclusion list for technical strings grows into a loophole.** → Prefer inline suppression with a reason for one-offs; only recurring patterns go in the config.-- **Six dictionaries in one bundle.** At ~1,500 strings each the total is meaningful but not alarming. → Ship all six initially and measure; dynamic import per language is a contained follow-up if the number justifies it.-- **The type-level completeness check makes adding a language all-or-nothing.** → Accepted deliberately. A partially translated language is worse than an absent one, and this is the mechanism that guarantees it cannot ship.--## Migration Plan--No data migration and no deployment coupling: this is a frontend build. Rollback for any slice is reverting its commit, which also reverts its lint config entry.--Sequencing is by slice, smallest first, English and Russian together:--```-settings(4) -> databases(159) -> restores(13) -> healthcheck(19) -> workspaces(34)- -> users(48) -> verification(60) -> notifiers(102) -> backups(119) -> storages(136)- -> entity/, widgets/, pages/, shared/ui/ (~136 strings)-```--Counts are the crude-grep numbers and understate the real ones by roughly half; the ordering holds regardless.--`databases` is second rather than last on purpose. Strict smallest-first validates the key namespace only on trivial slices, so a design flaw surfacing in the largest one would mean reworking every slice already migrated. Doing it right after the infrastructure is proven costs fluency and buys the ability to revise the key layout while only one other slice depends on it.--Spanish, Portuguese, Chinese and French are written only after the key set has stopped moving. Translating earlier means redoing the work each time a key is renamed.--## Open Questions--- Which AntD locale bundles to import statically versus dynamically. Affects bundle size only, decidable once real numbers exist.-- Whether the paired control should open both halves on hover, or keep the theme half on click as it is today. The website opens the language list on hover; `ThemeToggleComponent` uses an AntD `Dropdown` with `trigger={['click']}`. Two different triggers inside one visually joined button is odd, but changing the theme control's behaviour is scope the user has not asked for. Default: the language half opens on hover, the theme half keeps click, revisit after seeing it built.-- Whether `common.*` should hold shared verbs (`Save`, `Cancel`, `Delete`) or whether each domain repeats them. Sharing risks a verb that reads correctly in one context and wrong in another, in languages with grammatical gender or aspect. Resolvable during the first two slices, with the default being: share only where every language confirms the wording carries over.diff --git a/openspec/changes/translate-frontend-ui/proposal.md b/openspec/changes/translate-frontend-ui/proposal.mddeleted file mode 100644index 13e8e970..00000000--- a/openspec/changes/translate-frontend-ui/proposal.md+++ /dev/null@@ -1,77 +0,0 @@-## Why--The marketing website ships in six languages, but the product behind it is English only. A user who arrives through the Russian or Chinese landing page logs in and hits an entirely English interface. The website translation set the audience expectation; the application has to meet it.--There is also a window that closes. Today's 32,700 lines of frontend code carry roughly 1,500 hardcoded strings, and that number grows with every feature. Extraction gets more expensive the longer it waits, and nothing currently stops a new hardcoded string from landing.--## Governing docs--This change answers to [`AGENTS.md`](../../../AGENTS.md) at the repo root and to [`frontend/AGENTS.md`](../../../frontend/AGENTS.md). It also amends the root doc's language rule, which [`assets/readme/AGENTS.md`](../../../assets/readme/AGENTS.md) restates, so that doc is in scope for consistency even though no README translation changes. It touches no backend, agent or website code, so those module docs do not apply. `website/AGENTS.md` is relevant only as prior art: its translation-quality rules are the reference for how each language is written.--### **BREAKING** rule change, approved and applied--The root doc's "Language in code" section permitted translated end-user content in three places and nowhere else: the website page copies, the README translations, and the six language-switcher labels in the root `README.md`. It forbade any language other than English inside `frontend/src/`, fallback copy and error messages included.--This change puts Russian, Spanish, Portuguese, Chinese and French text into `frontend/src/shared/i18n/locales/*.ts`, which that wording forbade. The rule now names a fourth permitted location, and nothing about the change is implementable without it.--The amendment adds exactly one location, `frontend/src/shared/i18n/locales/<locale>.ts`, and changes nothing else: identifiers, file names, dictionary keys, comments, log messages, API strings, test assertions and commit messages stay English, and every other file under `frontend/src/` stays English including fallback copy and error messages. It is recorded in the root `AGENTS.md` under "Language in code" (task 2.2).--## What Changes--- Add an i18n layer under `frontend/src/shared/i18n`: `i18next` + `react-i18next`, a `LocaleProvider` mirroring the existing `ThemeProvider`, and a language control in the navbar.-- Ship the same six languages as the website: `en` (source of truth) plus `ru`, `es`, `pt`, `zh`, `fr`.-- Author locale dictionaries as TypeScript modules typed against the English one, so a missing or stray key fails `tsc -b` instead of silently falling back at runtime.-- Replace every user-facing hardcoded string in `frontend/src` with a dictionary lookup, slice by slice.-- Add `eslint-plugin-i18next` and enable `i18next/no-literal-string` per directory as each slice is migrated, so migrated code cannot regress.-- Route AntD's own strings through `ConfigProvider locale` and date formatting through `dayjs.locale`, both following the selected language.-- Group numbers by the selected language instead of the browser's, so digits and dates on the same screen stop disagreeing.-- Set the document's language attribute and title from the selected language, replacing the hardcoded `lang="en"` and English `<title>` in `frontend/index.html`.-- Translate status labels via lookup tables keyed by the existing status enums, replacing the copy-pasted `renderStatusTag` / `renderStatus` variants. Enum values stay English: they are wire protocol.-- **BREAKING** for contributors, not users: after a slice is migrated, a literal string in its JSX fails the lint job.--### The language control--The website's `LanguageSelectorComponent` is the reference: a compact button in the navbar showing the current language, a dropdown that opens on hover and lists the six languages by their native names.--Here it is merged with the existing theme control into one paired button, language on one side and Dark/Light/System on the other, in the style the website already uses to glue the language selector to the GitHub button (`isSplitEnd`).--That merge also settles placement. `ThemeToggleComponent` already renders in three places, and the paired control replaces it at all three:--- `widgets/main/MainScreenComponent.tsx:254` - the main navbar-- `widgets/main/SidebarComponent.tsx:132` - the sidebar, for narrow viewports-- `features/users/ui/AuthNavbarComponent.tsx:49` - the authentication screen--So the language is selectable before login, not only after it. The choice is stored in `localStorage`, and on a first visit with nothing stored the interface starts in the highest-ranked language the browser prefers that the product actually ships.--### Out of scope--- The backend. Its ~416 free-text error responses keep reaching the user in English through `alert(e.message)`. This change only fixes the frontend's side of the contract: translate by `ApiError.code` when one is present, fall back to `message` when it is not, so the backend work later is additive.-- Replacing `alert()` with AntD notifications (20+ sites). A real improvement, a separate change.-- Unit words stay English: `h`/`m`/`s` in `formatDuration`, `MB` and `GB` in sizes. `formatDuration` needs no change at all, its digits being too small to group. The digits in sizes and counts are in scope and follow the selected language.-- Clock format and date order stay derived from the browser, not from the selected language. See design.md - Two axes.-- Technical strings: engine names, `pg_dump` and friends, connection strings, command blocks, cron expressions.-- Persisting the language choice server side. It lives in `localStorage`, like the theme.--## Capabilities--### New Capabilities--- `frontend-localization`: the frontend renders its interface in a user-selected language, keeps dictionaries provably complete, and prevents untranslated strings from being added.--### Modified Capabilities--None. This is the repository's first change; `openspec/specs/` is empty.--## Impact--- `frontend/package.json`: adds `i18next`, `react-i18next`, `eslint-plugin-i18next`. Runtime cost is roughly 40 KB plus one dictionary per session.-- `frontend/eslint.config.js`: gains one config object per migrated directory.-- `frontend/src/App.tsx`: `LocaleProvider` wraps the tree, `ConfigProvider` receives an AntD locale.-- `frontend/index.html`: the hardcoded `lang="en"` and English `<title>` are set from the selected locale instead.-- Eight `toLocaleString()` call sites: number grouping follows the selected language rather than the browser's.-- `frontend/src/shared/ui/ThemeToggleComponent.tsx`: becomes half of a paired control; its three call sites change with it.-- `frontend/src/features/**` (105 files, 23,800 lines), `frontend/src/entity/**` (~136 strings), `frontend/src/widgets/**`, `frontend/src/pages/**`: every user-facing literal moves to a dictionary key.-- `AGENTS.md` (root): the "Language in code" rule gains a fourth permitted location. See the rule change above.-- `frontend/AGENTS.md`: the copy rules gain the i18n convention.-- Existing frontend tests that assert on English text.-- No backend, agent, or API changes.diff --git a/openspec/changes/translate-frontend-ui/tasks.md b/openspec/changes/translate-frontend-ui/tasks.mddeleted file mode 100644index 382ba736..00000000--- a/openspec/changes/translate-frontend-ui/tasks.md+++ /dev/null@@ -1,66 +0,0 @@-## 1. i18n infrastructure--- [ ] 1.1 Add `i18next`, `react-i18next` and `eslint-plugin-i18next` to `frontend/package.json` and verify `pnpm install` succeeds and `pnpm build` still passes-- [ ] 1.2 Create `shared/i18n/locales/en.ts` with the top-level namespaces (`common`, `status`, `errors`, plus one per domain) and verify `tsc -b` passes-- [ ] 1.3 Add the `i18next` module augmentation typing `resources` as `typeof en`, and verify that `t('does.not.exist')` is a type error while a real key is not-- [ ] 1.4 Create `shared/i18n/locales/ru.ts` typed `const ru: typeof en`, and verify that deleting one key from it makes `tsc -b` fail with that key named-- [ ] 1.5 Configure the i18next instance with `returnNull: false`, `nsSeparator: false`, `interpolation.escapeValue: false` and `fallbackLng: 'en'`, and verify `t()` is typed `string` at call sites-- [ ] 1.6 Add `LocaleProvider` and `useLocale` in `shared/i18n`, mirroring `shared/theme/ThemeProvider.tsx`, reading `databasus-locale` from `localStorage` during initialization and falling back to `navigator.language` matched against the six supported languages, then English, and verify a stored locale is applied on first paint with no flash of English-- [ ] 1.7 Wrap the tree in `LocaleProvider` in `App.tsx` and pass the matching AntD locale to `ConfigProvider`, and verify table pagination and an empty table render in Russian when Russian is selected-- [ ] 1.8 Wire `dayjs.locale()` to follow the selected locale and verify month and weekday names in a `DatePicker` change with the language-- [ ] 1.8a Set `document.documentElement.lang` and the document title from the selected locale, replacing the hardcoded `lang="en"` and English `<title>` in `frontend/index.html`, and verify the tab title and the reported language both change with the selection-- [ ] 1.8b Add a locale-aware number formatter in `shared/i18n` and verify with a unit test that an English browser with French selected groups digits the French way, that Chinese groups Western-style rather than in the 万 form, and that unit words are not its concern-- [ ] 1.8c Confirm that `shared/time/getUserTimeFormat.ts:3,43` and `shared/time/utils.ts:5` keep deriving clock format and date order from `navigator.language`, and record in `frontend/AGENTS.md` why those three reads are correct where a bare `toLocaleString()` is not, so a later reader does not "fix" them-- [ ] 1.9 Build the paired language and theme control in `shared/ui`, with the language half showing the current language and opening its native-name list on hover, using contiguous hover padding rather than a margin so crossing from button to list does not close it, and verify the list stays open while the pointer moves onto it-- [ ] 1.10 Replace `ThemeToggleComponent` with the paired control at all three call sites (`widgets/main/MainScreenComponent.tsx:254`, `widgets/main/SidebarComponent.tsx:132`, `features/users/ui/AuthNavbarComponent.tsx:49`) and verify the control renders in the navbar, in the narrow-viewport sidebar and on the authentication screen-- [ ] 1.11 Verify end to end that a language chosen before signing in survives the sign-in, that a first visit on a Spanish system starts in Spanish, that an unsupported system language starts in English, and that an explicit choice outranks the system language on later visits--## 2. Lint enforcement--- [ ] 2.1 Add an `i18next/no-literal-string` config object to `frontend/eslint.config.js` scoped to `src/features/settings/**` with exclusions for technical strings and non-prose AntD props, and verify `pnpm lint` passes on the migrated slice and fails when a literal label is reintroduced-- [x] 2.2 Amend the "Language in code" section of the root `AGENTS.md` to permit target-language text in `frontend/src/shared/i18n/locales/<locale>.ts` and nowhere else under `frontend/src/`, and verify the amended wording still forbids translated fallback copy and error messages outside that directory. Do not start section 5 until this task is done and approved-- [ ] 2.3 Document the i18n convention in `frontend/AGENTS.md`: dictionary keys are domain-scoped, English is the key source of truth, technical strings stay literal, and each migrated directory gets a lint config entry--## 3. Error handling contract--- [ ] 3.1 Add an `errors` namespace keyed by backend error code and a `translateApiError` function that resolves an `ApiError` by `code`, falling back to `message` when the code is absent or unknown, and verify all three branches with a unit test-- [ ] 3.2 Route the existing `physicalConnectionErrorContent` lookup in `EditPostgreSqlPhysicalSpecificDataComponent.tsx` through that helper and verify the physical connection error paths still show their specific copy--## 4. Status labels--- [ ] 4.1 Add a `status` namespace and a typed `Record<Enum, TranslationKey>` beside each of the seven status enums in `entity/*/model/`, and verify that adding an enum member without a label fails `tsc -b`-- [ ] 4.2 Replace the duplicated `renderStatusTag` in `VerificationDetailDrawer.tsx` and `renderStatus` in `VerificationsComponent.tsx` with lookups against the shared table, keeping each component's own markup, and verify both screens render the same labels--## 5. Slice migration (English and Russian together)--Ordering is deliberate and not by size alone. `features/settings` comes first to prove the infrastructure on four strings. `features/databases` comes second, out of size order, because it is the largest and most varied slice: if the key namespace design breaks anywhere it breaks there, and finding that out after nine migrated slices would mean reworking all of them. The cost is doing the hardest slice before the pattern is fluent. The rest then run ascending.--- [ ] 5.1 Migrate `features/settings` and enable the lint rule for it, and verify `pnpm lint`, `pnpm test` and `tsc -b` pass-- [ ] 5.2 Migrate `features/databases`, the largest slice, and enable the lint rule for it, then review whether the namespace design survived it and revise the key layout before continuing if it did not, and verify the same three commands pass-- [ ] 5.3 Migrate `features/restores` and enable the lint rule for it, and verify the same three commands pass-- [ ] 5.4 Migrate `features/healthcheck` and enable the lint rule for it, and verify the same three commands pass-- [ ] 5.5 Migrate `features/workspaces` and enable the lint rule for it, and verify the same three commands pass-- [ ] 5.6 Migrate `features/users` and enable the lint rule for it, and verify the same three commands pass-- [ ] 5.7 Migrate `features/verification` and enable the lint rule for it, and verify the same three commands pass-- [ ] 5.8 Migrate `features/notifiers` and enable the lint rule for it, and verify the same three commands pass-- [ ] 5.9 Migrate `features/backups` and enable the lint rule for it, and verify the same three commands pass-- [ ] 5.10 Migrate `features/storages` and enable the lint rule for it, and verify the same three commands pass-- [ ] 5.10a Replace the bare `toLocaleString()` calls with the formatter from 1.8b as each owning slice is migrated (`LogicalBackupsComponent.tsx:513,515` and `PhysicalBackupsComponent.tsx:49,52` with `features/backups`, `VerificationDetailDrawer.tsx:45,48,157` with `features/verification`, `StarButtonComponent.tsx:56` with `shared/ui/`), rather than in a separate pass over the same files, and verify no bare `toLocaleString()` survives-- [ ] 5.11 Migrate the remaining copy in `entity/`, `widgets/`, `pages/` and `shared/ui/`, including `ConnectionStringParser` error text and `getNotifierNameFromType`, and enable the lint rule for those directories, and verify the same three commands pass-- [ ] 5.12 Update frontend tests that assert on rendered English prose to assert on keys or stable identifiers instead, and verify `pnpm test` passes--## 6. Remaining languages--- [ ] 6.1 Confirm the key set has stopped changing after section 5, then write `es.ts`, and verify `tsc -b` passes with no missing or stray keys-- [ ] 6.2 Write `pt.ts` (Brazilian Portuguese, matching the website's pt-BR conventions) and verify `tsc -b` passes-- [ ] 6.3 Write `fr.ts` and verify `tsc -b` passes-- [ ] 6.4 Write `zh.ts` (Simplified, matching the website's conventions) and verify `tsc -b` passes-- [ ] 6.5 Add each new locale to the switcher, the AntD locale map and the dayjs locale map, and verify each language renders end to end--## 7. Verification--- [ ] 7.1 Walk every screen in Russian and French looking for clipped or wrapped labels in AntD forms with fixed `labelCol`, and fix the layouts that break-- [ ] 7.2 Spot-check Chinese on the table-heavy screens (backups, databases, verification runs) for line height and CJK-Latin spacing-- [ ] 7.3 Confirm in every language that command blocks, connection strings, cron expressions, engine names and the unit words in duration and size readouts are byte-identical to English, while the digits inside those readouts follow the selected language-- [ ] 7.4 Confirm in every language that the browser tab title and the document language attribute match the selection, and that no bare `toLocaleString()` remains-- [ ] 7.5 Run `pnpm lint`, `pnpm format`, `pnpm test` and `pnpm build` from `frontend/` and confirm all passdiff --git a/openspec/specs/frontend-localization/spec.md b/openspec/specs/frontend-localization/spec.mdnew file mode 100644index 00000000..d1b2fff2--- /dev/null+++ b/openspec/specs/frontend-localization/spec.md@@ -0,0 +1,244 @@+# Frontend Localization Specification++## Purpose++Lets a user read the Databasus interface in their own language, and gives the project a way to keep every language complete as the product changes.++## Requirements++### Requirement: The interface renders in the selected language++The frontend SHALL render all user-facing copy in one of six languages: English, Russian, Spanish, Portuguese, Chinese and French. Copy includes labels, placeholders, button text, headings, table columns, empty states, confirmation dialogs, tooltips and validation messages.++Technical strings are excluded and stay identical in every language: command lines and code blocks, connection strings, cron expressions, database engine and tool names, file paths, and duration readouts such as `2h 15m 3s` in full, and the unit words in size readouts such as the `GB` in `1.4 GB`. The digits in a size or a count are not excluded; see the number formatting requirement below.++#### Scenario: A user switches language++- **WHEN** a user selects Russian+- **THEN** every visible label, button and message re-renders in Russian without a page reload+- **AND** command blocks, connection strings and engine names remain byte-identical to what English showed++#### Scenario: Switching language keeps what is on screen++- **WHEN** a user switches the language while a form on the page holds unsaved input, or from the language control inside the open narrow-viewport sidebar+- **THEN** the form keeps its input and the sidebar stays open, both now labelled in the new language++### Requirement: The language control sits beside the theme control++The language control SHALL be presented together with the light/dark theme control as a single paired element, and SHALL appear everywhere that element appears: the main navigation bar, the narrow-viewport sidebar, and the authentication screen. A user SHALL be able to choose a language before signing in.++The control SHALL show which language is currently active, and SHALL list all six by their native names rather than by language code or flag.++#### Scenario: Choosing a language before signing in++- **WHEN** an unauthenticated user opens the authentication screen+- **THEN** the language control is visible there+- **AND** selecting a language translates the authentication screen immediately and keeps that language after signing in++#### Scenario: Opening the language list++- **WHEN** a user moves the pointer onto the language control+- **THEN** the list of six languages opens without requiring a click+- **AND** moving the pointer from the control to the list does not close it++#### Scenario: Narrow viewport++- **WHEN** the viewport is too narrow for the main navigation bar+- **THEN** the paired language and theme control remains reachable in the sidebar++### Requirement: The language choice defaults to the browser's preference and persists++On a first visit with no stored choice, the frontend SHALL take the browser's ordered list of preferred languages and use the first entry that matches a supported language, ignoring any region subtag, and English when none matches. Once a user makes a choice, that choice SHALL be stored in the browser and applied on subsequent visits.++#### Scenario: First visit with Spanish preferred++- **WHEN** a user whose browser reports Spanish as its preferred language opens the application for the first time+- **THEN** the interface renders in Spanish++#### Scenario: The first preference is unsupported++- **WHEN** a user whose browser reports German first and Russian second opens the application for the first time+- **THEN** the interface renders in Russian rather than English, because Russian is the highest-ranked supported preference++#### Scenario: No preference is supported++- **WHEN** a user whose browser reports no supported language opens the application for the first time+- **THEN** the interface renders in English++#### Scenario: A regional variant with no dictionary of its own++- **WHEN** a user whose browser reports Taiwanese Chinese or European Portuguese opens the application for the first time+- **THEN** the interface renders in the single Chinese or Portuguese variant the product ships, rather than falling through to English++#### Scenario: An explicit choice outranks the browser preference++- **WHEN** a user whose browser prefers Spanish selects English+- **THEN** the interface renders in English on this and every later visit from the same browser++#### Scenario: The choice survives a reload++- **WHEN** a user has selected a language and then reloads the page or returns in a new session on the same browser+- **THEN** the interface renders in the previously selected language+- **AND** the first paint is already in that language, with no visible flash of English++### Requirement: Library and framework text follows the selected language++Text produced by the component library and by date formatting SHALL follow the selected language, not the browser default and not English.++#### Scenario: Component library strings++- **WHEN** the interface renders in a non-English language+- **THEN** table pagination, empty-table placeholders, date pickers, select dropdowns and confirmation popovers display their built-in text in that language++#### Scenario: Dates and times++- **WHEN** the interface renders in a non-English language+- **THEN** month names, weekday names and relative times render in that language++### Requirement: Numbers are grouped by the selected language++Numeric values displayed to the user SHALL be grouped and separated according to the selected language rather than the browser's own locale, using each language's standard digit grouping. Unit words attached to a number stay English. Abbreviated forms that read as prose, such as the Chinese 万 form the website uses for millions in running text, are not used in the interface: counts and sizes appear in full.++#### Scenario: A browser locale that differs from the selected language++- **WHEN** a user whose browser is English selects French, and a screen shows a row count of one million eight hundred thousand+- **THEN** the number is grouped in the French convention rather than the English one+- **AND** it does not disagree with the dates on the same screen, which already follow the selected language++#### Scenario: Clock and calendar conventions are regional, not linguistic++- **WHEN** a user selects a language whose speakers commonly use a 24-hour clock, while their browser reports a region that uses a 12-hour clock+- **THEN** times continue to display in the 12-hour form their browser reports+- **AND** the words around those times, including month and weekday names, are still in the selected language++#### Scenario: A size readout++- **WHEN** a backup size is displayed in a language that groups digits differently from English+- **THEN** the digits are grouped for that language+- **AND** the unit remains `MB` or `GB`++### Requirement: The document reports the selected language++The page SHALL declare the selected language to the browser, and its title SHALL be translated.++#### Scenario: Assistive technology and browser translation++- **WHEN** the interface renders in a given language+- **THEN** the document's language attribute reports that language+- **AND** the browser does not offer to translate a page that is already in the reader's language++#### Scenario: The browser tab++- **WHEN** the interface renders in a non-English language+- **THEN** the browser tab and any bookmark made from it show a title in that language++### Requirement: Website links open in the selected language++When the interface links to a page on the product website, the link SHALL open that page in the selected language if the website publishes it in that language, and the English page otherwise. A link to a section of a page SHALL land on that section in either case.++#### Scenario: The website has the page in the selected language++- **WHEN** a user with Russian selected follows a link to the installation guide+- **THEN** the Russian version of the installation guide opens++#### Scenario: The website has the page only in English++- **WHEN** a user with Russian selected follows a link to a page the website publishes only in English+- **THEN** the English page opens rather than a missing page++#### Scenario: A link to a section++- **WHEN** a user with Chinese selected follows a link to a section of a translated page+- **THEN** the Chinese page opens scrolled to that section++### Requirement: Status labels are translated while wire values stay stable++Status values exchanged with the backend SHALL remain unchanged English identifiers. Their displayed labels SHALL be translated.++#### Scenario: A backup status is displayed++- **WHEN** the backend reports a backup status of `COMPLETED` and the interface renders in Spanish+- **THEN** the user sees the Spanish label for a completed backup+- **AND** the value sent back to the backend in any subsequent request is still `COMPLETED`++#### Scenario: A new status value is introduced++- **WHEN** a new value is added to a status enum and no label is supplied for it+- **THEN** the type check fails++### Requirement: Dictionary completeness is enforced by the type checker++Each non-English dictionary SHALL be checked against the English dictionary at build time. English is the source of truth for the set of keys; the wording of each language is written independently and is not a literal rendering of the English text.++#### Scenario: A key is missing from a translation++- **WHEN** a key exists in the English dictionary and is absent from any other language+- **THEN** the type check fails and names the missing key++#### Scenario: A key is left over in a translation++- **WHEN** a key is removed from the English dictionary but remains in another language+- **THEN** the type check fails and names the stray key++#### Scenario: A lookup uses an unknown key++- **WHEN** code requests a key that does not exist in the English dictionary+- **THEN** the type check fails++### Requirement: New code cannot add hardcoded strings++The lint job SHALL reject a user-facing string literal added anywhere in the frontend source. Technical strings and test files are exempt.++#### Scenario: A hardcoded string is added++- **WHEN** a contributor adds a literal label, placeholder or message to any frontend source file+- **THEN** the lint job fails and points at the literal++#### Scenario: A technical string is added++- **WHEN** a contributor adds a command block, connection string or engine name to a frontend source file+- **THEN** the lint job accepts it, either through the configured exclusions or through an inline suppression carrying a reason++### Requirement: Translated text and inserted values render as plain text++Every translated message SHALL reach the page as text, never as markup. A value inserted into a translated sentence, such as a workspace, user or database name, SHALL be shown as text and SHALL never become markup, even when it contains characters that look like HTML. The only markup in a translated sentence is the formatting the interface itself supplies, such as code spans, bold text and links.++#### Scenario: A name that looks like markup++- **WHEN** a workspace is named `<img src=x onerror=alert(1)>` or `<strong>bold</strong>` and a translated sentence mentions it, including a sentence that carries the interface's own formatting+- **THEN** the sentence shows that name literally, as text+- **AND** no element is created from it and no script runs++#### Scenario: A translation that contains markup-like text++- **WHEN** a translated message contains angle brackets that are not part of the interface's own formatting+- **THEN** they are shown as characters rather than interpreted as elements++### Requirement: Backend errors are translated by code, with the message as fallback++The frontend SHALL translate an error response by its stable error code when the backend supplies one, and SHALL display the backend's message text only when no code is present or the frontend has no translation for it. This change does not add codes to the backend.++#### Scenario: The backend supplies a known error code++- **WHEN** a request fails with an error code the frontend has a translation for+- **THEN** the user sees the translated message in the selected language++#### Scenario: The backend supplies no code++- **WHEN** a request fails with only a free-text message+- **THEN** the user sees that message as-is, in a container whose surrounding copy is translated++#### Scenario: The backend supplies an unrecognized code++- **WHEN** a request fails with an error code the frontend has no translation for+- **THEN** the user sees the backend's message text rather than a raw code or a blank message++#### Scenario: The backend supplies an unrecognized code and no message++- **WHEN** a request fails with an error code the frontend has no translation for and no message+- **THEN** the user sees a general error message in the selected language rather than the raw code++#### Scenario: The request fails without an answer from the backend++- **WHEN** the server cannot be reached, or answers with an error status but no error description+- **THEN** the user sees a message in the selected language rather than a request address or a status line