[PR #3986] [MERGED] Add UI localization foundation #6185

Closed
opened 2026-10-23 04:07:54 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/3986
Author: @SpicyMarinara
Created: 7/23/2026
Status: ✅ Merged
Merged: 7/23/2026
Merged by: @SpicyMarinara

Base: staging ← Head: agent/localization-foundation-3978


📝 Commits (4)

  • 4d36c1f Start localization foundation
  • 13e4f0a Add UI localization foundation
  • a5c0c68 Add more UI language catalogs
  • c20c38f Apply CodeRabbit review fixes for retry label and locale markup checks

📊 Changes

33 files changed (+1153 additions, -38 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 CONTRIBUTING.md (+9 -0)
📝 README.md (+1 -0)
➕ docs/development/localization.md (+163 -0)
📝 docs/development/optional-agent-packages.md (+5 -0)
📝 docs/settings/settings-overview.md (+6 -1)
📝 e2e/core-flows.e2e.ts (+129 -0)
📝 package.json (+2 -1)
📝 packages/client/package.json (+2 -0)
📝 packages/client/src/components/capabilities/CapabilityElement.tsx (+38 -11)
📝 packages/client/src/components/panels/SettingsPanel.tsx (+10 -9)
➕ packages/client/src/localization/LocalizationProvider.tsx (+26 -0)
➕ packages/client/src/localization/i18n.ts (+85 -0)
➕ packages/client/src/localization/locale-loader.ts (+113 -0)
➕ packages/client/src/localization/locale-types.ts (+24 -0)
➕ packages/client/src/localization/locales/ar.json (+24 -0)
➕ packages/client/src/localization/locales/de.json (+24 -0)
➕ packages/client/src/localization/locales/en.json (+24 -0)
➕ packages/client/src/localization/locales/es.json (+24 -0)
➕ packages/client/src/localization/locales/fr.json (+24 -0)

...and 13 more files

📄 Description

Why

Issue #3978 needs a stable, contributor-friendly localization architecture before thousands of hard-coded UI strings and community translations can move upstream safely.

This first focused slice establishes that foundation without changing model prompts, generated chat content, persisted protocol values, or other machine-readable behavior.

What changed

  • Added an i18next/react-i18next runtime with synchronous canonical English and English fallback.
  • Auto-discovers canonical BCP-47 locale JSON files; non-English resources load only when selected.
  • Connected Settings → General → Language with live foundation catalogs for Arabic, Simplified Chinese, English, French, German, Hindi, Japanese, Korean, Polish, Brazilian Portuguese, Russian, and Spanish.
  • Added Arabic right-to-left document direction; all other bundled locales use left-to-right direction.
  • Persists the selected locale, safely normalizes unsupported stored values to English, and synchronizes the document lang, dir, and title.
  • Added a race-safe locale activation path so rapid or delayed lazy loads cannot restore an older language selection.
  • Passes { locale, direction } plus lang/dir to downloadable Agent capability interfaces and reuses the existing capability-props update event.
  • Added a locale validator for metadata, canonical filenames, semantic/sorted keys, unknown keys, empty values, and interpolation/rich-text token parity.
  • Documents all supported languages and provides separate PR instructions for correcting an existing translation or submitting a new locale against staging.
  • Added Agent-package guidance, CHANGELOG coverage, and desktop/mobile browser regressions.

Translation status

English is the canonical source. The eleven non-English foundation catalogs are initial machine-assisted translations and are explicitly open to fluent-speaker corrections. Missing UI keys fall back to English while the broader extraction work continues.

Deliberate boundary

This is the architecture and first migrated UI slice, not the completion of #3978. The remaining hard-coded UI, including chat/game surfaces, tooltips, placeholders, Professor Mari tutorials, and Engine-owned Agent screens, should move into the canonical catalog in focused follow-up PRs. Package-owned Agent copy and translations remain in Marinara-Agents.

Automated evidence

  • pnpm check passed at the current head: locale validation, TypeScript, ESLint, and shared/server/client production builds.
  • pnpm version:check passed.
  • Focused localization Playwright coverage passed on desktop and mobile: 2 passed, 0 failed.
  • Every selectable catalog loaded its translated Settings heading; Arabic applied RTL and English restored LTR.
  • Production output emitted every non-English locale as a separate lazy chunk.
  • The foundation smoke baseline passed before catalog expansion: 90 passed, 52 intentional viewport skips, 0 failed.

Manual review checklist

  • Manually verify locale switching and English fallback on desktop.
  • Manually verify locale switching and English fallback on mobile.
  • Have fluent speakers review the eleven machine-assisted non-English catalogs for wording and truncation.
  • Manually verify Arabic layout direction across representative Engine surfaces.
  • Manually verify an installed Agent capability rerenders after a locale change.

Refs #3978

Summary by CodeRabbit

  • New Features

    • Added UI localization with English fallback and selectable languages including Arabic, Chinese, French, German, Hindi, Japanese, Korean, Polish, Portuguese, Russian, and Spanish.
    • Language preferences persist across sessions, with automatic fallback for unsupported or incomplete translations.
    • Added right-to-left support for Arabic.
    • Downloadable capability interfaces now receive the selected language and text direction.
  • Documentation

    • Added localization guidance for settings, contributors, and optional capability packages.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/3986 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 7/23/2026 **Status:** ✅ Merged **Merged:** 7/23/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `agent/localization-foundation-3978` --- ### 📝 Commits (4) - [`4d36c1f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4d36c1fdb6f1b7dc707061e11304b7c50d02ba01) Start localization foundation - [`13e4f0a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/13e4f0a8be39366ed20d65d82fa57ef432a5d469) Add UI localization foundation - [`a5c0c68`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a5c0c68ee3a66045fccd573f6b9517055321f564) Add more UI language catalogs - [`c20c38f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c20c38f74b39568c470307664b1e9177c397a8a4) Apply CodeRabbit review fixes for retry label and locale markup checks ### 📊 Changes **33 files changed** (+1153 additions, -38 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `CONTRIBUTING.md` (+9 -0) 📝 `README.md` (+1 -0) ➕ `docs/development/localization.md` (+163 -0) 📝 `docs/development/optional-agent-packages.md` (+5 -0) 📝 `docs/settings/settings-overview.md` (+6 -1) 📝 `e2e/core-flows.e2e.ts` (+129 -0) 📝 `package.json` (+2 -1) 📝 `packages/client/package.json` (+2 -0) 📝 `packages/client/src/components/capabilities/CapabilityElement.tsx` (+38 -11) 📝 `packages/client/src/components/panels/SettingsPanel.tsx` (+10 -9) ➕ `packages/client/src/localization/LocalizationProvider.tsx` (+26 -0) ➕ `packages/client/src/localization/i18n.ts` (+85 -0) ➕ `packages/client/src/localization/locale-loader.ts` (+113 -0) ➕ `packages/client/src/localization/locale-types.ts` (+24 -0) ➕ `packages/client/src/localization/locales/ar.json` (+24 -0) ➕ `packages/client/src/localization/locales/de.json` (+24 -0) ➕ `packages/client/src/localization/locales/en.json` (+24 -0) ➕ `packages/client/src/localization/locales/es.json` (+24 -0) ➕ `packages/client/src/localization/locales/fr.json` (+24 -0) _...and 13 more files_ </details> ### 📄 Description ## Why Issue #3978 needs a stable, contributor-friendly localization architecture before thousands of hard-coded UI strings and community translations can move upstream safely. This first focused slice establishes that foundation without changing model prompts, generated chat content, persisted protocol values, or other machine-readable behavior. ## What changed - Added an i18next/react-i18next runtime with synchronous canonical English and English fallback. - Auto-discovers canonical BCP-47 locale JSON files; non-English resources load only when selected. - Connected **Settings → General → Language** with live foundation catalogs for Arabic, Simplified Chinese, English, French, German, Hindi, Japanese, Korean, Polish, Brazilian Portuguese, Russian, and Spanish. - Added Arabic right-to-left document direction; all other bundled locales use left-to-right direction. - Persists the selected locale, safely normalizes unsupported stored values to English, and synchronizes the document `lang`, `dir`, and title. - Added a race-safe locale activation path so rapid or delayed lazy loads cannot restore an older language selection. - Passes `{ locale, direction }` plus `lang`/`dir` to downloadable Agent capability interfaces and reuses the existing capability-props update event. - Added a locale validator for metadata, canonical filenames, semantic/sorted keys, unknown keys, empty values, and interpolation/rich-text token parity. - Documents all supported languages and provides separate PR instructions for correcting an existing translation or submitting a new locale against `staging`. - Added Agent-package guidance, CHANGELOG coverage, and desktop/mobile browser regressions. ## Translation status English is the canonical source. The eleven non-English foundation catalogs are initial machine-assisted translations and are explicitly open to fluent-speaker corrections. Missing UI keys fall back to English while the broader extraction work continues. ## Deliberate boundary This is the architecture and first migrated UI slice, not the completion of #3978. The remaining hard-coded UI, including chat/game surfaces, tooltips, placeholders, Professor Mari tutorials, and Engine-owned Agent screens, should move into the canonical catalog in focused follow-up PRs. Package-owned Agent copy and translations remain in Marinara-Agents. ## Automated evidence - `pnpm check` passed at the current head: locale validation, TypeScript, ESLint, and shared/server/client production builds. - `pnpm version:check` passed. - Focused localization Playwright coverage passed on desktop and mobile: 2 passed, 0 failed. - Every selectable catalog loaded its translated Settings heading; Arabic applied RTL and English restored LTR. - Production output emitted every non-English locale as a separate lazy chunk. - The foundation smoke baseline passed before catalog expansion: 90 passed, 52 intentional viewport skips, 0 failed. ## Manual review checklist - [ ] Manually verify locale switching and English fallback on desktop. - [ ] Manually verify locale switching and English fallback on mobile. - [ ] Have fluent speakers review the eleven machine-assisted non-English catalogs for wording and truncation. - [ ] Manually verify Arabic layout direction across representative Engine surfaces. - [ ] Manually verify an installed Agent capability rerenders after a locale change. Refs #3978 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added UI localization with English fallback and selectable languages including Arabic, Chinese, French, German, Hindi, Japanese, Korean, Polish, Portuguese, Russian, and Spanish. - Language preferences persist across sessions, with automatic fallback for unsupported or incomplete translations. - Added right-to-left support for Arabic. - Downloadable capability interfaces now receive the selected language and text direction. - **Documentation** - Added localization guidance for settings, contributors, and optional capability packages. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:07:54 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#6185
No description provided.