phase 7+: i18n primitive + login language picker + autocomplete-off
Adds a minimal Svelte 5 i18n primitive (`src/lib/i18n/`) backing the
login form, the layout blocker page, and the lobby placeholder.
SUPPORTED_LOCALES drives both the picker and the runtime lookup;
adding a language is a two-step change inside `src/lib/i18n/`.
Login form gains a globe-icon language dropdown (English / Русский
in their native names), defaulting to navigator.languages with `en`
as the fallback. Switching the locale re-renders the form in place;
on submit, the locale rides in the JSON body of `send-email-code`
because Safari/WebKit silently drops JS-set Accept-Language. Gateway
gains a body `locale` field that takes priority over the request
header for preferred-language resolution.
Email and code inputs disable browser autofill / suggestions
(`autocomplete=off` + `autocorrect=off` + `autocapitalize=off` +
`spellcheck=false`) so Keychain / address-book pickers and
remembered-value dropdowns no longer fire on focus.
Cross-cuts:
- backend & gateway openapi: clarify that body `locale` is honored.
- docs/FUNCTIONAL{,_ru}.md §1.2: document body-vs-header priority.
- gateway tests: body `locale` overrides Accept-Language; blank
body `locale` falls back to header.
- new ui/docs/i18n.md; cross-links from auth-flow.md and ui/README.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
// English translation dictionary. Keys are dotted strings grouped
|
||||
// by feature area (`login.*`, `lobby.*`, `common.*`); values are
|
||||
// the user-visible text. Adding a new key here also requires adding
|
||||
// it to every other locale dictionary in this folder, otherwise the
|
||||
// `t()` helper falls back to English at runtime.
|
||||
|
||||
const en = {
|
||||
"common.language": "language",
|
||||
"common.loading": "loading…",
|
||||
"common.browser_not_supported_title": "browser not supported",
|
||||
"common.browser_not_supported_body":
|
||||
"Galaxy requires Ed25519 in WebCrypto. See supported browsers.",
|
||||
|
||||
"login.title": "sign in to Galaxy",
|
||||
"login.email_label": "email",
|
||||
"login.email_required": "email must not be empty",
|
||||
"login.send_code": "send code",
|
||||
"login.sending": "sending…",
|
||||
"login.code_label": "code",
|
||||
"login.code_required": "code must not be empty",
|
||||
"login.code_sent_to": "code sent to {email}",
|
||||
"login.verify": "verify",
|
||||
"login.verifying": "verifying…",
|
||||
"login.send_new_code": "send a new code",
|
||||
"login.change_email": "change email",
|
||||
"login.challenge_expired":
|
||||
"challenge expired, please request a new code",
|
||||
"login.code_expired_or_used":
|
||||
"code expired or already used, please request a new one",
|
||||
"login.device_key_not_ready":
|
||||
"device key is not ready, please reload the page",
|
||||
|
||||
"lobby.title": "you are logged in",
|
||||
"lobby.device_session_id_label": "device session id",
|
||||
"lobby.greeting": "hello, {name}!",
|
||||
"lobby.account_loading": "loading account…",
|
||||
"lobby.logout": "logout",
|
||||
} as const;
|
||||
|
||||
export default en;
|
||||
Reference in New Issue
Block a user