forked from autonomys/space-acres
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.rs
31 lines (29 loc) · 1.07 KB
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use fluent_static_codegen::{generate, MessageBundleCodeGenerator};
use std::path::Path;
use std::{env, fs};
fn main() {
let mut generated =
generate("res/translations", MessageBundleCodeGenerator::new("en")).unwrap();
// This is a hack for making sure `NUMBER()` is supported, see https://github.com/projectfluent/fluent-rs/pull/353#issuecomment-2266336661
{
if !generated.contains("; bundle }") {
panic!("Unexpected generated contents: {generated}");
}
generated = generated.replace(
"; bundle }",
// TODO: Should have been `bundle.add_builtins().unwrap();`, but https://github.com/projectfluent/fluent-rs/issues/368
r#"; bundle.add_function("NUMBER", super::number).unwrap(); bundle }"#,
);
}
fs::write(
Path::new(&env::var("OUT_DIR").unwrap()).join("l10n.rs"),
generated,
)
.unwrap();
#[cfg(windows)]
{
let mut res = winres::WindowsResource::new();
res.set_icon("res\\windows\\space-acres.ico");
res.compile().unwrap();
}
}