2016-10-27 00:50:06 +02:00
|
|
|
extern crate crowbook_intl;
|
|
|
|
use crowbook_intl::{Localizer, Extractor};
|
2016-10-07 20:47:21 +02:00
|
|
|
|
2016-10-26 15:35:10 +02:00
|
|
|
use std::path::Path;
|
2016-10-26 16:11:09 +02:00
|
|
|
use std::env;
|
|
|
|
|
2016-10-26 15:35:10 +02:00
|
|
|
|
2016-10-07 20:47:21 +02:00
|
|
|
fn main() {
|
2016-10-26 16:11:09 +02:00
|
|
|
// println!("cargo:rerun-if-changed=build.rs");
|
|
|
|
// println!("cargo:rerun-if-changed=lang/fr.po");
|
2016-10-09 02:45:19 +02:00
|
|
|
let mut extractor = Extractor::new();
|
|
|
|
extractor.add_messages_from_dir(concat!(env!("CARGO_MANIFEST_DIR"), "/src")).unwrap();
|
|
|
|
extractor.write_pot_file(concat!(env!("CARGO_MANIFEST_DIR"), "/lang/crowbook.pot")).unwrap();
|
2016-10-14 03:48:57 +02:00
|
|
|
|
|
|
|
let mut localizer = Localizer::new(&extractor);
|
|
|
|
localizer.add_lang("fr", include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/lang/fr.po"))).unwrap();
|
2016-11-11 15:31:36 +01:00
|
|
|
let dest_path = Path::new(&env::var("OUT_DIR").unwrap())
|
|
|
|
.join("localize_macros.rs");
|
|
|
|
localizer.write_macro_file(dest_path).unwrap();
|
2016-10-07 20:47:21 +02:00
|
|
|
}
|