|
i18n: en/uk/ru, and the interface language of the account
The client hard-coded English in every template. It now goes through t() from
src/i18n/ — a locale ref, {param} interpolation, plural dictionaries driven by
n, and flat per-area dictionaries in src/i18n/messages/ carrying the same slugs
in all three languages. vue-i18n is deliberately not pulled in: the platform
handbook rules it out, and what it would buy — plural forms, a reactive locale,
an English fallback — is about eighty lines here. A slug nobody carries falls
back to English, so a screen already translated and one still speaking
hard-coded English can coexist while the work goes area by area.
The language comes from locale_effective in GET /auth/me: the choice made in
Settings (navi_users.locale_override, a new column) over the gnexus-auth
account locale (navi_users.locale, a straight mirror the user.profile_updated
webhook keeps writing — the override sits in its own column precisely so that
mirror cannot wipe it), over en. PATCH /auth/me writes the override, and null
means "follow the account" again. With NAVI_AUTH_ENABLED=false there is no
account to follow, so the choice is kept in localStorage under navi.locale.
The picker is the first block of Settings → Account. Each language is named in
its own language, which is why those three strings are identical in all three
dictionaries. Lists of labels are computed rather than module-level constants:
one built at import would keep the language that was active then and ignore a
switch.
Checked in Chromium against the built bundle: choosing Русский rewrites
<html lang> and the document title, survives a reload, and Auto brings the
account's own language back.
|
|---|
|
|
| docs/api.md |
|---|
| docs/i18n.md 0 → 100644 |
|---|
| docs/index.md |
|---|
| navi/api/routes/auth.py |
|---|
| navi/api/routes/webhooks.py |
|---|
| navi/auth/_ddl.py |
|---|
| navi/auth/deps.py |
|---|
| navi/locales.py 0 → 100644 |
|---|
| tests/unit/api/test_auth_locale.py 0 → 100644 |
|---|
| tests/unit/auth/test_ddl.py 0 → 100644 |
|---|
| tests/unit/auth/test_deps.py |
|---|
| tests/unit/test_locales.py 0 → 100644 |
|---|
| webclient/CLAUDE.md |
|---|
| webclient/src/App.vue |
|---|
| webclient/src/api/index.js |
|---|
| webclient/src/components/settings/AccountPanel.vue 0 → 100644 |
|---|
| webclient/src/components/ui/LoginScreen.vue |
|---|
| webclient/src/i18n/index.js 0 → 100644 |
|---|
| webclient/src/i18n/messages/en.js 0 → 100644 |
|---|
| webclient/src/i18n/messages/ru.js 0 → 100644 |
|---|
| webclient/src/i18n/messages/uk.js 0 → 100644 |
|---|
| webclient/src/stores/auth.js |
|---|
| webclient/tests/unit/components/settings/accountPanel.test.js 0 → 100644 |
|---|
| webclient/tests/unit/i18n/index.test.js 0 → 100644 |
|---|