Hub internationalization
The hub PWA uses keyed strings in src/i18n/hubAppLocales/*.json and setup copy in src/i18n/hubSetupLocales/*.json, merged at runtime in src/i18n/hubI18n.js. Marketing site strings live under website/locales/ with a separate pipeline.
One language per download (#1390)
Only English is in the main script; it is the fallback for every missing key. Each other language (setup + app strings, and its website/helpLocales map for the owner/sitter help panels) is its own chunk that loadHubLocale(code) fetches once and keeps in memory. rt() / hubT() stay synchronous, so:
- Start-up (
src/js/app.js): the device's remembered language starts loading alongside the start-up requests, and the profile's language is awaited after the profile arrives, beforecreateAppShell. Nothing draws in English first. - Language change (
applyHubLanguageChange): the new language is awaited before the device override flips. - Backstop: if a string is asked for in a language not yet loaded (a profile that changed language on another device),
hubTanswers in English and starts the fetch;subscribeToHubLocaleLoadedthen redraws the shell (AppShell) and chrome (subscribeToHubLanguageChange).
The service worker caches scripts network-first as they are fetched, so a language a device has used stays available offline. Tests preload every language (tests/setup/hubLocalesLoaded.js) so they translate synchronously; tests/hubLocaleLoading.test.js covers the on-demand path and fails if a hub source file imports a non-English locale statically.
Choosing a language
Everyone changes the hub language from the dropdown at the top of their home screen (src/components/HubLanguageSwitcher/createHubLanguageSwitcher.js): owners on the owner home, guests and sitters on theirs. Owners also have Settings → Language. An owner's choice is saved to the hub profile; a guest's stays on their device. (The owner home dropped it in #827 and got it back in #1369.)
Locale QA
npm run verify:hub-localesThis runs scripts/verify-hub-app-locales.mjs and scripts/verify-hub-setup-locales.mjs with allowlists in scripts/hub-locale-verify-allowlist.js for intentional English loanwords, guide i18n meta-keys (*.En), and tracked gaps (for example setup listing import on it/nl/pt until funded).
Hub words belong in the catalogs, never in code. Do not keep on-screen English in data modules (for example a guestHereTitle: 'Guest is here' field) and put it on screen directly: the catalog checks cannot see it, so it stays English in every language (#1374). Keep a key or an id in code and look the words up with rt(). tests/hubCopyInCode.test.js fails when a hub source file holds an English phrase in a named copy field (…Title, …Toggle, …Heading, …Hint, …Text, …Label, …Description, …Message); its allowlist is for product names only.
The Settings "… is here" switch reads hub.settings.guestHere.<title|toggle|shared|hidden>.{audience}, where the audience (guest, sitter, tenant, family, resident, carer) comes from the hub use case in src/lib/hubUseCase.js.
Setup wizard JSON exists for all thirteen hub languages under src/i18n/hubSetupLocales/ (including sv, ja, zh, af — audit L7).
Regenerate setup locales with python3 scripts/generate-hub-setup-l7-locales.py (MyMemory, rate-limited) and python3 scripts/apply-argos-setup-zh.py for offline Chinese refresh.
Worker API errors
High-traffic Worker routes return stable error codes plus English message fallbacks. The hub maps codes to rt() keys in client helpers (for example src/lib/hubWorkerApiErrorMessage.js, src/lib/sitterStayApiErrors.js, listing import in src/lib/listingImportErrorI18n.js).
Marketing billing strings
Bulk updates to account/billing copy on the marketing site can be applied with:
node scripts/billing-i18n/apply.mjsPatch files live in scripts/billing-i18n/*.locale.json.
Customer lifecycle email
Platform lifecycle email (trial welcome, payment failed, cancellation, referral rewards) is English-only by policy. Templates and subjects are authored in functions/api/platform/platformCustomerEmail.js; localized email would need product, legal, and deliverability review before implementation (audit L5).