1//! Writing to MO files.
2
3mod mo_file_writer;
4
5pub use mo_file_writer::write;
6
7use crate::po_file;
8use crate::po_file::POParseOptions;
9use std::error::Error;
10use std::path::Path;
11
12/// Compile a `.po` file to a `.mo` file.
13pub fn compile_from_po(input_path: &Path, output_path: &Path) -> Result<(), Box<dyn Error>> {
14 let parse_options: POParseOptions = POParseOptions {
15 message_body_only: true,
16 translated_only: true,
17 unsafe_utf8_decode: false,
18 };
19 let catalog: Catalog = po_file::parse_with_option(input_path, &parse_options)?;
20 write(&catalog, output_path)?;
21 Ok(())
22}
23