Files
Lumotia/docs/architecture-map/01-frontend/i18n.md
Jake 26c7307607
Some checks failed
check / cargo check (macos-latest) (push) Has been cancelled
check / cargo check (ubuntu-22.04) (push) Has been cancelled
check / cargo check (windows-latest) (push) Has been cancelled
check / svelte build + lint (push) Has been cancelled
agent: lumotia-rebrand — docs, scripts, root config, residuals
Phase 9 of the rebrand cascade. Sweep covers everything the Phase 8
frontend pass deliberately skipped: docs/, root markdown, scripts,
Cargo.toml descriptions, code comments that survived earlier
word-boundary sed, plus a handful of identifiers caught on the final
verify pass.

transcription-app changes:
- README.md, HANDOVER.md, KNOWN-ISSUES.md, run.sh — magnotia/Magnotia
  -> lumotia/Lumotia.
- docs/ — sweep across all subdirs except docs/handovers/ (preserved
  as immutable audit trail). Includes architecture-map references
  to magnotia_core::*, magnotia_storage::*, etc. now pointing at
  lumotia_*; dev-setup.md tracing output examples (lumotia_startup
  target); brief/ + superpowers/ + issues/ + whisper-ecosystem/ +
  audit/.
- Cargo.toml descriptions on 9 crates (core, audio, cloud-providers,
  hotkey, llm, mcp, plus referenced others).
- crates/core/src/{error,hardware,recommendation,paths}.rs +
  crates/audio/src/wav.rs + crates/llm/src/model_manager.rs +
  crates/cloud-providers/src/keystore.rs + crates/mcp/src/lib.rs —
  doc comments and a model-manager user-agent string.
- Caught on final pass: BroadcastChannel("magnotia_task_sync") -> ...
  ("lumotia_task_sync"); magnotia_locale i18n localStorage key
  renamed + migration shim added; CSS keyframe names
  magnotiaPulse / magnotiaBar / magnotiaFade renamed in the design-
  system kit; magnotia_viewer_item / magnotia_viewer_mode handoff
  keys renamed in HistoryPage + viewer/+page.svelte; src/assets/
  wordmark.svg text.
- src-tauri/src/lib.rs comment cleanup ("magnotia era" was sed'd
  to "lumotia era" earlier — restored).

Preserved (intentional):
- crates/core/src/paths.rs — keeps "magnotia" / "Magnotia" / ".magnotia"
  legacy detection strings in legacy_and_target_paths() so the
  migration shim can still find user data from the magnotia era.
- src/lib/stores/{page,focusTimer}.svelte.ts + src/lib/i18n/index.ts
  — migration call sites reference the legacy magnotia keys
  deliberately.
- docs/handovers/ — historical audit trail.

cargo build --workspace passes. npm run check: 0 errors / 0 warnings
(3958 files). cargo test --workspace: 339 pass / 0 fail.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 12:38:03 +01:00

3.1 KiB

name, type, slice, last_verified
name type slice last_verified
Internationalisation architecture-map-page 01-frontend 2026/05/09

Internationalisation

Where you are: Architecture mapFrontend → Internationalisation

Plain English summary. svelte-i18n is wired but coverage is intentionally minimal. The infrastructure (loader, persisted choice, Settings selector) is in place so strings can migrate incrementally. Three locales: English (source of truth), Spanish, German. Most strings still render hardcoded.

At a glance

  • Path: src/lib/i18n/
  • LOC: 73 (index.ts) + 19 lines per locale JSON.
  • Key files:
    • src/lib/i18n/index.ts. Setup, locale detection, public exports.
    • src/lib/i18n/locales/en.json. 19 lines.
    • src/lib/i18n/locales/es.json. 19 lines.
    • src/lib/i18n/locales/de.json. 19 lines.
  • Library: svelte-i18n 4.0.1.

What's in here

index.ts

import { init, register, locale as svelteLocale } from "svelte-i18n";
import { derived, get } from "svelte/store";

export type Locale = "en" | "es" | "de";

export const SUPPORTED_LOCALES: { code: Locale; label: string }[] = [
  { code: "en", label: "English" },
  { code: "es", label: "Español" },
  { code: "de", label: "Deutsch" },
];

const STORAGE_KEY = "lumotia_locale";

register("en", () => import("./locales/en.json"));
register("es", () => import("./locales/es.json"));
register("de", () => import("./locales/de.json"));

function detectInitialLocale(): Locale { /* localStorage → navigator.language → "en" */ }

Public exports:

  • initI18n(). Idempotent. Called from every layout's onMount-ish path (+layout.svelte:38 and the float/viewer/preview break layouts).
  • setLocale(code). Writes to lumotia_locale and updates the svelte-i18n store.
  • currentLocale. A derived store that components subscribe to via $currentLocale.
  • SUPPORTED_LOCALES constant for the picker.

Locale JSON shape

19 lines per file means roughly a dozen translated strings. Treat the locales as a stub. Most page text is still hardcoded.

Where it is consumed

  • SettingsPage.svelte:22 imports _ (the translation function) and SUPPORTED_LOCALES, setLocale, currentLocale. The locale picker UI lives in Settings.
  • A handful of strings inside SettingsPage use $_('key').

Watch outs

  • Adding a new locale is one register("xx", () => import("./locales/xx.json")) call plus a SUPPORTED_LOCALES entry.
  • Cross window: each window initialises i18n independently via its layout. Locale change persists to localStorage["lumotia_locale"]. Float and viewer pick up the new locale on the next mount, not live. Worth wiring a Tauri event if live cross-window translation is needed.
  • The "British English" toggle in settings.britishEnglish is a transcription post-processing flag (slice 04 territory), not a UI locale. Not wired through svelte-i18n.
  • Default locale is detected from navigator.language. In Tauri, this is the OS locale.

See also