feat(admin): multilingual admin UI with per-user language#1
Merged
Conversation
Make the server-rendered admin panel multilingual in the 13 locales shipped by perry/landing (en, de, es, fr, it, ja, ko, pt, th, tr, vi, id, zh-Hans). Each user picks their display language; it persists to users.locale. - src/admin/i18n: bundled per-locale TS message bags (en is source of truth + runtime fallback), t()/t.plural() translator, locale helpers (coerceLocale, negotiateLocale), and per-request middleware resolving user.locale -> skelpoAdminLang cookie -> Accept-Language -> en. - Externalize every visible admin string (nav, dashboard, content editor, settings, media incl. inline-JS prompts, forms, users, redirects, menus, jobs, webhooks, flash messages, status badges, <html lang>) to t(). Data/API paths/capability names stay verbatim. - /admin/profile page + sidebar quick-switcher to set the language. - CLI: users create/update gain --locale (lockstep with the API). - Tests: unit coverage for translator, negotiation, and key parity across all 12 locales (320 keys each).
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.
What
Makes the server-rendered admin panel multilingual in the 13 locales shipped by
perry/landing(en, de, es, fr, it, ja, ko, pt, th, tr, vi, id, zh-Hans). Each user picks their own display language, persisted tousers.locale.How
src/admin/i18n/(new): bundled per-locale TS message bags —en.tsis the source of truth and the runtime fallback;makeT()gives at('dot.path', vars)translator with{placeholder}interpolation +t.plural(). Locale helpers (coerceLocalehandlesde-AT→de,zh-CN→zh-Hans;negotiateLocaleparsesAccept-Language). Per-request middleware resolvesusers.locale→skelpoAdminLangcookie → Accept-Language → en, mounted onadminRoutesso it covers every admin path (incl./admin).layout.tsx,routes.tsx,screens.tsx,contentEditor.tsx(nav, dashboard, content editor, settings, media incl. inline-JS prompts via injectedwindow.SKELPO_I18N, forms, users, redirects, menus, jobs, webhooks, flash messages, status badges,<html lang>). Content/setting data, API paths, and capability names stay verbatim./admin/profilepage + a sidebar quick-switcher that saves tousers.locale+ cookie and reloads in place.users create/updategain--locale(the API already accepted it).Notes
n===1rule across all locales — fine for these 13.en.ts, re-run the key-parity test).site.locales(content translation tabs) is intentionally untouched — that's separate from the admin UI language.Verification
npm run typecheck— clean.npm run test:unit— 57/57 pass, including 11 new i18n tests + a key-parity check (all 12 locales have the same 320 keys asen)./admin/loginacross locales confirms correct<html lang>+ translated output (zh-CN → zh-Hans,de → "Anmelden",ja → "サインイン").