diff options
Diffstat (limited to 'server/book-export/src/main.rs')
| -rw-r--r-- | server/book-export/src/main.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/server/book-export/src/main.rs b/server/book-export/src/main.rs index 9d3cb5dc..b2731308 100644 --- a/server/book-export/src/main.rs +++ b/server/book-export/src/main.rs @@ -22,10 +22,15 @@ use crate::book_html::render_html_book; use anyhow::Result; use clap::{Parser, ValueEnum}; use hurrycurry_data::{book::book, index::DataIndex}; -use hurrycurry_locale::FALLBACK_LOCALE; +use hurrycurry_locale::Locale; +use std::path::PathBuf; #[derive(Parser)] struct Args { + #[arg(long, default_value = "locale")] + locale_dir: PathBuf, + #[arg(short, long, default_value = "en")] + locale: String, #[arg(short, long)] format: ExportFormat, #[arg(short, long, default_value = "5star")] @@ -52,7 +57,9 @@ fn main() -> Result<()> { println!("{}", serde_json::to_string(&book).unwrap()) } ExportFormat::Html => { - println!("{}", render_html_book(&data, &book, &FALLBACK_LOCALE)); + let mut locale = Locale::load(&args.locale_dir.join(format!("{}.ini", args.locale)))?; + locale.merge(Locale::load(&args.locale_dir.join("en.ini"))?); + println!("{}", render_html_book(&data, &book, &locale)); } } Ok(()) |