Files
craft-launcher/apps
MaksimandClaude Opus 5.5 cf5604dc65 Add UI localisation (i18n) with a Russian catalog
Every user-visible string in the interface is now looked up from a
per-language catalog at render time instead of being compiled in as
English. English stays the source of truth and the lookup key; a missing
row falls back to English rather than failing.

- crates/ui-egui/src/i18n: `t`/`tl!` for literals, `tr_ctx` (one English
  word needing different translations), `tr_id` (command-id keyed),
  `trn`/`tn` (plurals), `fmt` ({name} placeholders filled after the
  lookup) and `message`/`msg` (backend status and error text, translated
  where it is shown). Split into lang.rs (the registry and locale tags),
  detect.rs (the system language), translate.rs (lookups) and catalog.rs
  (the TSV parser); mod.rs only declares them.
- ru.tsv: the whole interface in Russian, with East Slavic plural forms,
  month abbreviations, a day-month-year date template and each app's
  tagline. Product and app names (ArtCraft Launcher, Craft App Suite,
  PhotoCraft…) stay in English.
- The language follows the system by default: ARTCRAFT_LAUNCHER_LOCALE,
  then the OS's preferred UI languages through the sys-locale crate
  (desktop only; LANGUAGE/LC_*/LANG on Linux and the BSDs, the preferred
  languages on macOS, the user's UI languages on Windows), and `?lang=`
  then `navigator.languages` on the web. Settings > Language overrides it.
- core stays pure and wasm-safe: `time::ago_kind` and `month_short_en`
  let the UI render relative times and dates in the current language.

Ported onto main from the original PR (#28): every string main added
since (feed notices and alerts, the "using ArtCraft API and GitHub"
footer, window buttons, waiting and retry states, the install-cancelled
toasts, filter tooltips, package formats, the reveal label) goes through
the catalog, with Russian rows. Also changed from the original:
- `@msg` templates now match real messages: `Couldn't open {name}: {e}`
  translates "Couldn't open PhotoCraft: …", the most specific template
  wins. Rows for messages the launcher never sends (clipboard, recovery
  data) are gone; rows for its install/update/remove toasts are added.
- The locale probes no longer spawn /usr/bin/defaults or reg.exe; the
  small, dependency-free sys-locale crate asks the OS instead.
- Folded in from #34's framework fixes: catalog tests split rows with
  trim_end (trim dropped the leading TAB, so plain rows were silently
  skipped), the English plural fallback goes by n == 1, @plural rows take
  1 to 3 forms, and Settings::language_label comes from the registry.
- Tests are registry-driven: placeholders, plural form counts and, for
  every catalog marked complete, coverage of every tl!/t literal, every
  tn plural key, each tagline and the package formats. A Russian UI test
  renders the grid and table. Catalog warnings go to the log, not stderr.
- ru.tsv: "Launcher" and "Craft App Suite" stay in English; "лаунчер" is
  spelled one way; "Verifying…" (Проверка целостности…) and "Discard
  download" (Удалить скачанное) no longer read like "Checking…" and
  "Cancel download"; the table's Installed/Latest headers are short
  enough to fit; the reveal rows match the backend's "Show in …" labels.
- The toolbar drops its "Sort" caption when longer labels leave no room
  for it, rather than drawing over the filters.
- Unused settings helpers and LANGUAGE_CODES were removed, and core's doc
  comments now describe what the UI actually translates.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-10 13:06:46 -04:00
..