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.ts now auto-discovers every .json file in i18n/ at build time (via import.meta.glob), instead of hardcoding a single import. Dropping in a new file like i18n/fr.json is enough for the app to pick it up, no code changes needed.
  • A reactive currentLocale (Vue ref) 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.json lists 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 CdxSelect dropdown 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 lang URL param / wiki-content selector — interface language and content language remain intentionally independent.

Testing

  • Verified reactivity by temporarily editing a value in en.json and confirming it updates live in the UI.
  • Confirmed selected language persists across page reloads via localStorage.
  • npm run typecheck passes with no errors.

Bug: T432938

Closes T432938

Edited by Chimaifeanyi29

Merge request reports

Loading