Crates.io | rimloc-core |
lib.rs | rimloc-core |
version | 0.1.0 |
created_at | 2025-09-25 17:57:20.611092+00 |
updated_at | 2025-09-25 17:57:20.611092+00 |
description | Core data types and utilities for RimLoc translation toolkit |
homepage | |
repository | https://github.com/0-danielviktorovich-0/RimLoc |
max_upload_size | |
id | 1854921 |
size | 17,264 |
Core data types and utilities used across the RimLoc toolkit.
Add to Cargo.toml:
[dependencies]
rimloc-core = "0.1.0"
Parse a minimal PO string and work with TransUnit
/PoEntry
:
use rimloc_core::{parse_simple_po, TransUnit};
fn main() -> color_eyre::Result<()> {
// Minimal PO with two entries
let po = r#"
msgid "Hello"
msgstr "Привет"
msgid "Bye"
msgstr "Пока"
"#;
let entries = parse_simple_po(po)?;
assert_eq!(entries.len(), 2);
// Build a TransUnit for downstream exporters
let unit = TransUnit {
key: "Greeting".into(),
source: Some("Hello".into()),
path: "Mods/My/Languages/English/Keyed/A.xml".into(),
line: Some(3),
};
println!("{unit:?}");
Ok(())
}