文案放进 locales/<模块>.yml,经 crate::i18n 的 t! / tn! 取用;启动时先按设置定语言, 改设置时实时切换并发出 UiLocale。守卫测试检查两种语言齐全、占位一致、没有遗漏和死键。 UI 测试夹具固定中文并隔离本线程的语言。共用件(shared/)先转换。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
23 lines
944 B
Rust
23 lines
944 B
Rust
//! On Windows, the logo is the executables' icon: Explorer and the taskbar
|
|
//! show it, and GPUI gives its windows icon resource 1, which `set_icon`
|
|
//! fills. Other platforms take the icon from their package (`packaging/`).
|
|
|
|
fn main() {
|
|
println!("cargo:rerun-if-changed=build.rs");
|
|
// The text `rust_i18n::i18n!` reads while compiling, which the macro
|
|
// does not tell Cargo about.
|
|
println!("cargo:rerun-if-changed=locales");
|
|
println!("cargo:rerun-if-changed=assets/logo/shellrs.ico");
|
|
#[cfg(windows)]
|
|
if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("windows") {
|
|
let mut resource = winresource::WindowsResource::new();
|
|
resource
|
|
.set_icon("assets/logo/shellrs.ico")
|
|
.set("ProductName", "ShellRS")
|
|
.set("FileDescription", "ShellRS");
|
|
if let Err(error) = resource.compile() {
|
|
panic!("cannot embed the icon: {error}");
|
|
}
|
|
}
|
|
}
|