Skip to content

fix(i18n): track the locale catalogs as build inputs - #1327

Open
zmingxie wants to merge 1 commit into
AprilNEA:masterfrom
zmingxie:fix/track-locale-catalogs-as-build-inputs
Open

zmingxie wants to merge 1 commit into
AprilNEA:masterfrom
zmingxie:fix/track-locale-catalogs-as-build-inputs

Conversation

@zmingxie

@zmingxie zmingxie commented Sep 9, 2026

Copy link
Copy Markdown

Summary

  • rust_i18n::i18n!("../openlogi-ui/locales", …) reads the catalogs at macro-expansion time, and Cargo does not track a proc macro's file reads. No build script declared them as inputs, so editing a translation did not rebuild the binaries that embed it — the stale catalog stayed compiled in until something unrelated recompiled the crate.
  • Worth noting the consequence for the i18n gate: the_shared_catalog_is_wired_up in the overlay and agent, which .claude/rules/i18n.md names as the check that a catalog is wired up, can pass against a stale catalog. So that gate is not currently load-bearing.

Changes

  • openlogi-desktop, openlogi-agent, openlogi-overlay — each build.rs now emits cargo:rerun-if-changed=../openlogi-ui/locales. In the agent and overlay the directive has to precede the non-Windows early return, or it is never emitted on the platforms that actually build those binaries.

Testing

Before, on b6634915:

$ cargo build -p openlogi-desktop          # warm the build
$ touch crates/openlogi-ui/locales/en.toml
$ cargo build -p openlogi-desktop
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.03s

No recompile, so the embedded catalog kept the old strings. After this change the same sequence gives:

   Compiling openlogi-desktop v0.8.3 (/Users/mxie/dev/OpenLogi/crates/openlogi-desktop)

Verified the same way for openlogi-overlay and openlogi-agent — both of which need the pre-guard placement to work off Windows.

Found while building a locale change for #1116: cargo xtask ci was green and the bundle built, yet the GUI binary still contained the pre-edit string.

cargo xtask ci on macOS/aarch64: 9 passed, 0 failed. Not run on this host and not claimed green — shell (needs shellcheck/shfmt), tests (linux) (Linux-only), cargo-deny (not installed; no dependency change here).

@zmingxie
zmingxie requested a review from AprilNEA as a code owner September 9, 2026 15:52
@greptile-apps

greptile-apps Bot commented Sep 9, 2026

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

The PR appears safe to merge with no outstanding correctness or repository-rule issues.

Summary

This PR ensures binaries embedding translations are rebuilt whenever the shared locale catalogs change.

  • Adds the shared locale directory as a Cargo build input for the agent, desktop, and overlay crates.
  • Emits the directive before platform-specific early returns so non-Windows builds also track catalog changes.
  • Covers every binary currently invoking rust_i18n::i18n! against the shared catalog.

Reviews (3) · Last reviewed commit: "fix(i18n): track the locale catalogs as ..."

@davidbudnick davidbudnick added type: bug Something is broken or behaves incorrectly platform: all Cross-platform issue labels Sep 9, 2026
@zmingxie
zmingxie force-pushed the fix/track-locale-catalogs-as-build-inputs branch from 1fe1774 to 557fa77 Compare September 15, 2026 22:30
@zmingxie
zmingxie force-pushed the fix/track-locale-catalogs-as-build-inputs branch from 557fa77 to 6e0d38b Compare September 17, 2026 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

platform: all Cross-platform issue type: bug Something is broken or behaves incorrectly

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants