| Crates.io | langcodec |
| lib.rs | langcodec |
| version | 0.6.4 |
| created_at | 2025-06-08 18:50:30.299711+00 |
| updated_at | 2025-10-05 08:41:25.704731+00 |
| description | Universal localization file toolkit for Rust. Supports Apple, Android, and CSV formats. |
| homepage | https://github.com/WendellXY/langcodec |
| repository | https://github.com/WendellXY/langcodec |
| max_upload_size | |
| id | 1705168 |
| size | 318,406 |
Universal localization file toolkit for Rust. Parse, write, convert, merge.
.strings, .xcstrings, Android strings.xml, CSV, TSVResource with Entry, Translation::Singular|Plural[dependencies]
langcodec = "0.4.0"
Docs: https://docs.rs/langcodec
use langcodec::{Codec, convert_auto};
// Convert between formats automatically
convert_auto("Localizable.strings", "strings.xml")?;
// Load, inspect, and write
let mut codec = Codec::new();
codec.read_file_by_extension("en.lproj/Localizable.strings", None)?;
codec.write_to_file()?;
# Ok::<(), langcodec::Error>(())
use langcodec::Codec;
let codec = Codec::builder()
.add_file("en.lproj/Localizable.strings")?
.add_file("values/strings.xml")?
.build();
# Ok::<(), langcodec::Error>(())
use langcodec::{Codec, types::{Translation, EntryStatus}};
let mut codec = Codec::new();
codec.add_entry("welcome", "en", Translation::Singular("Hello".into()), None, None)?;
codec.update_translation("welcome", "en", Translation::Singular("Hello!".into()), Some(EntryStatus::Translated))?;
# Ok::<(), langcodec::Error>(())
convert(input, input_format, output, output_format)convert_auto(input, output)infer_format_from_path, infer_language_from_path.xcstrings: plural variations supported via CLDR categoriesstrings.xml: <plurals> supported (one/two/few/many/other/zero)All APIs return langcodec::Error with variants for parse, I/O, validation, conversion.
MIT