Skip to content

Load translation catalogs before their first lookup - #16059

Merged
dhh merged 1 commit into
omacom:quattrofrom
zihaomu:fix/16030-initial-translations
Oct 21, 2026
Merged

dhh merged 1 commit into
omacom:quattrofrom
zihaomu:fix/16030-initial-translations

Conversation

@zihaomu

@zihaomu zihaomu commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

I18n.t() and tn() currently read dictionaries initialized to empty objects. FileView.onLoaded populates them later, so the first binding can return a raw catalog key. Calling .arg() on that key emits the reported QString::arg: Argument missing warnings. The plugin Translations component has the same initialization race.

Bind the selected language, locale settings, and translation maps directly to FileView.text(). This makes the existing blocking-read setting apply to the first lookup and keeps subsequent file changes reactive. Catalog parsing runs when the file data changes. Remove the asynchronous map assignments; preserve translation lookup, plural selection, regional/base/English fallback, and live language changes.

Fixes #16030.

Validation

  • Added 18 headless Quickshell regression scenarios for first-binding values, plurals, locale metadata, RTL digits/direction, fallbacks, missing/malformed catalogs, live language and directory changes, edits, deletion/recreation, and registry changes. The original code fails the first-binding regression with raw shell and plugin keys.
  • Passed I18N_STRUCTURAL=1 bash test/shell.d/i18n-test.sh (the pending-translation completeness check is skipped in structural mode), qml-text-format-test.sh, Bash syntax validation, and git diff --check.
  • Native before/after check on Ryzen AI Max+ PRO 395 / Radeon 8060S, Quickshell 0.3.2, Qt 6.12.0, using the real repository catalogs: baseline English produces four formatting warnings and initially returns raw keys; patched English and Simplified Chinese return correct first values with zero formatting warnings or binding-loop/JavaScript errors.
  • Inspected English and Chinese text rendered by an isolated offscreen Qt window. Full-shell graphical acceptance in a disposable VM was not run. The active desktop configuration and packages were unchanged.

@greptile-apps

greptile-apps Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Makes shell and plugin translations read catalogs through FileView.text() bindings before their first lookup.

  • Shell and plugin translations load before their first lookup.

No actionable issues were found. Quickshell is not installed in this review environment, so the runtime scenarios were not rerun.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Watched language file] --> B[Selected language]
  B --> C[Catalog paths]
  D[Watched catalogs] --> E["FileView.text()"]
  C --> E
  E --> F[Parsed translation maps]
  F --> G["t() and tn()"]
  H[Watched locale registry] --> I[Locale settings]
  B --> I
  I --> J[Number format and text direction]
Loading

Reviews (1) · Last reviewed commit: "Load translation catalogs before their f..." · Reviewed by Greptile

@omarchybot omarchybot added bug Something isn't working verified Omarchy Triage has verified that this issue is ready for final review labels Oct 21, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at 4fe3a6f and found nothing to change. Nothing was pushed to the branch.

The bug is real and this fixes it. I booted the full shell on a disposable worker built from the Omarchy ISO (Quickshell 0.3.2), once with shell/Commons/I18n.qml and Translations.qml from the merge base and once at this head. On the base files the journal had 27 QString::arg: Argument missing warnings at startup, each naming a raw key such as dock.noAppsMatch, common.uninstallConfirm or notifications.snoozeFor. At this head it had none, and no QML errors either. The verdict rests on that reproduction, not just on the test in this PR.

Tests, run on the same worker:

  • test/shell.d/i18n-startup-test.sh passes 18/18 at this head. With only the two Commons files reverted, it fails on the first lookup with raw test.hello and test.items, so it tests the fix and not just that the change is present.
  • indicator-contract, qml-text-format, bar-startup-budget, shell-idle-spawn, agents-panel, clock, image-picker, power and remote-session all pass.
  • i18n-test.sh fails on da/menu.json mirrors the English catalog (system.reboot-boot-menu). It fails the same way on the base code. It comes from the catalogs, not this change, and Drop the Reboot to Boot Menu translations left behind by its removal #16152 removes that key.
  • I did not run the whole shell suite or the graphical acceptance suite.

Code read: removing the languageCatalogFile and registryFile ids is safe, because the bindings resolve those names through the root's FileView properties. Nothing in shell/ or test/ writes to the properties that are now readonly, or calls the removed setLanguage, rebuildStrings or applyRegistry. Menu.qml has its own setLanguage for its own state and is unaffected. The change is proportionate: it replaces the asynchronous onLoaded assignments with bindings over FileView.text(), which is what makes blockLoading take effect on the first read, and it removes more code than it adds.

Second opinion: Codex Medium reviewed the diff read-only and found no defects. It agreed that text() takes part in binding dependency tracking, that blockLoading blocks the first read, that a failed load or an empty path clears the data (so dropping the old onLoadFailed/onPathChanged handlers leaves nothing stale) and that there is no binding cycle. That is agreement with my reading, and its independence is not guaranteed. The worker runs above are what settled those points.

Fixes #16030. Labelled bug and verified. This now waits on the maintainer.

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

Labels

bug Something isn't working verified Omarchy Triage has verified that this issue is ready for final review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shell logs 'QString::arg: Argument missing' at startup: I18n.t() returns raw keys before catalogs load

4 participants