use std::fs;
use std::path::Path;
use std::env;

fn main() {
    let out_dir = env::var("OUT_DIR").unwrap();
    let dest_path = Path::new(&out_dir).join("translations.rs");

    let translations = rust_shared::i18n::build_utils::extract_translations_from_source("src");
    
    let mut code = String::from("// Auto-generated translation keys\n\n");
    code.push_str("use rust_shared::i18n::{Uniq, Language};\n\n");
    code.push_str(&rust_shared::i18n::build_utils::generate_translation_keys_code(&translations));
    
    fs::write(&dest_path, code).unwrap();
    
    println!("cargo:rerun-if-changed=src/");
} 