omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

Feature request: add an i18n/localization system for Omarchy

Open Antaneyes opened this issue 3 months ago • 11 comments

Summary

Please provide a supported localization mechanism for Omarchy's shell UI and its plugin ecosystem.

Scope

This request is mainly about:

  • Built-in shell plugins and panels.
  • The Omarchy menu and other shell-owned UI.
  • A translation helper/API that third-party Omarchy plugins can use.

It is not a request to translate every application shipped with the distribution.

Motivation

A number of visible strings in the shell and built-in plugins are currently hardcoded in QML, for example search placeholders, empty states, dialog buttons, panel labels, and menu messages. Third-party plugins also have to implement their own translation systems from scratch.

For users who want Spanish or another language, this means maintaining local patches that can be overwritten by Omarchy updates, or translating each plugin independently.

Suggested approach

  • Add a small localization helper available to shell code and plugins.
  • Store first-party translations in language files, with English as the fallback.
  • Add a locale setting in the Omarchy configuration.
  • Allow user overrides under ~/.config/omarchy/locales/ so custom translations survive updates.
  • Document how third-party plugins can declare and load their translations.
  • Keep stable translation keys instead of making plugins search and replace visible English strings.

This could cover shared UI components, the bar, panels, notifications, the Omarchy menu, and plugin manifests/settings while leaving the choice of translations to contributors.

Example

A user could select Spanish once in Omarchy and have the shell and compatible plugins use it automatically. A user or contributor could then add or override a missing string without editing files under /usr/share/omarchy/.

This would make localization maintainable for both Omarchy itself and the plugin ecosystem.

Note: This issue was drafted with assistance from AI.

Antaneyes avatar Aug 17 '26 14:08 Antaneyes

There's a full design and working prototype for this at https://github.com/xavivars/omal10n-poc: primitive in core, language packs as plugins, gettext PO in a community repo.

It also resolves the clock/calendar locale bugs (#7211, #7481, #7760, #8600) as a side effect, since those are the same problem.

Discussion of the approach is welcome there or here.

xavivars avatar Aug 28 '26 14:08 xavivars

Hi, this is great! I had a first dissapointment to know that Omarchy doesn't speak in my language. But that woudn't be a biggie as long as I get to type my non-ASCII characters as I do in other distros (why the heck the installer even asks for the keyboard layout if it doesn't use it anywhere (it would have a real meaning). Other than that I'm sold but until then it's not a viable daily driver for more than half of the world probably.

piotrekzurek avatar Sep 02 '26 08:09 piotrekzurek

Separate from this, and not blocked on it: #10949 adds a language question to setup and a Language row beside Timezone in the menu. That one only sets the system locale — the thing GTK apps, browsers and xdg-user-dirs follow — and translates nothing, so it stands or falls on its own whatever is decided here. It is what #1187 and #3161 ask for.

The prototype below is the harder half: translating the shell's own strings.

Branch: https://github.com/sbelcl/omarchy/tree/i18n-prototype (against v4.0.2: https://github.com/omacom/omarchy/compare/v4.0.2...sbelcl:omarchy:i18n-prototype)

I prototyped this against v4.0.2 to find out how big it actually is, and the answer surprised me: the whole shell is roughly 200 user-visible strings — 71 in plugins/panels, 10 in plugins/bar, 6 in Ui/, the rest scattered a handful at a time. Smaller than it looks from outside.

The prototype follows the shape proposed here. A Commons/Translations singleton, JSON catalogs of English → translation at $OMARCHY_PATH/default/locales/<lang>.json, user overrides at ~/.config/omarchy/locales/<lang>.json, English as both source and fallback. Catalogs are read for the bare language and the regional variant and layered shipped < shipped-region < user < user-region, so someone can correct a single string without copying a catalog and keep that correction across updates. All four are watched, so an edit shows up in the running shell. Language comes from LANG, with OMARCHY_LANGUAGE to override it without changing the session locale.

t() takes %1..%9 arguments, because concatenation at the call site freezes word order — "Start weeks on " + day can only put the day last. plural() takes both English forms and a count and resolves CLDR categories, because English has two forms and that is not the usual number: Slovenian has four, one of them a dual (1 naprava, 2 napravi, 3–4 naprave, 5+ naprav), which no "device" → single-word mapping can produce.

shell/plugins/panels/power is the worked example — 28 call sites, section headers through to the rotating charge phrases — and plugins/agents/Panel.qml carries the plural one, where the shell was building " device" + (count === 1 ? "" : "s") inline. Model.js keeps returning English: it is Qt-free and node-tested, so what it returns is a key and the view translates it. The diff is +472/−30 across 8 files, with 56 assertions in test/shell.d/translations-test.sh, power-test.sh, agents-panel-test.sh and bar-widget-contract-test.sh still passing, and qmllint reporting the same warning counts for both panels before and after.

Two notes on the design.

Not qsTr(). Qt's translation machinery expects the host application to install a QTranslator, plus an lupdate/lrelease step to feed it. Quickshell offers a QML-only shell neither. A singleton over JSON is how menus, themes and shell.json are already handled here, and it adds no build step.

Keys are the English strings, not stable ids. This departs from the "stable translation keys" point in the request. The tradeoff is real: editing an English string orphans its translation. But because the fallback is the English source, an orphan degrades to correct English rather than to a blank or a visible power.profile.header, and call sites stay readable in review. Easy to switch to ids if you would rather have them.

What this does not do, so it is on the record rather than discovered later:

  • RTL is untouched. There are 0 uses of LayoutMirroring or layoutDirection in the shell and 234 anchors.left/anchors.right, so Arabic or Hebrew would get correct words in a left-to-right skeleton. That is a separate change, and a bigger one.
  • toUpperCase() is locale-independent, and 12 files call it — including on a string this patch now translates. Turkish i becomes I rather than İ. toLocaleUpperCase() fixes it wherever you would like that to land.
  • Script modifiers are dropped: sr_RS@latin resolves to sr and sr_RS, so Serbian Latin and Cyrillic cannot have separate catalogs yet.
  • Fixed panel widths will truncate longer languages before they wrap.

The menu is a separate problem — it is data rather than code, so it wants a per-id catalog instead of this.

Before anyone converts the remaining ~170 strings: is this something you would take? shell/plugins/panels/clock/Panel.qml:68 says "The interface is English throughout, so day names are not taken from the system locale", which reads like a deliberate position rather than an oversight. If it still is, saying so here would save the next person the same prototype. If it is not, I will open a PR with the mechanism plus the power panel, and the rest can land incrementally, a panel at a time.

sbelcl avatar Sep 09 '26 08:09 sbelcl

I missed #8765 when I posted the above. @xavivars had the same architecture two weeks earlier and considerably further along — bash side, docs, language packs as plugins, PO in a community repo. My branch is duplicate work; read it as a second data point on the shape rather than as a proposal. I would rather see #8765 land than anything of mine.

One correction I owe. I wrote that qsTr() was out because Quickshell gives a QML-only shell no QTranslator. @komagata's #10051 shows Qt's translation system running inside an unmodified Quickshell process, so "offers neither" was too strong: the cost is a C++ extension, not impossibility, and quickshell-mirror/quickshell#445 is the cleaner fix. If Quickshell grows QTranslator loading, most of the argument for a JS runtime goes away with it.

The one piece of my branch worth keeping either way is the measurement. The whole shell is roughly 200 user-visible strings — 71 in plugins/panels, 10 in plugins/bar, 6 in Ui/, the rest a handful at a time. Whichever runtime wins, the conversion is smaller than it looks from outside, and it can land a panel at a time.

Unrelated to the runtime question: #10949 only asks for a language at setup and offers one in the menu. It sets the system locale and translates nothing, so it does not depend on how this is decided.

sbelcl avatar Sep 09 '26 10:09 sbelcl

Hi! I'm a daily Omarchy user and a native Russian speaker, and I'd like to help with Russian (ru) localization:

  • Website/manual: Russian isn't among the 29 launched languages — I'm happy to translate and proofread.
  • Shell UI: following #8765 prototype — once the i18n framework lands, I'm ready to do the full ru pack and maintain it.

Where should I start, and is there anyone coordinating l10n efforts?

WokoFlipper avatar Sep 09 '26 13:09 WokoFlipper

@WokoFlipper Nobody is coordinating it as far as I can tell — I am a user with some patches, not a maintainer. But the website and the shell are separate problems with separate answers, so here is what I found.

Website/manual. Different repo: omacom/omarchy-site, under src/i18n/ — one directory per locale, plus src/i18n/locales.json, which currently lists 31 locales and has no ru. Each language builds separately via PUBLIC_SITE_LOCALE and carries its own domain in that file. That is where a Russian PR would go, and the right repo to ask in.

Shell strings. #8765 is the thing to back. Worth knowing it is not settled yet: @komagata's #10051 argues for Qt's own QTranslator over a JS runtime, and until a runtime is picked, a ru pack has nothing stable to target.

The menu, though, is translatable today and needs no framework. Its rows are JSONC, and ~/.config/omarchy/extensions/omarchy-menu.jsonc overrides them by id. I ship a Slovenian one that way: the table is English<TAB>translation, keyed by string rather than by row id, so a Russian one is a file rather than code — sbelcl/omarchy-language, translations/sl_SI.tsv. Copy it, translate the right column, done.

One gotcha if you go that route: an override has to re-declare the whole row. parseMenuJsonc normalizes every entry to a full object with empty-string defaults before merging, so {"label": "Меню"} silently drops that row's icon and action.

Dates are a third thing, and not a translation problem at all. Qt.formatDate/Qt.formatDateTime render through the C locale whatever LANG says, so Russian day and month names come out English no matter which framework lands. #10955 fixes that in four lines.

Happy to hand the menu generator to anyone who wants to make it properly multi-language rather than my-language.

sbelcl avatar Sep 10 '26 06:09 sbelcl

Thanks for the detailed map! Confirming from the Russian side: menu via jsonc override works (335 rows live, whole-row rule respected), site PR follows the messages/*.json convention, and shell/cli translations are kept as preview packs until the #8765 vs #10051 runtime question settles. Backed #10955 with a ru_RU confirmation — dates are indeed English without it. Interested in the menu generator handoff if you want to make it multi-language.

WokoFlipper avatar Sep 13 '26 02:09 WokoFlipper

@sbelcl @WokoFlipper — following on from the coordination question above: I have written up an adjudication of the existing proposals as #12345, with the measurements attached rather than as another opinion. It is a design proposal for this issue, kept in its own thread so the PRs that follow can cite a URL.

Short version of what is in it, so you can decide whether it is worth your time: there is no working gettext → Qt catalog bridge (msgfmt --qt fails on Omarchy's real strings; po2ts exits 0 and silently corrupts the key space), which is what settles the runtime question in favour of #8765 plus four amendments. It also names the key scheme to target — gettext's (msgctxt, English msgid), never a QML filename — which is the part that matters for the packs you two are already carrying, since it is what makes a later move between runtimes a re-emit rather than a re-key.

Two of my own earlier conclusions are retracted in it by name, including one that wrongly declared the .qm route closed.

The paired PR is #12344: it records which command output is a protocol that must keep its bytes in every language, and derives that list from the tree so it cannot go stale. It is green as it stands and contains no translation — the motivating case is that omarchy-dns prints Custom and the menu compares against that word, so translating it leaves the DNS menu with nothing selected and nothing failing anywhere.

linyiru avatar Sep 18 '26 00:09 linyiru

Status from the ru/sl front, for anyone tracking #7284: this is all live, not proposed.

  • Menu: full ru table (137 rows) via whole-row jsonc override — 335 rows, icons intact. Merged into sbelcl/omarchy-language.
  • Panels: locales/ru.json, 179/179 keys byte-exact with sl.json, CLDR plurals, verified end to end — clock shows ПН..ВС / СЕНТЯБРЯ 2026 / 16 сентября on ru_RU.UTF-8.
  • Bindings: 204 Russian descriptions held as archive-only (per #12345 §7, applying them breaks merges — waiting on the stable-id schema).
  • Published precedent: Charge Limit plugin (resty.charge) passed marketplace validation + maintainer review — i18n-adjacent community work does land.

Open and needing hands: wind units in m/s (#11139, 3-line fix), the bindings schema project, and the #8765 amendments (we volunteered as testbed in #12345).

WokoFlipper avatar Sep 18 '26 08:09 WokoFlipper

Cross-linking #13554 (bin/ OSD strings have no i18n path): per @jandrusk's point there, a bin/ catalog should follow whatever framework gets picked here rather than grow its own pilot. My live RU packs (menu jsonc override, panel catalog in sbelcl/omarchy-language, now manual/ru in #14292) are all ready to rebase onto it — just say the word on the pattern.

WokoFlipper avatar Oct 07 '26 21:10 WokoFlipper

Supporting this from the Spanish-speaking side — and it is already live, not proposed.

Following the omarchy-language coordination in this thread, I have opened sbelcl/omarchy-language#30 with a full es_ES pack in the same shape as the sl/ru ones:

  • Menu + Super+K: 137 rows keyed by the English string (identical key set and order to ru_RU.tsv).
  • Panel catalog: 240 keys, same set as ru.json, CLDR one/other plurals. Spanish plural agreement is the English shape, so no pluralCategory entry was needed.
  • Validated with the repo's own check tool and test suites (model, setup, keybindings all pass).

I am a native Spanish speaker and I am offering to maintain the pack as panels and menu rows land, same as the Slovenian and Russian maintainers. For anyone tracking this issue: es is now at parity with ru/sl in omarchy-language.

thealejandro avatar Oct 31 '26 05:10 thealejandro