iuliia 0.1.0

Transliterate Cyrillic to Latin in every possible way
Documentation
  • Coverage
  • 94.29%
    66 out of 70 items documented0 out of 38 items with examples
  • Size
  • Source code size: 102.75 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.17 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 5s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • ahanoff/iuliia-rs
    2 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • ahanoff

iuliia

Rust crates.io docs.rs

Transliterate Cyrillic to Latin in every possible way.

iuliia is a Rust port of the excellent Python library iuliia by @nalgeon. It supports standardized transliteration schemas used for international passports, visas, green cards, driving licenses, mail, goods delivery, maps, and other text processing tasks.

The crate has zero dependencies. Schema data is code generated, so typed schema calls compile down to plain Rust code. It is also compatible with wasm32-unknown-unknown, which makes it a good fit for browser, worker, and embedded WASM use cases. The public API uses String, so the crate targets std rather than no_std.

Installation

cargo add iuliia

Usage

Transliterate by schema type

Use a generated schema type when the schema is known at compile time. This path is monomorphized and avoids name lookup.

use iuliia::schemas::wikipedia::Wikipedia;
use iuliia::Schema;

let result = Wikipedia::transliterate("Юлия Щеглова");
assert_eq!(result, "Yuliya Shcheglova");

Schema names map to PascalCase type names:

use iuliia::schemas::icao_doc_9303::IcaoDoc9303;
use iuliia::Schema;

let result = IcaoDoc9303::transliterate("Москва");
assert_eq!(result, "Moskva");

Transliterate by schema name

Use name based lookup when the schema comes from user input or configuration.

use iuliia::schemas;

let result = schemas::transliterate("Юлия Щеглова", "wikipedia").unwrap();
assert_eq!(result, "Yuliya Shcheglova");

let result = iuliia::transliterate("Санкт-Петербург", "bgn_pcgn").unwrap();
assert_eq!(result, "Sankt-Peterburg");

Aliases work too:

let result = iuliia::transliterate("Юлия", "iso_9_1995").unwrap();
// Same schema as gost_779.

List all available schemas:

for name in iuliia::schemas::schema_names() {
    println!("{name}");
}

Handle unknown schemas

match iuliia::transliterate("Юлия", "unknown_schema") {
    Ok(result) => println!("{result}"),
    Err(err) => eprintln!("{err}"), // unknown schema: unknown_schema
}

Available schemas

Schema Notes
ala_lc
ala_lc_alt
bgn_pcgn
bgn_pcgn_alt
bs_2979
bs_2979_alt
gost_16876
gost_16876_alt
gost_52290
gost_52535
gost_7034
gost_779 Alias: iso_9_1995
gost_779_alt
icao_doc_9303
iso_9_1954
iso_9_1968
iso_9_1968_alt
mosmetro
mvd_310
mvd_310_fr
mvd_782
scientific
telegram
ungegn_1987
wikipedia
yandex_maps
yandex_money

WASM support

iuliia has no external dependencies and compiles for wasm32-unknown-unknown:

cargo build -p iuliia --target wasm32-unknown-unknown

Maintainers

Schema tables are generated from source data. After changing schemas or code generation logic, regenerate the Rust modules with:

cargo run -p iuliia-codegen

Contributing

Issues and pull requests are welcome. Please keep changes focused, add tests for behavior changes, and run the crate checks before opening a pull request.

License

MIT