Repository navigation
Add German admin UI and localise operator-facing emails - #276
Mehr-Vertrieb wants to merge 5 commits into
Conversation
- Ship a German admin catalogue (frontend/src/lib/i18n/de.json) and register it in ADMIN_LOCALES; catalogue tests now cover every translation, not only French. - Host notifications, login link, password reset, team invitation and the email test message read their text from the booker catalogue in the operator's fallback language. English output is unchanged. - Polish German booker wording (verschieben instead of umbuchen, a few idiomatic fixes), mirrored in de-x-neutral; glossary updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015iakVADVRvb5zkK5sEwxtg
|
All contributors have signed the CLA. ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
There was a problem hiding this comment.
Important
The host-email wiring misses two send paths: reschedule (manage page / MCP) and reassignment never populate HostLocale, so those host emails still go out in English even when a German fallback locale is configured.
Approach: sound in shape — a dedicated HostLocale keeps the attendee's language and the operator's language from bleeding into each other, and the German admin catalogue slots into the existing ADMIN_LOCALES/catalogs architecture — but the host-locale plumbing stops short of every send site it promises.
Reviewed changes — read the full 19-file diff and ran the relevant suites (go test ./internal/i18n/ ./internal/mailer/, node --test src/lib/i18n/catalog.test.ts, check-i18n.mjs, gofmt -l).
- German admin catalogue. New
frontend/src/lib/i18n/de.json(1,325 keys, formal Sie) registered incatalog.ts; key parity, placeholders, plurals and anchor guards incatalog.test.tsnow iterate every translation. Verified againsten.jsonstructure and read the whole catalogue for obvious mistranslations. - Host/operator email localisation. New
BookingData.HostLocale,operatorLocale(ctx)helper, andT/Tf-driven host confirmation/cancellation/reschedule templates plus login-link, reset, invite and settings-test emails. English output is byte-identical to the previous hardcoded copy. - German booker wording. verschieben replaces umbuchen, mirrored in
de-x-neutral.json, with the glossary extended. hostBookingDatastampsHostLocalefrombranding.FallbackLocale; the admin event-type preview now uses a 24-hour clock for every non-English admin locale.
⚠️ Reschedule and reassignment host emails still go out in English
SendRescheduleToHost and the reassignment confirmation only localise when BookingData.HostLocale is set, but hostBookingData is the only site that sets it. rescheduleSideEffects and reassign build their host copy inline, so a German instance still sends those two host notifications in English — and reschedule is explicitly listed in the changelog.
Technical details
# HostLocale not set on two host-send paths
## Affected sites
- `internal/handler/manage_handler.go:335-338` — `hd := d; h.applyHostInvite(...); mailer.SendRescheduleToHost(...)`; `d` comes from `loadCancellationData` + `applyBranding`, neither of which sets `HostLocale`.
- `internal/handler/reassign.go:221-226` — same pattern for the new host's confirmation email.
- `internal/handler/booking_handler.go:1101` — `hostBookingData` is currently the only assignment.
## Required outcome
Every `SendConfirmationToHost` / `SendCancellationToHost` / `SendRescheduleToHost` call carries the operator locale, so the reschedule notification the changelog promises is actually German on a German instance.
## Suggested approach (optional)
Set `hd.HostLocale = h.operatorLocale(ctx)` inside `applyHostInvite`, which all three paths already call; the assignment in `hostBookingData` then collapses into the same helper (and stops duplicating `i18n.Get(loadBranding(ctx).FallbackLocale)`).
## Open questions for the human (optional)
`TestHostEmails_followHostLocale` calls the mailer directly with `HostLocale` pre-set, so it cannot catch a handler that never populates the field. A handler-level assertion (or setting the field centrally) would close that hole.ℹ️ Nine shipped locales now get half-translated host emails
Only en, de and de-x-neutral received the 22 new keys. Locale.T falls back per key to English, but the host templates also reuse long-standing keys (email_greeting, email_label_*) that every locale already translates — so a French, Spanish, Italian, Dutch, Polish, Portuguese, Swedish, Greek or Canadian-French operator now gets a translated greeting and labels beside an English subject and lead. That is less coherent than the uniformly English mail shipped before.
Technical details
# Per-key fallback mixes languages in host emails
## Affected sites
- `internal/i18n/locales/{fr,fr-CA,es,it,nl,pl,pt,sv,el}.json` — 169/191 keys; all 22 new keys missing.
- `internal/i18n/locales/en.json:147-168` — the new `email_host_*`, `email_magic_*`, `email_reset_*`, `email_invite_*`, `email_test_*` block.
- `internal/mailer/booking.go:468-559` — host templates mix `email_greeting`/`email_label_*` (translated everywhere) with the new keys (English fallback).
## Required outcome
Host email language is either coherent for a locale or uniformly English.
## Suggested approach (optional)
Translate the 22 keys in the other shipped locale files (the structural guards stay green either way). If that is out of scope, say in the changelog that the new copy currently ships in German and English only, so French/Spanish hosts get a mixed email rather than the previous all-English one.ℹ️ docs/ARCHITECTURE.md §23 still says host emails stay English and that the admin ships only en + fr
Line 1306 states "Host-facing sends deliberately pass a nil locale and stay English" and line 1263 lists the admin SPA as en + fr. This PR invalidates both; §23 is also where the new rule (the fallback locale drives operator-facing email) belongs, and the repo convention is that behaviour changes update that section in the same PR.
Technical details
# ARCHITECTURE §23 not updated for this PR's behaviour change
## Affected sites
- `docs/ARCHITECTURE.md:1263` — admin SPA row: "`en` + `fr`".
- `docs/ARCHITECTURE.md:1268-1276` — prose that says `fr.json` is the only translation.
- `docs/ARCHITECTURE.md:1303-1306` — "Host-facing sends deliberately pass a nil locale and stay English."
## Required outcome
§23 describes the shipped admin locales (`en`, `fr`, `de`) and the operator-email language rule (`server_settings.fallback_locale` drives host/operator emails; attendee emails stay per-booking).deepseek-v4.1-flash | 𝕏
|
Reviewing properly now that the product questions are settled. Accepted as-is: the German admin catalogue as a third locale, the operator-email wording following the instance fallback language, and keeping the two catalogue systems separate with the glossary. The feature is good. One thing blocks it: adding a third catalogue currently makes every admin download all three.
Sizes: Please make the non-English catalogues lazy:
That leaves an English admin on ~76 KB instead of ~250 KB, and a German admin on en + de only. It is also the difference between "adding a locale is cheap" and "every locale taxes every operator". On the German wording changes: accepted, with one request. Neither maintainer reads German, so please list the exact before/after strings in the description. We will record the same provenance caveat as every other locale here: contributed, not independently reviewed. Splitting it into its own PR would not help, because the risk is copy quality rather than code. |
…ersetzung # Conflicts: # CHANGELOG.md
Only en.json stays in the bundle (source of truth and per-key fallback). fr and de are dynamic imports behind loadCatalog(), fetched when the locale is the starting one or is selected, so an English admin no longer downloads them. Initial JS drops from 497 kB to 345 kB raw (165 kB to 118 kB gzip). The locale store switches only once the catalogue is in, and the root +layout.ts load holds the first render until the starting locale is ready, so nothing flashes in the wrong language and a switch stays one reactive update. A failed import leaves the locale applied with English strings (html lang reports English) and keeps the stored preference. Tests: i18n.test.ts, the suite CI runs, now iterates every translation (en/fr/de parity, placeholders, plurals, anchors) like catalog.test.ts; store tests cover pending switches, overlapping switches and load failure. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The upstream merge added 14 keys to en.json (booking deletion, next available time, outbound phone location) that de.json lacked; the key parity test caught it. Also capitalise "wir" after the blank line in the reminder preview, as en/fr and the real email_reminder_lead do. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
applyHostInvite now sets HostLocale, which reschedule and reassignment call but never got from hostBookingData, so those host emails stayed English on a German instance. hostBookingData drops its own assignment. Handler tests cover the reschedule and reassign paths. Update the BookingData.Locale doc block and rename the mailer test that still said hosts always stay English. Bring ARCHITECTURE section 23 up to date (admin locales, lazy catalogues, operator-language emails) and note in the CHANGELOG that the nine locales without the new keys send mixed-language host emails. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
ℹ️ No blocking issues — the prior review's host-locale gap is fixed, and the new lazy-loading path is covered by the suites CI actually runs; two non-blocking gaps remain.
Approach: sound — applyHostInvite now stamps the operator locale once for every host send, and the admin catalogue lazy load is gated by a store that only switches once the catalogue is in, so no page renders half-translated.
Reviewed changes — reviewed the delta since the prior pullfrog review at d02a175 (upstream merge, lazy admin catalogues, host-locale tests, doc updates) and ran go test ./internal/i18n ./internal/mailer ./internal/handler, node --test frontend/src/lib/i18n/catalog.test.ts, pnpm test:visual (35 tests), pnpm check, check-i18n.mjs and pnpm build at c342738.
- One locale source for host emails.
applyHostInvitesetsBookingData.HostLocalefromoperatorLocale(ctx), so reschedule and reassignment — which build their host copy outsidehostBookingData— now follow the operator's fallback language;host_locale_internal_test.goasserts both at the handler level. - Admin catalogues load on demand. Only
enis bundled;franddeare dynamic imports behindloadCatalog, the root+layout.tswaits onlocaleReadybefore the first render, and aswitchSeqguard drops a superseded switch. A failed chunk resolves to English per key instead of throwing. - Catalogue tests moved into the CI suite.
i18n.test.tsnow iterates{fr, de}for key, placeholder, plural and anchor parity, sopnpm test:visualguardsde.json(thenode:testcopy still runs standalone). - Docs and changelog cover the operator-language rule, the three admin locales, lazy loading and the mixed-language caveat for the nine locales that still lack the 22 email keys;
BookingData.Locale's comment and the mailer test name were corrected.
Non-blocking
- German booker catalogues are missing the three phone-outbound keys. The merge of upstream #273 brought
location_phone_outbound,phone_outbound_numberanderr_phone_requiredintoen.json(andpl.json), butde.jsonandde-x-neutral.jsonstill lack them, so a German visitor booking a phone-outbound event type sees the English field label, location label and validation error. de.json, en.json:65. - The first admin page load persists the browser-detected locale.
localeReadycallsapply(), which writescalnode-admin-locale, sonavigator.languagesis only ever a first-visit fallback, and a tab that loaded earlier can overwrite a locale chosen in another tab at startup. Persisting only on an explicitsetLocalekeeps the documented resolution order. index.ts:75.
deepseek-v4.1-flash | 𝕏
|
Thanks for the careful review. Pushed to the branch: Lazy catalogues. Only Before/after strings. The description now lists every changed German value for Also in this push: merged |

