iuliia
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
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 Wikipedia;
use Schema;
let result = transliterate;
assert_eq!;
Schema names map to PascalCase type names:
use IcaoDoc9303;
use Schema;
let result = transliterate;
assert_eq!;
Transliterate by schema name
Use name based lookup when the schema comes from user input or configuration.
use schemas;
let result = transliterate.unwrap;
assert_eq!;
let result = transliterate.unwrap;
assert_eq!;
Aliases work too:
let result = transliterate.unwrap;
// Same schema as gost_779.
List all available schemas:
for name in schema_names
Handle unknown schemas
match transliterate
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:
Maintainers
Schema tables are generated from source data. After changing schemas or code generation logic, regenerate the Rust modules with:
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