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:
+9
-6
@@ -100,12 +100,15 @@ Branches inside backend:
|
||||
new one. The client gets the same response shape and is unaware of
|
||||
the reuse.
|
||||
- **Otherwise.** Backend creates a new challenge with the resolved
|
||||
preferred language (derived from the optional `Accept-Language`
|
||||
header forwarded by gateway, falling back to a default), and
|
||||
enqueues the auth-mail row directly into the outbox in the same
|
||||
transaction. SMTP delivery is asynchronous; the auth response
|
||||
returns as soon as the challenge and outbox rows are durably
|
||||
committed.
|
||||
preferred language (derived from the optional `locale` body field
|
||||
the caller sends — which takes priority — or, if absent or blank,
|
||||
from the `Accept-Language` header forwarded by gateway, falling
|
||||
back to a default), and enqueues the auth-mail row directly into
|
||||
the outbox in the same transaction. SMTP delivery is asynchronous;
|
||||
the auth response returns as soon as the challenge and outbox rows
|
||||
are durably committed. The body field is the canonical channel
|
||||
because Safari silently drops JS-set `Accept-Language` headers;
|
||||
non-Safari clients can still rely on the header alone.
|
||||
|
||||
### 1.3 Confirming the challenge
|
||||
|
||||
|
||||
@@ -99,11 +99,15 @@ Backend выпускает непрозрачный идентификатор
|
||||
backend переиспользует последний имеющийся вызов вместо создания
|
||||
нового. Клиент получает ту же форму ответа и не знает о повторе.
|
||||
- **Иначе.** Backend создаёт новый вызов с разрешённым preferred_language
|
||||
(выводится из опционального заголовка `Accept-Language`,
|
||||
форварднутого gateway, с откатом на дефолт) и в той же транзакции
|
||||
ставит auth-mail-строку прямо в outbox. SMTP-доставка асинхронна;
|
||||
auth-ответ возвращается, как только строки challenge и outbox
|
||||
durably закоммитены.
|
||||
(выводится из опционального поля `locale` в JSON-теле — оно имеет
|
||||
приоритет — либо, если оно отсутствует или пустое, из заголовка
|
||||
`Accept-Language`, форварднутого gateway, с откатом на дефолт) и
|
||||
в той же транзакции ставит auth-mail-строку прямо в outbox.
|
||||
SMTP-доставка асинхронна; auth-ответ возвращается, как только
|
||||
строки challenge и outbox durably закоммитены. Поле в теле — это
|
||||
канонический канал, потому что Safari молча сбрасывает выставляемые
|
||||
из JS заголовки `Accept-Language`; клиентам не на Safari достаточно
|
||||
одного заголовка.
|
||||
|
||||
### 1.3 Подтверждение вызова
|
||||
|
||||
|
||||
Reference in New Issue
Block a user