diff options
| author | Leitwolf11 | 2026-10-03 01:43:43 +0300 |
|---|---|---|
| committer | Leitwolf11 | 2026-10-03 01:43:43 +0300 |
| commit | f25c01f1d173b9e206565207472b58ca51f90803 (patch) | |
| tree | c4244396690eb895815b89802a8c5cb7261f47a9 /frontend/src/preferences.ts | |
| parent | 1045265e9ae018cb3d2d94a47d780888c26d04a2 (diff) | |
| download | website-feature/russian-locale.tar.gz | |
Add Russian to the language site and the forum placeholderfeature/russian-locale
Russian (ru-RU) is the third locale of the language site: the shell, the
home, overview and getting-started pages, and the page metadata are fully
translated, and the language menu offers it. The documentation sidebar reads
its labels from the page messages instead of a two-way locale test, and the
stored preference is accepted only when it names a supported locale.
The forum placeholder gets the same three languages. Its language control
is now a menu instead of a two-state button, and an unknown stored or
selected value keeps the current language.
The site API lists the new locale. Verified locally: prettier, the frontend
tests, vue-tsc and the Vite build, the backend tests, and a browser run of
the home and overview pages in Russian.
Diffstat (limited to 'frontend/src/preferences.ts')
| -rw-r--r-- | frontend/src/preferences.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/frontend/src/preferences.ts b/frontend/src/preferences.ts index 878bdce..e5078bc 100644 --- a/frontend/src/preferences.ts +++ b/frontend/src/preferences.ts @@ -3,11 +3,13 @@ import { ref, watch } from "vue"; -export type Locale = "en-US" | "de-DE"; +export const supportedLocales = ["en-US", "de-DE", "ru-RU"] as const; +export type Locale = (typeof supportedLocales)[number]; export type Theme = "dark" | "light"; function storedLocale(): Locale { - return localStorage.getItem("vxs-locale") === "de-DE" ? "de-DE" : "en-US"; + const stored = localStorage.getItem("vxs-locale"); + return supportedLocales.find((supported) => supported === stored) ?? "en-US"; } function storedTheme(): Theme { |