From 6e0d38bc121da76ab4e642a6fd5a3cdec5e287e0 Mon Sep 17 00:00:00 2001 From: Ming Xie Date: Wed, 9 Sep 2026 11:50:27 -0400 Subject: [PATCH] fix(i18n): track the locale catalogs as build inputs --- crates/openlogi-agent/build.rs | 6 ++++++ crates/openlogi-desktop/build.rs | 6 ++++++ crates/openlogi-overlay/build.rs | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/crates/openlogi-agent/build.rs b/crates/openlogi-agent/build.rs index 5fe02f802..67eaf4e2f 100644 --- a/crates/openlogi-agent/build.rs +++ b/crates/openlogi-agent/build.rs @@ -16,6 +16,12 @@ use std::path::PathBuf; use std::{env, fs}; fn main() { + // `rust_i18n::i18n!` in `main.rs` reads `../openlogi-ui/locales` at macro + // expansion time, and Cargo does not track a proc macro's file reads. Without + // this, editing a catalog leaves the embedded translations stale until an + // unrelated change happens to recompile this crate. + println!("cargo:rerun-if-changed=../openlogi-ui/locales"); + if env::var("CARGO_CFG_TARGET_OS").as_deref() != Ok("windows") { return; } diff --git a/crates/openlogi-desktop/build.rs b/crates/openlogi-desktop/build.rs index 05e1837ec..5ef273ca6 100644 --- a/crates/openlogi-desktop/build.rs +++ b/crates/openlogi-desktop/build.rs @@ -25,6 +25,12 @@ fn main() { println!("cargo:rerun-if-env-changed=OPENLOGI_UPDATE_MANIFEST_URL"); println!("cargo:rerun-if-env-changed=OPENLOGI_THEMES_DIR"); + // `rust_i18n::i18n!` in `main.rs` reads `../openlogi-ui/locales` at macro + // expansion time, and Cargo does not track a proc macro's file reads. Without + // this, editing a catalog leaves the embedded translations stale until an + // unrelated change happens to recompile this crate. + println!("cargo:rerun-if-changed=../openlogi-ui/locales"); + embed_windows_resources(); let out = PathBuf::from(env::var("OUT_DIR").expect("OUT_DIR")); diff --git a/crates/openlogi-overlay/build.rs b/crates/openlogi-overlay/build.rs index 0aa332c3e..6b3e84dda 100644 --- a/crates/openlogi-overlay/build.rs +++ b/crates/openlogi-overlay/build.rs @@ -17,6 +17,12 @@ use std::path::PathBuf; use std::{env, fs}; fn main() { + // `rust_i18n::i18n!` in `main.rs` reads `../openlogi-ui/locales` at macro + // expansion time, and Cargo does not track a proc macro's file reads. Without + // this, editing a catalog leaves the embedded translations stale until an + // unrelated change happens to recompile this crate. + println!("cargo:rerun-if-changed=../openlogi-ui/locales"); + if env::var("CARGO_CFG_TARGET_OS").as_deref() != Ok("windows") { return; }