From 0926ec879c49300387d3b69bea83b59e136a7b1f Mon Sep 17 00:00:00 2001 From: Leonid Pershin Date: Mon, 17 Aug 2026 10:58:02 +0300 Subject: [PATCH] Enhance internationalization support across UI components; integrate i18n for dynamic text rendering in menus, forms, and HUD elements. Update climate and weather modules to utilize localized labels and descriptions, ensuring a consistent user experience in multiple languages. Refactor related tests to validate translations and locale settings. --- AGENTS.md | 3 + src/TheLivingWorld.Web/index.html | 45 +++-- src/TheLivingWorld.Web/src/i18n/dom.ts | 62 +++++++ src/TheLivingWorld.Web/src/i18n/i18n.test.ts | 88 +++++++++ src/TheLivingWorld.Web/src/i18n/index.ts | 134 ++++++++++++++ src/TheLivingWorld.Web/src/i18n/locales.ts | 23 +++ src/TheLivingWorld.Web/src/i18n/locales/en.ts | 175 ++++++++++++++++++ src/TheLivingWorld.Web/src/i18n/locales/ru.ts | 175 ++++++++++++++++++ src/TheLivingWorld.Web/src/i18n/stage.ts | 32 ++++ src/TheLivingWorld.Web/src/i18n/types.ts | 162 ++++++++++++++++ src/TheLivingWorld.Web/src/main.ts | 170 +++++++++++------ src/TheLivingWorld.Web/src/styles.css | 38 ++++ src/TheLivingWorld.Web/src/ui/climate.test.ts | 12 +- src/TheLivingWorld.Web/src/ui/climate.ts | 15 +- .../src/ui/gameTime.test.ts | 15 +- src/TheLivingWorld.Web/src/ui/gameTime.ts | 29 ++- src/TheLivingWorld.Web/src/ui/weather.test.ts | 14 +- src/TheLivingWorld.Web/src/ui/weather.ts | 48 ++--- 18 files changed, 1112 insertions(+), 128 deletions(-) create mode 100644 src/TheLivingWorld.Web/src/i18n/dom.ts create mode 100644 src/TheLivingWorld.Web/src/i18n/i18n.test.ts create mode 100644 src/TheLivingWorld.Web/src/i18n/index.ts create mode 100644 src/TheLivingWorld.Web/src/i18n/locales.ts create mode 100644 src/TheLivingWorld.Web/src/i18n/locales/en.ts create mode 100644 src/TheLivingWorld.Web/src/i18n/locales/ru.ts create mode 100644 src/TheLivingWorld.Web/src/i18n/stage.ts create mode 100644 src/TheLivingWorld.Web/src/i18n/types.ts diff --git a/AGENTS.md b/AGENTS.md index fd99805..fcc9760 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -80,6 +80,9 @@ ids on first use without a lock, and two threads racing there hand out the same Keep wire DTOs in sync: `TheLivingWorld.Core.Contracts` and `src/TheLivingWorld.Web/src/api/types.ts`. +UI copy lives in `src/TheLivingWorld.Web/src/i18n/locales/`. `en.ts` is the schema; add a language by +copying it and registering the file in `locales.ts`. The language switcher is built from that registry. + ## Working conventions - Prefer small, focused diffs. Do not rewrite unrelated code or add docs the user did not ask for. diff --git a/src/TheLivingWorld.Web/index.html b/src/TheLivingWorld.Web/index.html index 9033167..94e09d4 100644 --- a/src/TheLivingWorld.Web/index.html +++ b/src/TheLivingWorld.Web/index.html @@ -11,16 +11,19 @@