Skip to content

feat(i18n): add Persian UI with RTL and Vazirmatn - #97522

Open
MiRHaDi wants to merge 8 commits into
NousResearch:mainfrom
MiRHaDi:feat/persian-ui
Open

MiRHaDi wants to merge 8 commits into
NousResearch:mainfrom
MiRHaDi:feat/persian-ui

Conversation

@MiRHaDi

@MiRHaDi MiRHaDi commented Aug 29, 2026 •

Copy link
Copy Markdown

What does this PR do?

Adds Persian locale selection, RTL layout support, and locally bundled Vazirmatn to Hermes Desktop and the web dashboard. Switching back to English restores LTR; code and terminal typography stays monospace.

Preserves the original four commits and authorship by @blackorange-mega from #86335. Complements CLI/gateway locale work in #53398.

Closes #76854. Related: #53398. Supersedes with preserved credit: #86335.

Implementation

  • Registers Persian aliases and the native language-picker label using the shared endonym and direction helpers.
  • Adds Persian catalogs with the existing English fallback, and logical layout utilities on affected dashboard surfaces.
  • Bundles Vazirmatn with its pinned source, checksum, and SIL OFL notice; no remote font requests.
  • Incorporates main dc3923961431892f44bdf0bc10f8682e39485682, preserving the new language registry, additional upstream languages, and extracted copy-last control.
  • Removes 104 obsolete override entries no longer accepted by the current core translation contract. Adapts the project-directory notification to the configured shortcut, including no-shortcut configurations.
  • Adds all 30 Persian canonical group control/recovery messages. Makes the registry test count bundled locales dynamically.
  • Registers the raw Persian overlay in the existing coverage ratchet. The initial Persian baseline explicitly records 2,557 untranslated desktop keys; existing other-language gaps are preserved. This is partial localization, not complete translation of all new desktop/plugin screens.

Current validation (2026-10-28)

  • Desktop renderer TypeScript: passed.
  • Desktop i18n: 82 tests in 14 files passed.
  • Web TypeScript: passed.
  • Full web suite: 484 tests in 69 files passed (includes 13 Persian tests).
  • ESLint on the changed desktop catalog, registry, and Bot Mode locale files: passed.
  • Contribution whitespace check against upstream: passed.

