Repository navigation
feat(admin): interface languages (English, 简体中文) and an interface review - #1
Merged
Merged
Conversation
@lingui/core and @lingui/react at runtime; @lingui/vite-plugin, @lingui/cli and @lingui/format-po at build time. 6.11.0 rather than 6.12.0, which was ten days old. Registered in TECH_STACK.md §6 and §11.1 with licences, transitive count, install scripts (none) and the measured first-load delta. Decision D1 of docs/ADMIN_I18N_AND_UI.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd sign-in The admin resolves its interface language before the first render: the choice kept in this browser, else the first of the browser's languages it has a catalog for, else English. The account menu gains "Interface language", listing English and 简体中文 in their own names; switching re-renders in place and sets <html lang>. No cookie is set. Messages stay English in the source behind Lingui's macros and are extracted to src/admin/locales/*.po, each catalog a chunk of its own. `pnpm lint` now fails on a missing translation or a stale catalog, and the build fails if a macro survives untransformed, which would otherwise render as nothing. Start-up is a promise rather than a top-level await, which made Rolldown split the entry and cost 7.7 KiB. The account menu's two radio groups are named by their labels, so 16-appearance looks for the checked scheme inside its own group. Playwright pins locale en-US. admin first load: 165.4 KiB gzip (was 161.7; budget 170) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Records the owner's decisions D1 to D8 (every recommendation taken), the phases, and phase 0's measurements in this admin's real build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mat in it The sign-in page and the setup wizard get a language control, a native select so the first load stays small. src/admin/format.ts formats numbers, dates and durations in the interface language; the account page, the advanced settings and the saved note use it, and the hand-built "N minutes" plural becomes Intl's unit format. admin first load: 165.5 KiB gzip (budget 170) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Site, Appearance, Email and Advanced, and the saved note and standing purge
notice they share. Fields a page declares itself are built in the interface
language; counts go through plurals ("1 URL moved"); the cause of a failed
purge is joined with Intl.ListFormat; storage counts get labels instead of
the Worker's keys. The two window.confirm prompts are messages too.
The core Vitest project compiles Lingui macros, since test/admin imports
these pages; redeploy-notice reads the instant/deploy lists as messages.
Still English here: labels a theme declares (D4), the form controls'
own words (end of phase 2) and text the Worker sends (D3).
admin first load: 165.3 KiB gzip (budget 170)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The account page, the content list, the media library and its picker, the token status lines and the upload errors now read in Simplified Chinese when that is the interface language. - Token statuses are whole sentences rather than a status joined to a lower-cased "used" phrase, so word order belongs to the translation. - The "in use" refusal counts its references with a real plural. - The upload widths are a conjunction list without digit grouping: Chinese joins a unit list with no separator, which printed "4809601,440". - A status badge wraps only where English would (`break-keep`); in a narrow cell Chinese stacked "已发布" one character per line. Content kind names come from the theme and stay as declared until the theme overlays of phase 3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…itor
The plugins page, a plugin's declarative panels, their related rows,
the record editor and the action-parameters form now read in Simplified
Chinese when that is the interface language.
What a plugin declares — its name, description, panel, column, field
and action labels — stays as declared until the plugin overlays of
phase 3. The list of missing layouts takes its separator from the
catalogue (", " in English, "、" in Chinese). "Remove variants 1" keeps
the plugin's label lower-cased mid-sentence in English, a no-op for a
language without case.
`i18n:extract` now passes `--clean`, so a message that left the source
leaves the catalogues instead of lingering as an obsolete entry.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The content editor, the Markdown pane, the first-run wizard, the form generator's controls and messages, the slug notices, the network failure and the admin's 404 page now read in Simplified Chinese when that is the interface language. That completes phase 2's wrapping: 364 messages. - `REQUIRED_MESSAGE` becomes `requiredMessage()`. A constant was read at module load, before any language was active; the sign-in and account schemas pass the function to zod 4 as `error`, read when a value is checked. - The wizard's counts are real plurals, so "1 pages · 1 sample records" reads "1 page · 1 sample record", and `01-wizard` asserts the corrected English. - Tests that call translated helpers outside React activate English first. docs/ADMIN_I18N_AND_UI.md records phase 2 as built and which parts of its gate have not run yet: the pseudo-language pass, axe in Chinese, and screenshots on Windows and Linux. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…dmin in Chinese A pseudo-language pass — every catalog message wrapped in ⟦ ⟧, every screen and overlay walked — found seven sentences outside the catalog, all in vendored components: the sidebar's "Toggle Sidebar" and its mobile sheet's title and description, the sheet's and dialog's "Close", the breadcrumb's label and "More", and the toasts' region label. They are translated now; English is unchanged. `05-accessibility` gains a Chinese pass: the sign-in screen for a browser that prefers Chinese, and every admin screen and the editor with Chinese chosen. No serious or critical violation. docs/ADMIN_I18N_AND_UI.md records both runs, what the second left unmarked and why, and that Windows and Linux screenshots have not been taken. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
D2 of docs/ADMIN_I18N_AND_UI.md. Migration 0010 adds a nullable `admin_user.ui_locale`. `GET /auth/me` and the sign-in response return it as `uiLocale`; `PATCH /auth/me` changes it for a browser session. The Worker checks that the value is shaped like a language tag and nothing more: which languages have a catalog is the admin's business. The wizard carries the language it is used in into the new account. After sign-in, and on every load of a signed-in shell, the account's language wins over the browser's and is copied to it, before the shell renders. Choosing a language in the account menu writes both, and says so when the account could not be told. `05-accessibility`'s Chinese pass chooses Chinese in the account menu, as an operator does; writing `localStorage` alone would now be overridden by the account and scan English without failing, so each screen asserts its `lang` before it is scanned. `20-interface-language` checks that a second browser signs in already in the account's language. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
D4 of docs/ADMIN_I18N_AND_UI.md. A theme may ship `admin/<ui-locale>.json`: a flat map from a declaration's path (`kinds.product.fields.grade.label`, `groups.Specification`, `options.hero_title.label`, …) to its words in one interface language. The build refuses a catalog that is not a map of strings or that names something the manifest does not declare. The admin sends its interface language as `Accept-Language`, and `GET /_mallok/api/theme` lays the best matching catalog over the manifest: an exact tag, then the same primary language; a missing key keeps the declared English. Only words change — ids, types, layouts and choices are as declared. The endpoint also returns the theme's own words under `declared`, and the editor's preview renders from those: a page titles a list and its links with a kind's label, so a preview rendered from translated labels could differ from the site. Choosing a language refetches the theme and the plugins; sign-in adopts the account's language before loading the workspace. The five official themes ship `admin/zh-CN.json`. THEME_FORMAT.md §10.1 documents the file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
D5 of docs/ADMIN_I18N_AND_UI.md. A plugin may pass `adminCatalogs` to `definePlugin`, keyed by interface language: flat maps from where a word is declared (`settings.recipient.label`, `panels.<id>.columns.<field>`, `panels.<id>.actions.<id>.label`, …) to that word. `definePlugin` refuses a catalog that is not an object of strings, is keyed by something other than a language tag, or names anything plugin.json does not declare. It is part of the implementation, not of plugin.json, so a version 1 plugin may have one. `GET /_mallok/api/plugins` lays the best matching catalog over each plugin — an exact tag, then the same primary language — and gives each panel the words that have no declaration of their own: `names`, for a field shown by its name (a filter, the detail view, the search box), and `values`, for how a badge value reads. The panel view and related rows use them; nothing shown in English changes. The test fixture plugin carries a partial catalog, and `20-interface-language` checks both what it names and what it leaves in English. PLUGIN_API.md §7.8 documents the catalogs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The official `inquiry` plugin gains `admin/zh-CN.json` and passes it to `defineOfficialPlugin` as `adminCatalogs` (docs/PLUGIN_API.md §7.8): its settings, secret, panel, columns, detail fields, actions and the words for its three status values. Its plugin.json is unchanged and still declares plugin API 1, which is what D5 of docs/ADMIN_I18N_AND_UI.md asks of it. The worker test of the theme's catalog becomes `admin-catalogs.test.ts` and also checks `GET /_mallok/api/plugins` in Chinese and in English. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
D3 of docs/ADMIN_I18N_AND_UI.md. `problem()` takes an optional `code` and `params`, sent beside the unchanged English `error`, which the CLI and scripts keep reading. The first 25 codes cover the router's own refusals, sign-in, the account, API tokens and every setup step. The admin files its sentence for each code under the message id `server.<code>` in `server-messages.catalog.ts`, which is extracted but not bundled, and `api.ts` words an `ApiError` from the loaded catalog when it has the code and from `error` otherwise, so no caller changed. A bundled lookup table cost 0.6 KiB of first load for 25 codes; keyed by id, the sentences ride in the lazily loaded catalogs instead. A failed sign-in now reads in Chinese on a Chinese sign-in page. Tests check the body's `code` and `params`, the sentences in both languages, and that the admin knows no code the Worker never sends. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The second batch of D3 (docs/ADMIN_I18N_AND_UI.md): every refusal of a content save — kind or language not enabled, an unreadable front matter, a missing title, a bad asset path, a taken address, a translation that already exists, a plugin's rewrite — and every reason `slugProblem` and `slugPlacementProblem` give. `SlugProblem` gains `code` and `params`. A reason given with a suggestion has its own code, ending in `_use`, with the suggestion as `use`. Because the core gives them, the admin's slug field says the same reasons in the interface language before any request is made, not only after one. An unreadable front matter keeps the parser's own words as `reason`: they point at the line, which no catalog could. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The next batches of D3 (docs/ADMIN_I18N_AND_UI.md): media uploads and their variants, site settings and the two URL-rewriting operations, the email settings, the export, and every refusal of the plugin endpoints — the switch, settings, secrets, panels, records, actions and related rows. Field problems are named too. `validateRecord` returns `errorCodes` beside `errors`, a code and its parameters per field, and a records panel's or an action's refusal sends them; `api.ts` words each field from its code. A plugin's own field messages carry no code and are shown as written. The admin's upload is a raw PUT rather than `api()`, so it reads the code itself. Settings' stranded-slugs refusal is pluralised in the catalog exactly as the Worker pluralises it, so the English reads as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The last admin-facing errors of D3 (docs/ADMIN_I18N_AND_UI.md): a failed cache purge is named by the advice it gives (`cache.purge_refused`, `cache.purge_limited`, `cache.purge_failed`), with Cloudflare's reply as a parameter, and the handler's own 404, 503 and 500 carry codes. Two tests that compared an internal 404's body byte for byte now expect the code beside the sentence; the body still carries nothing else. The design document records what D3 covers — 128 codes — and what stays English on purpose: a plugin's own refusals, reasons quoted from a library or from Cloudflare, the admin app's raw "not part of this build", and the public routes' errors, which visitors meet rather than operators. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… page U1 and U2 of docs/ADMIN_I18N_AND_UI.md. The standing note shown while no cache-purge token is configured was three lines at 1440 px and seven at 390, above every page, and named Worker secrets on pages that are not about infrastructure. It is now one line — when changes reach visitors, and "Why?" — and the secret names are on Advanced → Diagnostics, where the link lands. The note, the page header and the page now share one column: the note moved inside it, `Page` stops capping itself at a narrower width, and a section caps its fields instead, so a settings page no longer sits as a narrow strip inside a wider column. The note lives in `shell.tsx`: importing React Router into `saved-note.tsx`, which the editor's chunk shares, re-split the entry and cost 1.4 KiB of first load. `20-interface-language` no longer asserts column headings that exist only when earlier specs have left rows in the fixture panel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
U15 and U10 of docs/ADMIN_I18N_AND_UI.md, with U12's taglines. A successful save is always the green "Saved", followed by when visitors see it as plain text. Without a purge token it used to be an orange "Saved — visitors see it within 1 minute" badge, which read as a problem. A content language is now chosen with one control everywhere, labelled "Content language", and named by `Intl.DisplayNames` in the interface language with its code beside it: the content list's filter, Appearance's former "Editing" select and the editor's language bar. On Site, other languages' taglines sit behind that select instead of one text box per language. Browser tests find the changed controls by their new names: the saved note's status region, "Tagline in Chinese (zh)", "Create Chinese (zh)". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A review of the first phase-4 commits found loose ends: - A saved draft said when visitors would see it, which they never do. It now gets the "Saved" badge alone. - The Languages card still listed bare codes. It names them, and so do the make-default confirmation and notice. - The taglines sat in a nested box. They are now flat, and the language select appears only from two further languages on. - Two English notes from the Worker reached Advanced; the admin now says them in the interface language. Structure for later items: `Page width="full"`, `Section wide`, and `ContentLanguageOptions` without the labelled field. The language name formatter is memoised per interface language. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
U4–U6 of docs/ADMIN_I18N_AND_UI.md, one page: - The Type column shows the theme's label, and Updated is a date in the interface language. - The header drops "Media", which the sidebar already has. "New" names what it makes and opens the editor with the filtered kind. - The pager is hidden when there is one page. - An empty language and a filter that matches nothing get their own states, each with the action that fills it. - On a phone, a row is the title with type and status under it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
U7–U9 of docs/ADMIN_I18N_AND_UI.md, one page: - The editor takes the window's width, and its field pane folds to a rail. The browser remembers whether it is folded. - The bar shows the item's status, when it was last updated, and "View on site" for a published item. - The open language is marked with `aria-current` instead of the green of "Published". - On a phone, Fields, Write and Preview are shown one at a time. The save buttons stay pinned to the bottom of the screen. - 21-editor-layout covers this at 1440 and 390 px. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…assword The wizard's language step offers the theme's languages first, then widely used ones, by name; a code can still be typed. It has four numbered steps and a result screen, Back on steps 2-4, a show-password toggle, and the domain step links to Cloudflare's guide instead of reciting dashboard directions. The setup status names the theme's locales for this. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A plugin card now shows its panels, settings and secrets first, with hooks, client scripts and the cache effect under a closed "Technical details". The inquiry plugin's setting labels move their parentheses to help, its autoreply body is multi-line, a filter on named values is a select, and row actions wait for a selected row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Settings -> Site explains the domain and media domain without platform terms, the Languages card says it applies immediately where the other card has Save, and a language is added from a select of names with a typed code still accepted. The common-language list is shared with the wizard. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Settings -> Appearance opens with what an operator can change; the theme's facts, naming content types by the theme's labels, and the deploy note follow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Axe sometimes ran while the group labels were mid-transition and failed their half-transparent text on contrast. The phone case already waited for animations; the collapsed case now does too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Settings -> Advanced opens with the backup. Diagnostics marks only what stops something working in orange; what is simply not set up yet, such as a custom domain or a purge token, is neutral, so a fresh site is no longer five warnings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The media library, a plugin panel and the Plugins page now use the same muted block as the content list instead of a dashed box that looked like the upload drop zone. A records panel offers "Add the first one"; a filtered panel says nothing matches and offers "Clear filters". A panel that fits on one page hides its pager, as the content list does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Under a Chinese, Japanese or Korean interface language, the sidebar's group labels, its menu badges and Badge go from 12 px to 13 px. Han characters are at the edge of comfortable at 12 px; Latin is not. Line heights are unchanged, so no row grows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each panel not attached to a content kind is now a page of its own at /plugins/<plugin>/<panel> and a sidebar entry under Site, between Media and Plugins, so Inquiries is one click away instead of inside the plugin's card. The Plugins page keeps the switch, settings and secrets and links to each panel. The shell loads the plugin list with the rest of the workspace, so the sidebar is complete on first paint. "View site" in the sidebar's header opens the public site in a new tab. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A save whose body is too long to render safely succeeds as a draft and says why in `warning`, an English sentence the editor showed as it came. The response now names it, as D3 names errors: `warningCode` (`content.saved_unrendered`) and `warningParams.limitKb` beside the unchanged `warning`, so the editor says it in the interface language and the CLI keeps reading the English. admin:size 166.2 KiB first load; Worker 316.8 KiB gzip. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The setup step still told the reader to type `en` and `zh`. Since the wizard lists languages by name, with a code only for one not listed, the step says that, and says that the language the wizard is read in is the admin's interface language, not one the site publishes in. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ADMIN.md gains §4.3, the interface language: where it is chosen and kept, what follows it and what does not, the 13 px rule for Chinese, Japanese and Korean, and the steps to add a language. It is §4.3 rather than a new numbered section because other documents cite §13 and §14 by number. The pages the interface review changed are described as they now are: plugin panels as pages in the sidebar, and "View site"; Appearance with its options first; the wizard's languages by name, numbered steps and Back; the editor's bar, folding field pane, phone layout and "Saved"; a plugin's card order, its empty states and row actions; Advanced with the backup first and orange only for what stops something working. §13 records the first load, 166.2 KiB. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
§6 and §11.1 gain the measured end state of the admin's interface languages: English and Simplified Chinese, 543 messages, first load 166.2 KiB with every catalog on demand, and the Worker at 316.8 KiB, grown by phases 3 and 4's Worker-side changes and not by Lingui. `styles.css` now holds one type-size rule beside the tokens. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An [Unreleased] section for the work on feature/admin-i18n: English and Simplified Chinese in the admin, named Worker errors, admin catalogs for themes and plugins, plugin panels in the sidebar, and the pages the interface review reworked. Every API change is an addition. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The notices list 175 bundled packages, three more than main's 172: @lingui/core, @lingui/react and use-sync-external-store, which @lingui/react depends on, found by building both. What phase 5 changed in ADMIN.md, TECH_STACK.md, the CHANGELOG and GETTING_STARTED.md is listed, with what remains for the owner: Windows and Linux screenshots, the real-site check, and two wording questions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The admin speaks Simplified Chinese as well as English, and its pages were reviewed and reworked for the operator who uses them every day. The plan, its decisions (D1–D8) and each phase as built are in
docs/ADMIN_I18N_AND_UI.md; the user-facing summary is the CHANGELOG's[Unreleased]section.Interface languages (phases 0–3)
docs/TECH_STACK.md §11.1): English in the source, one.pocatalog per language, each loaded on demand. 543 messages, all translated.0010_admin_ui_locale,uiLocaleon/_mallok/api/auth/me), never in a cookie. It is not a content language (docs/ADMIN.md §4.3).codeandparamsbeside the unchanged Englisherror, and refused records carryerrorCodesbesideerrors. That is 129 codes, pluswarningCodefor a save kept as a draft. The admin words each code in its own language, and the CLI still reads the English.THEME_FORMAT.md §10.1,PLUGIN_API.md §7.8). The five official themes andinquiryhavezh-CN.Interface review (phase 4, U1–U20 and U3)
Closing (phase 5): ADMIN.md, TECH_STACK.md, GETTING_STARTED.md (EN and zh-CN), the CHANGELOG and the design doc are updated.
Every API change is additive. One schema migration runs on the first request after deploying.
Measurements
mainTHIRD_PARTY_NOTICESpackages@lingui/core,@lingui/react,use-sync-external-store)Test plan
pnpm lint && pnpm typecheck && pnpm test && pnpm build && pnpm bundle:size && pnpm admin:size. Lint includeslingui check syncandcheck missing --mode catalog. 1498 unit tests pass.pnpm test:e2e: 55 tests pass. They include20-interface-language(switching, persistence, the account preference, translated errors, theme and plugin catalogs) and21-editor-layout. Every selector change is explained in its commit.05-accessibilityscans every screen in English and in Chinese).Open questions
🤖 Generated with Claude Code