Summary
frontend/src/lib/i18n/de.json, formal Sie, terse) as a third admin locale.enstays the only bundled catalogue;franddeload on demand (below).server_settings.fallback_locale). With no fallback set, or English, the output is byte-identical to before. Attendee emails still follow the attendee's own locale.de-x-neutral; glossary updated. The exact before/after strings are listed below.Admin catalogues are lazy
Only
enis statically imported (source of truth and per-key fallback).fr/deare dynamic imports behindloadCatalog(), fetched when the locale is the starting one or is selected.+layout.tsload awaits the starting locale, so the first render waits for its catalogue (no flash of English for a German operator).<html lang>saysen, the stored preference is kept so the next load retries.loadersplus the name inADMIN_LOCALES(CONTRIBUTING.md updated).Measured with
pnpm build, JS only, gzip at level 6. "Initial" is the entry chunks plus the root layout node and everything it imports statically, i.e. what every admin page load pays; page-specific chunks are excluded.en67,299 B / 22,876 B (in the initial set)frchunk, raw / gzipdechunk, raw / gzipAn English admin now downloads
enonly; a German admin downloadsen+de. Checked in a real browser againstvite preview: English default requests nofr/dechunk; a storeddeshows German from the first paint (a mutation observer saw no English headline) and fetches only thedechunk; with thedechunk blocked the page renders English without errors.German wording changes: exact before / after
Neither maintainer reads German, so these are generated from the diff of
internal/i18n/locales/de.jsonandde-x-neutral.jsonagainstmain, nothing summarised. Keys are unchanged; only the German value differs. As with the other locales, this is contributed copy, not independently reviewed.de(formal): 22 changed valuescould_not_load_timestimes_shown_inlocation_in_personbooking_already_cancelled_textscheduled_forrescheduleconfirm_reschedule_questionwas_labelnow_labelconfirm_reschedulereschedulingbooking_rescheduled_titlebooking_rescheduled_prefixreschedule_failed_erroremail_rescheduled_leademail_reminder_leademail_label_wasemail_label_nowemail_calendar_googleemail_manage_link_introemail_manage_link_intro_rescheduleemail_subject_rescheduledde-x-neutral: 22 changed valuescould_not_load_timestimes_shown_inlocation_in_personbooking_already_cancelled_textscheduled_forrescheduleconfirm_reschedule_questionwas_labelnow_labelconfirm_reschedulereschedulingbooking_rescheduled_titlebooking_rescheduled_prefixreschedule_failed_erroremail_rescheduled_leademail_reminder_leademail_label_wasemail_label_nowemail_calendar_googleemail_manage_link_introemail_manage_link_intro_rescheduleemail_subject_rescheduledNew host/operator email strings (22 keys, in
deandde-x-neutral, plusen)These are added, not changed, so there is no "before".
de:email_host_subject_newemail_host_subject_cancelledemail_host_subject_rescheduledemail_host_new_leademail_host_cancelled_leademail_host_rescheduled_leademail_magic_subjectemail_magic_textemail_magic_html_introemail_magic_buttonemail_link_pasteemail_ignore_unrequestedemail_reset_subjectemail_reset_textemail_reset_html_introemail_reset_buttonemail_reset_ignoreemail_invite_subjectemail_invite_textÜber den folgenden Link richten Sie Ihr Konto ein. Der Link ist 7 Tage gültig und an diese E-Mail-Adresse gebunden.
email_invite_ignoreemail_test_subjectemail_test_textde-x-neutral:email_host_subject_newemail_host_subject_cancelledemail_host_subject_rescheduledemail_host_new_leademail_host_cancelled_leademail_host_rescheduled_leademail_magic_subjectemail_magic_textemail_magic_html_introemail_magic_buttonemail_link_pasteemail_ignore_unrequestedemail_reset_subjectemail_reset_textemail_reset_html_introemail_reset_buttonemail_reset_ignoreemail_invite_subjectemail_invite_textÜber den folgenden Link lässt sich das Konto einrichten. Der Link ist 7 Tage gültig und an diese E-Mail-Adresse gebunden.
email_invite_ignoreemail_test_subjectemail_test_textAdmin catalogue (
frontend/src/lib/i18n/de.json)New file, 1,339 keys at full parity with
en.json(checked by the catalogue tests), so there is no before/after. Placeholders and plural forms are checked mechanically; the wording is the same kind of contributed, unreviewed copy.Other changes in this update
main(conflicts were inCHANGELOG.mdonly). The merge brought 14 newen.jsonkeys (booking deletion, next available time, outbound phone location) thatde.jsonlacked; they are translated here.applyHostInvitenow setsHostLocale, so reschedule and reassignment host emails follow the operator's language too (they previously went out in English because onlyhostBookingDataset it). Handler tests cover both paths.i18n.test.ts, the suite CI runs, now iterates every translation likecatalog.test.ts.BookingData.Localedoc block and the mailer test name no longer say hosts always stay English.docs/ARCHITECTURE.mdsection 23 updated (admin locales, lazy catalogues, operator-language emails).fr,fr-CA,es,it,nl,pl,pt,sv,el) do not have the 22 new email keys yet, so a host on one of those fallback languages gets a mixed-language email (translated greeting and labels, English subject and lead) instead of the previous all-English one.Verification
go vet,gofmt,go build,go test ./...,svelte-check,check:i18n,pnpm build,pnpm test:visualand thenode --testcopy of the catalogue tests all pass locally.🤖 Generated with Claude Code