catalog_runtime/
catalog_runtime.rs1use pofile::{
2 compile_catalog, generate_message_id, Catalog, CatalogEntry, CatalogTranslation,
3 CompileCatalogOptions, MessageValue, MessageValues,
4};
5
6fn main() {
7 let catalog = Catalog::from([(
8 "Hello {name}!".to_owned(),
9 CatalogEntry {
10 translation: Some(CatalogTranslation::Singular("Hallo {name}!".to_owned())),
11 ..CatalogEntry::default()
12 },
13 )]);
14
15 let compiled = compile_catalog(&catalog, &CompileCatalogOptions::new("de"))
16 .expect("catalog should compile");
17 let key = generate_message_id("Hello {name}!", None);
18 let values = MessageValues::from([("name".to_owned(), MessageValue::from("Sebastian"))]);
19
20 println!("{}", compiled.format(&key, &values));
21}