These checks supersede the older test counts. Native packaging, Electron/E2E typechecks, and a fresh live desktop browser review were not rerun in this refresh. No live model interaction is claimed.

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/desktop Electron desktop app (apps/desktop/*) comp/dashboard Web dashboard / control panel UI (dashboard/, landing) area/i18n Localization, locales, translations labels Aug 29, 2026
blackorange-mega and others added 5 commits September 6, 2026 01:13
Persian is one of the most widely spoken RTL languages, but it was absent
from both GUI catalogs: the desktop app shipped en/zh/zh-hant/ja/ar, and
the dashboard shipped 17 locales with no fa.

Adds a Persian catalog to each front-end and registers it in the existing
RTL sets, so `document.documentElement.dir` flips and Tailwind's logical
utilities mirror the layout. No new CSS — the dashboard's html[dir="rtl"]
rule is already language-agnostic.

Scoped to the two TypeScript GUI catalogs. locales/fa.yaml and the fa entry
in agent/i18n.py are deliberately untouched: that CLI/gateway half is
already covered by the open PR NousResearch#53398, and CONTRIBUTING asks contributors
not to open competing duplicates. The halves are independent and can land
in either order.

Translation notes: {placeholder} tokens and arrow-function signatures are
preserved; brand names, env-var keys, paths, cron expressions, and protocol
terms stay untranslated; Latin digits are used throughout to match ar.ts and
runtime interpolation; ZWNJ is applied where Persian orthography requires
it. Dari (fa-AF) aliases to this catalog rather than falling back to
English.
The dashboard pluralizes count labels by substituting `{s}` with a literal
"s" (EnvPage/SkillsPage: `.replace("{s}", n !== 1 ? "s" : "")`). Carrying the
token into the Persian catalog rendered a stray Latin "s" on the end of a
Persian word — "5 مهارتs".

Persian nouns stay singular after a numeral, so the token is simply dropped
from the five affected strings; the replace then finds nothing and is a
no-op, leaving the shared component code untouched.

Adds fa.test.ts pinning both forms: no catalog string carries `{s}`, and
each label renders the same for singular and plural counts.
The previous assertions only rejected a trailing ASCII "s", which a
hard-coded value could satisfy. Each count template is now compared against
itself with only {count} substituted, proving the plural branch contributes
nothing for either count, and every template is checked for {count}.

config.fields is split out rather than folded into that group: it is a bare
noun with no {count} of its own — ConfigPage renders the number beside it in
JSX — so it is asserted to be count-invariant instead. Expected rendered
text is now pinned for all five labels in both forms.
Three strings used U+066A ARABIC PERCENT SIGN. The merged ar.ts uses a plain
"%", and these percentages are interpolated with Latin digits, so pairing
them with an Arabic-Indic percent sign was inconsistent both with the
existing locale and with the digit convention this catalog already follows.
@MiRHaDi

MiRHaDi commented Sep 12, 2026

Copy link
Copy Markdown
Author

Following up on the Persian desktop/dashboard localization. This branch was refreshed on September 5, with local desktop/web tests, type checks, lint and production builds recorded in the delivery report. I have checked the discussion again and found no requested revisions. Could a maintainer review the change and approve any fork workflows that still require approval? I am happy to address specific feedback or split the patch if preferred.

@MiRHaDi MiRHaDi changed the title feat(i18n): complete Persian UI with RTL and Vazirmatn feat(i18n): add Persian UI with RTL and Vazirmatn Sep 18, 2026
@MiRHaDi

MiRHaDi commented Sep 18, 2026

Copy link
Copy Markdown
Author

Merged current upstream main (01382698fc32) and pushed the compatibility refresh (c0de956dc4d4). Both clients now use the shared locale-direction helper for Persian. Stale desktop translation keys/signatures are reconciled with the moved plugin UI and MCP setup contract.

Validation: web check passes (351 tests, typecheck, zero lint errors), desktop i18n 34 tests and all three desktop typechecks pass, web production and desktop renderer builds pass. New upstream strings retain the existing English fallback where Persian coverage is not yet added; the PR description now states that scope explicitly. Native packaging and live visual review were not run.

GitHub currently reports this PR mergeable. Ready for another review.

@MiRHaDi

MiRHaDi commented Oct 28, 2026

Copy link
Copy Markdown
Author

Updated this branch against main dc39239 and resolved the registry/component extraction conflicts. The refresh fixes the configured-shortcut signature, removes retired core catalog entries, adds Persian canonical group recovery/control copy, and registers the partial overlay in the existing gap ratchet.

Current checks passed: desktop renderer typecheck, all 82 desktop i18n tests, web typecheck, all 484 web tests, targeted ESLint, and contribution whitespace checks. The PR description now explicitly records the 2,557 desktop keys still using English fallback rather than claiming full translation coverage. Native packaging and live desktop visual QA were not rerun.

@MiRHaDi

MiRHaDi commented Oct 30, 2026

Copy link
Copy Markdown
Author

Updated against main at 6bb377a and resolved the overlay-gap merge conflict. The new English catalog exposed 41 missing Persian messages; this update translates the recovery actions, local-runtime errors, cron stop/catch-up controls, browser notification permissions, plugin installation/version-change warnings, and tab actions. It also removes a retired translation property and two retired fallback keys, preserving the existing fallback allowance rather than expanding it for these new messages.

Validation: 76 tests in 10 desktop i18n files passed using a temporary focused Vitest config with jsdom, the existing setup file and workspace aliases. Interpolation tests cover provider/time/commit values and missing optional details. Scoped ESLint passed. The standard UI test configuration stalled during import; four Bot Mode-dependent i18n files were not successfully validated in this run, and the focused config is not a substitute for the complete desktop test suite. No Electron packaging or fresh visual RTL check is claimed.

The desktop renderer TypeScript check (tsc -p apps/desktop/tsconfig.json --noEmit) also passed. The contribution diff against the new upstream base passed whitespace validation; existing upstream-only whitespace warnings were left unchanged.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/i18n Localization, locales, translations comp/dashboard Web dashboard / control panel UI (dashboard/, landing) comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Persian (Farsi) locale to Hermes Desktop

3 participants