~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0

The console says every word from a message, ready for other languages

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/group-host:web/locales

The console now takes every word it shows from Paraglide messages (web/messages/en.json), so adding a language means adding a file. Dates, lists and place names follow the reader's language, the host's refusals are shown in the console's own words by error name, and a label keeps a name in each language it's given. English is still the only language, and the English is unchanged except where listed under "What reads differently".

Claude Opus 5.5 · high effort

What changes

Messages. Paraglide JS 3 (@inlang/paraglide-js), set up in web/project.inlang with only en. Its message-format plugin is loaded from node_modules, so compiling needs no network. The compiled output (web/src/lib/paraglide) isn't kept in git: the Vite plugin makes it for dev and build, and npm run i18n makes it for check. There are 698 messages, keyed by component (invites_empty_title). A sentence with a component inside it (a Person, a link, code) is one message with markup, rendered by @inlang/paraglide-js-svelte's ParaglideMessage. Counts are plural messages. Built-up text such as "Meets in {place}, and online." is now a whole sentence with parameters.

The reader's language. hooks.server.ts runs each page request through paraglideMiddleware, which picks the language from the PARAGLIDE_LOCALE cookie, then Accept-Language, then English, and fills in <html lang="%lang%" dir="%dir%">. Requests the console passes on to the host skip this. #lib/locale.ts maps each console locale to the one Intl uses (en → en-GB, to keep today's "5 Nov 2026"). Dates (#lib/dates.ts), role and language lists, and country and language names (#lib/places.ts, sorted by the reader's collation) now use it. Formatters are created once per locale, not at import, and times stay in UTC.

Refusals by name. #lib/errors.ts maps each error name the host can return (the errors in our lexicons plus the general ones) to a console message. data.ts, asGroup.ts, settings.ts, site.ts, and the new and move actions use it in place of the host's English message. Where a page had better wording for an error (a site domain that doesn't reach the host), it passes that as an override. Five names cover several reasons the reader has to tell apart, and only the host's message says which one. For those (REASONED), the console still shows the host's message, and uses its own words only when there's no message:

  • InvalidRequest: the lexicon check, and some 117 invalid(…) calls such as "label is lowercase letters and hyphens"
  • InvalidHandle: three reasons
  • InvalidSite: many file rules
  • InvalidArchive: five reasons
  • UpstreamFailure: what the other server said

Every other name with this kind of message has a single reason, and the console's words say the same thing. Before a second language can be added, the host needs to give each of those reasons its own name.

Label names in each language. putLabelDefinition replaces only the locale entry whose lang matches and keeps the others; before, it overwrote the whole list. The console sends the reader's language with a label's name, and shows each label in the reader's language, then English, then the first one given (#lib/labels.ts). The lexicon descriptions, docs/reference/api.md and docs/design/moderation.md say this.

Checks.

  • harness/strings.mjs (in just lint and the web workflow) parses every component and fails on words written directly into markup, or into an attribute people read (title, label, placeholder, …). Names, domains and NSIDs are allowed.
  • harness/dialogs.mjs now also fails on a dialog title that passes its message any parameters.

Docs. docs/development.md has a new section on the console's languages (how the language is chosen, and the three changes that add one). AGENTS.md and the ui skill gain the rule that every word is a message.

What reads differently

  • A refused recovery key (InvalidKey) used to show "not a did:key the directory takes (secp256k1 or P-256)" and now shows "That isn't a key this host takes. Use a did:key for secp256k1 or P-256." This is intended: the console's words replace the host's. Other refusals with a single reason change the same way.
  • Country names are now British English, to match the dates. "St." becomes "St" (St Barthélemy, St Helena, St Kitts & Nevis, St Lucia, St Martin, St Pierre & Miquelon), "St. Vincent & Grenadines" becomes "St Vincent & the Grenadines", and "U.S. Outlying Islands" and "U.S. Virgin Islands" become "US …". The sort order moves to match. docs/guides/shots/starting-words.txt and the recovery guide's pictures are redrawn.
  • putLabelDefinition matches lang exactly, so a stored en-GB and a sent en become two entries. The console always sends its own locale (en), and the display fallback copes either way.

Why

This prepares the console to be translated without translating anything yet. Fixing the host's English error messages, the module-level English formatters, and the joined-together sentences now means a translation later is just a new file. The label locale fix is a data-loss bug either way: renaming a label in a second language deleted its first.

How it was checked

  • npm run check (svelte-check, no warnings, and tsc -p shell), harness/strings.mjs, dialogs.mjs, layers.mjs, and oxfmt --check pass.
  • cargo test -p group-host --test moderation (the new locale merge steps) and clippy pass.
  • The e2e flows and just shots --check find elements by their English text and compare screenshots, so they confirm the English is unchanged. They run on the runner; just e2e passed locally (37 flows), and just shots --check showed only the differences listed above, drawn again.

Shortcomings

  • There's no language picker. With only English there's nothing to pick, and the cookie strategy is ready for one.
  • app.css lays pages out with left and right, so a right-to-left language needs it changed to logical properties first.
  • Times stay in UTC, since the server doesn't know the reader's time zone.
  • In the browser, the language is the cookie's, then navigator.languages. Without a cookie, a browser whose Accept-Language and navigator.languages disagree could hydrate in a different language from the server's. That can't happen with English alone.
  • The page around a group's site (shell.ts) still sends sites the host's own message in Refused, since that's the kit's API to site developers. Its sign-in failures are messages.
  • A record's kind in a report ("post") is still the last part of its NSID, lowercased in code.

Review

Start at web/src/lib/errors.ts, locale.ts and hooks.server.ts, then a component with markup messages (MemberList.svelte, Permissions.svelte). web/messages/en.json is long but flat.

Asked for changes

This pull moves the console's words into Paraglide messages. It adds locale-aware Intl formatters, maps host errors to console messages by error name, keeps other languages when a label is renamed (putLabelDefinition), and adds a strings.mjs check.

Looks right

  • The Rust locale merge replaces only the matching lang entry and appends a new one. Its test covers replace, append, and order.
  • The hook, perLocale, the label fallback order, and the module-level message maps (activity.ts, reasons.ts, GroupSite) are sound. The maps hold message functions and call them later, so they don't freeze a locale at import.

Needs a change: the English is not unchanged for InvalidRequest.

  • errors.ts maps InvalidRequest to one generic message ("That didn't work. Check what you entered and try again."). The host uses that name for most validation failures, and its message says what was wrong. For example, put_label_definition refuses a bad label value with invalid("label is lowercase letters and hyphens").
  • Before this pull, data.ts, asGroup.ts, settings.ts, new and move showed that message. Now every such refusal reads the same, so the reader can't tell what to fix.
  • The InvalidName, InvalidSite and InvalidKey messages are specific, but they probably carry detail the host puts in message as well.
  • Please list which names the host sends with a variable reason. For those, either give the host a distinct error name per reason, or keep showing the host's message as a fallback. The generic text would then be used only when there is no message.
  • Pages already pass overrides for the domain and handle cases, so this is the same pattern applied to the rest.

Smaller points

  • putLabelDefinition matches lang exactly. A stored en-GB and a submitted en become two entries. The display fallback copes with that, so I'm only noting it.
  • I did not read every changed file. The 698-message en.json and most component diffs are unread. just e2e and shots --check, which the body relies on to show the English is unchanged, had not run on the runner when I reviewed (run_list for this pull was empty). The InvalidRequest change above is the kind of difference those checks might catch.
web/src/lib/errors.tsline 45Outdated
InvalidName: m.error_invalid_name,
InvalidOperation: m.error_invalid_operation,
InvalidRepo: m.error_invalid_repo,
InvalidRequest: m.error_invalid_request,
review.knotless.dev

InvalidRequest is the host's catch-all for validation failures, and its message says which one (for example, the label-value rule in put_label_definition). Mapping it to one generic message drops that detail from every form, which changes the English the pull says it keeps. Keep the host's message as a fallback for names whose reason varies, or give each reason its own error name.

chadtmiller.com

Done in 36d…: the five names the host gives several reasons for (InvalidRequest, InvalidHandle, InvalidSite, InvalidArchive, UpstreamFailure) show the host's message again, the console's words only when there is none. Every other name's message has one reason, which its console words say. The body now lists them, and every visible English difference (the InvalidKey wording, the British country names).

Asked for changes

Since my last review, the only changes are the recovery-key docs and screenshots. web/src/lib/errors.ts is unchanged: InvalidRequest still maps to the one generic message, and refusal never uses the host's message. My earlier request is not done.

Still needed: the host uses InvalidRequest for many different validation failures, and its message says which one (for example "label is lowercase letters and hyphens"). The reader now sees the same text for all of them and can't tell what to fix. Please do one of these:

  • keep the host's message as the fallback for names that carry a variable reason (InvalidRequest, and probably InvalidName, InvalidSite and InvalidKey), and use the generic text only when there is no message; or
  • give the host a distinct error name per reason.

Please also say which names carry a variable reason.

New: the English is not unchanged. The updated shots show visible English changes:

  • The recovery-key refusal was "not a did:key the directory takes (secp256k1 or P-256)". It is now "That isn't a key this host takes. Use a did:key for secp256k1 or P-256." If the new wording is intended, say so in the body, since it contradicts "the English text is meant to be unchanged".
  • Country names changed: "St. Lucia" is now "St Lucia", "U.S. Virgin Islands" is now "US Virgin Islands", and "St. Vincent & Grenadines" is now "St Vincent & the Grenadines". The sort order moved too. This comes from using Intl.DisplayNames with en-GB. It is an acceptable result, but the body should list it as a known difference.
Approved

Both things I asked for last round are done.

  • Host reasons: errors.ts now has REASONED (InvalidRequest, InvalidHandle, InvalidSite, InvalidArchive, UpstreamFailure). For those names refusal shows the host's message, and falls back to the console's words only when there is no message. Page overrides still win. The body lists these names and the reasons behind each, and docs/development.md and AGENTS.md say the same.
  • English changes: the body now lists the recovery-key wording and the country-name differences.

I only read the diff since my last review. I am relying on your statement that InvalidName and InvalidKey each have a single reason. If the host ever adds a second reason to either, move it into REASONED.

Approved

Since my approval, the only change is a merge of the base. It brought in the host's rate limits (limits.rs, RATE_LIMITS, the X-Forwarded-For forwarding in hooks.server.ts, and the docs and harness changes for them). The pull's own diff doesn't include those. What this pull changes in hooks.server.ts is only the Paraglide middleware, and it sits next to the merged forwarding code without conflict. Nothing from the merge breaks the localisation work I approved, so my approval stands.

Merged as 18c6d47