T432938: Add interface language switcher with i18n loading mechanism
Summary
Adds the missing infrastructure piece for T432938 (Wikinewsie i18n): the app can now load and switch between interface languages at runtime, not just English.
Previously, i18n.ts only ever imported i18n/en.json directly, so even though T434617 already extracted all UI text into i18n message keys, there was no way for the app to actually load a different language file.
What this adds
src/i18n.tsnow auto-discovers every.jsonfile ini18n/at build time (viaimport.meta.glob), instead of hardcoding a single import. Dropping in a new file likei18n/fr.jsonis enough for the app to pick it up, no code changes needed.- A reactive
currentLocale(Vueref) drives which language's messages are active, so switching languages updates all UI text instantly, no reload. - The user's language choice is remembered in
localStorage, following the same approach Wikimedia's own Universal Language Selector uses for anonymous/logged-out users. - Falls back to English automatically for any missing file or missing key, so a partial translation never breaks the UI.
- New
i18n/languages.jsonlists which languages are actually offered in the switcher (currently just English), separate from which files merely exist — same pattern MediaWiki/translatewiki.net use (only show languages that are genuinely ready). - A small
CdxSelectdropdown in the header lets users pick their interface language, independent of which Wikipedia edition's articles are shown.
What this does NOT do
- No actual translations are added (that's tracked separately in T435739, connecting the project to translatewiki.net).
- Doesn't touch the
langURL param / wiki-content selector — interface language and content language remain intentionally independent.
Testing
- Verified reactivity by temporarily editing a value in
en.jsonand confirming it updates live in the UI. - Confirmed selected language persists across page reloads via localStorage.
npm run typecheckpasses with no errors.
Bug: T432938
Closes T432938