Skip to content

perf(web): load admin text in its own catalog chunk - #3903

Merged
Quick104 merged 1 commit into
mainfrom
i18n/web-admin-chunk
Nov 10, 2026
Merged

Quick104 merged 1 commit into
mainfrom
i18n/web-admin-chunk

Conversation

@Quick104

@Quick104 Quick104 commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: #3188
Validation tasks: none (no visible change)

Stacked on #3902; the full stack order is in #3723.

The English catalog the app downloads at launch carries every admin message, about 1 MB of JSON, so every user pays for text only administrators see. This splits admin text into its own chunk.

Approach

A Vite plugin serves each generated catalog as two parts, ?part=app and ?part=admin (web.admin.*). The app part loads as before. The admin part, in English and in the current language, loads when the admin layout or the setup wizard asks (both wait for it), or when an administrator's session starts. A language change keeps it loaded. If the English admin part fails to load, the admin area reaches the app's error screen, as a failed lazy route does; a missing translated part falls back to English. Text a non-administrator can see stays outside web.admin.*.

Validation

  • Web tests, typecheck, ESLint, prettier, the size ratchet and the bidi check pass on this branch. A new test covers the split and fails without the plugin.
  • Eager launch download (brotli): 536 KB on feat(web): load the shared translation catalog and route text through one message API #3893, 422 KB from here on; the admin English chunk is lazy.
  • On a sandbox: a non-administrator visiting 15 user pages never requested the admin part; the admin area and setup wizard render after it loads.

Evidence

Evidence: https://evidence.siloserver.org/r/silo-server/pr-3903/

Surface and build: web admin, desktop; no visible change, captures show the admin dashboard rendering in each language.

Risks

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
  • The Evidence section shows every change a user can see, or says there is none.

AI Disclosure

  • Harness: Claude Code (in T3 Code)
  • Tool(s): Claude Code; Codex
  • Model(s): claude-opus-5-5; claude-sonnet-5-5; gpt-6.1-sol
  • Involvement: Fully AI-generated; human review pending
  • Adversarial review: code review by Claude (claude-opus-5-5); one adversarial round by Codex (gpt-6.1-sol) on the integration branch, findings fixed. A background review by Codex (gpt-6.1-sol) runs on this PR.

🤖 Generated with Claude Code

Note

Load admin text in its own catalog chunk and localize the web UI

  • Splits locale catalogs into app and admin parts: the English app part loads eagerly, admin and non-English catalogs load lazily via a new Vite plugin that filters messages by the web.admin. prefix (catalog.ts, vite.config.ts)
  • Adds the i18n layer — formatter, useT/useAppLanguage/useAdminMessages hooks, and LocaleProvider — plus locale resolution with eight shipped languages and pseudo-locale support (format.ts, appLocale.ts, useAppLocale.tsx)
  • Replaces hard-coded English strings across pages, settings, player, admin, and watch-together UI with translation lookups; number, date, and relative-time formatting now use the app locale instead of the runtime default
  • Adds a signed-out language picker on auth pages and a profile-scoped app-language setting in Accessibility settings
  • Localizes language names by loading CLDR display-name data per locale, with English as fallback (languageNames.ts)
  • Behavioral Change: English text remains the fallback for untranslated messages; some stored values (row titles, chart preset names) stay English by design. Status checks that previously compared displayed strings now use explicit markers or translated labels (e.g. sessionActive(session.last_seen_at), the web-push delivered marker), and ESLint enforces the new translation conventions

Macroscope summarized 8c40b2b.

@silo-triage silo-triage Bot added the size/L 200–499 added + deleted lines (all files); change volume, not priority. label Nov 9, 2026
@coderabbitai

coderabbitai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

  • Ask an admin to enable usage-based reviews

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Next included review available in 57 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 34e2e2c5-b26f-479b-add1-ad4777f48450
Commits

Reviewing files that changed from the base of the PR and between 0e943cf and d262d19.

Files selected for processing: 12

  • web/src/App.tsx
  • web/src/components/AdminLayout.tsx
  • web/src/hooks/useAppLocale.tsx
  • web/src/i18n/README.md
  • web/src/i18n/catalog.ts
  • web/src/i18n/format.ts
  • web/src/i18n/hooks.ts
  • web/src/i18n/index.ts
  • web/src/pages/SetupWizard.tsx
  • web/src/test-setup.ts
  • web/vite.config.test.ts
  • web/vite.config.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-10T02:12:51.441546Z d262d19 New commits
🔒 Security Review ✅ Completed 2026-11-10T02:15:27.828708Z d262d19 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@silo-triage silo-triage Bot added enhancement New feature or request javascript Pull requests that update javascript code priority: P2 Limited scope, workaround exists, or polish stacked Base is another open PR; merge in stack order named in the body labels Nov 9, 2026
@Quick104
Quick104 force-pushed the i18n/web-area-personal branch from 08d5032 to fa1c490 Compare November 9, 2026 18:47
@Quick104
Quick104 force-pushed the i18n/web-admin-chunk branch from ceb1a2e to a257dd7 Compare November 9, 2026 18:47
@Quick104
Quick104 force-pushed the i18n/web-admin-chunk branch from a257dd7 to 6a93e8a Compare November 9, 2026 20:08
@Quick104
Quick104 force-pushed the i18n/web-area-personal branch from fa1c490 to 2066036 Compare November 9, 2026 20:08
@Quick104
Quick104 force-pushed the i18n/web-admin-chunk branch from 6a93e8a to 8c40b2b Compare November 10, 2026 02:08
@Quick104
Quick104 force-pushed the i18n/web-area-personal branch from 210bd13 to 5e90e60 Compare November 10, 2026 02:10
@Quick104
Quick104 changed the base branch from i18n/web-area-personal to main November 10, 2026 02:10
@silo-triage silo-triage Bot added size/XXXL 3000+ added + deleted lines (all files); change volume, not priority. and removed size/L 200–499 added + deleted lines (all files); change volume, not priority. labels Nov 10, 2026
The admin extraction puts about 7,800 web.admin.* messages, roughly 1 MB
of JSON, in the English catalog that every launch downloads. A Vite
plugin now serves each catalog as two parts, and the admin part loads
only when AdminLayout or the setup wizard (which reuses admin forms)
asks, or once an admin's session starts. Both wait for it before they
render. A web.admin.* message formatted before then renders empty and
asks for the part after the render.

A failed admin chunk reaches the error boundary instead of leaving the
admin area blank; a cancelled load records nothing, and a missing
translated admin part falls back to English. useAppLanguage()
components re-render when the part arrives under the same language.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Quick104
Quick104 force-pushed the i18n/web-admin-chunk branch from 8c40b2b to d262d19 Compare November 10, 2026 02:11
@silo-triage silo-triage Bot added size/L 200–499 added + deleted lines (all files); change volume, not priority. and removed size/XXXL 3000+ added + deleted lines (all files); change volume, not priority. labels Nov 10, 2026
@Quick104
Quick104 merged commit c1d7636 into main Nov 10, 2026
3 checks passed
@Quick104
Quick104 deleted the i18n/web-admin-chunk branch November 10, 2026 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request javascript Pull requests that update javascript code priority: P2 Limited scope, workaround exists, or polish size/L 200–499 added + deleted lines (all files); change volume, not priority. stacked Base is another open PR; merge in stack order named in the body

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant