Omarchy menu never follows the system language, and the `languages` provider is missing (Language submenu shows "No results")

Aperta
#32 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 11 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
62/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
javascript

Direzione di ricerca

Start with the PROVIDERS map and providerMenus() in plugin/core/OmarchyMenu.js, which currently skip the languages provider, then look at how plugin/services/OmarchyMenuSource.qml loads the menu file. Add a languages provider that parses the three-column output of omarchy-language list, and add a translation step that reads the i18n catalog for the active language. Done when the Language submenu lists the available languages with the current one marked, English fallback works, and node --test tests/*.test.js passes with new cases in tests/omarchy-menu.test.js.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Environment

  • Omarchy 4.5.0rc1-1
  • Quickshell 0.3.2
  • oma-cast main @ 90efedd
  • System language set to pt-BR via omarchy-language pt-BR (~/.config/omarchy/language)

Summary

Two related gaps around Omarchy's localization support:

  1. The Omarchy menu section of oma-cast is never translated — it always shows English labels, even when the system display language is set to something else.
  2. The setup.language entry declares provider: "languages", but that provider is not implemented, so entering the Language submenu yields "No results".

Problem 1 — Omarchy menu ignores the system display language

Omarchy ships per-locale catalogs at $OMARCHY_PATH/default/i18n/<code>/menu.json (e.g. pt-BR/menu.json maps root → { label: "Ir" }, apps → { label: "Aplicativos" }, ...). Other Omarchy surfaces (the native menu, the shell) apply that catalog.

plugin/services/OmarchyMenuSource.qml only loads the raw menu definition:

readonly property string defaultPath: source.omarchyPath + "/default/omarchy/omarchy-menu.jsonc"
readonly property string userPath: Quickshell.env("HOME") + "/.config/omarchy/extensions/omarchy-menu.jsonc"

Nothing ever reads ~/.config/omarchy/language or the matching i18n/<code>/menu.json, and OmarchyMenu.buildTree() has no translation step. Result: with the system in Portuguese, the Omarchy menu inside oma-cast stays fully in English.

Problem 2 — languages provider missing → empty Language submenu

omarchy-menu.jsonc declares:

"setup.language": { "label": "Language", "provider": "languages", ... }

But PROVIDERS in plugin/core/OmarchyMenu.js only defines fonts and power-profiles, and providerMenus() filters on that map:

if (item.provider && OmarchyMenu.PROVIDERS[item.provider]) out.push(item.id)

So the languages menu is silently skipped, never gets populated, and opens with "No results".

Proposed fix

Small, self-contained change in 3 files (~127 insertions, 10 deletions):

plugin/services/OmarchyMenuSource.qml

  • Watch the language file ($OMARCHY_LANGUAGE_FILE, falling back to ~/.config/omarchy/language) with a FileView.
  • Load $OMARCHY_PATH/default/i18n/<code>/menu.json when it exists, and rebuild the tree when either the language or the catalog changes.
  • Fall back cleanly to English when the file is missing, empty or invalid JSON.

plugin/core/OmarchyMenu.js

  • applyTranslations(items, catalog): replaces label, title and description from the catalog, and keeps the original English label in aliases so English search terms still match after switching language.
  • PROVIDERS["languages"]: built from omarchy-language list. Note that the command emits 3 tab-separated columns (label, code, english), while the provider pipeline expects 4 (label, code, current, english) — the active code comes from omarchy-language (no args). Marking the current entry via isCurrent makes the menu show where you already are.

Example of the actual command output on this machine:

English<TAB>en<TAB>English
Português (Brasil)<TAB>pt-BR<TAB>Portuguese (Brazil)

tests/omarchy-menu.test.js

  • Unit tests for applyTranslations, for English alias retention, and for languages provider enumeration + active-item marking.

Verification

  • node --test tests/*.test.js → 90 pass / 0 fail
  • omarchy plugin validate plugin → exit 0
  • bash -n bin/oma-cast tests/smoke.sh → OK
  • Manually checked with omarchy-shell running, both with an English and a non-English system language.

Happy to paste the diff here as a patch, or open a PR if you prefer — just say which.

Lingua principale
JavaScript
Stelle
560
Fork
93
Merge medio
7g 19h
PR unite (30g)
19

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di typecraft-dev/oma-cast

Tutte le issue di typecraft-dev/oma-cast

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.