Ukraine 🇺🇦
A Rust library for transliterating Ukrainian Cyrillic text into Latin-script representations. In the hope that one day the Ukrainian Latin script will be widely adopted and the last remnants of russian aggressive imperialism will be erased from the history of modern Ukraine 💙💛
Support Ukraine
Overview
This Rust crate provides functionality for converting Ukrainian Cyrillic text into various transliteration schemes described on the Ukrainian Latin alphabet page.
Currently supports the following transliteration systems from Ukrainian Cyrillic to Latin:
- Lozynskyi's Abecadło — A historical Ukrainian Latin alphabet proposal
- DSTU 9112:2021 System A and B — Official Ukrainian standard for Cyrillic-Latin transliteration reference
- KMU #55 (2010) — Ukrainian National transliteration system for romanization of geographic names. Resolution of the Cabinet of Ministers of Ukraine reference
This library is implemented in pure Rust with zero dependencies and no regex. All transliteration logic is built from scratch using native Rust string processing for maximum performance and minimal overhead.
Features
- Greeting: Say hello in various forms—formal or casual.
- Ukrainian Transliteration: Convert Ukrainian text from Cyrillic to Latin script.
- Number Conversion: Convert numbers into Ukrainian words.
- Ordinal Number Conversion: Convert integers into Ukrainian ordinal words.
- Date and Time Conversion: Format dates and times according to Ukrainian standards.
- Counting Endings: Properly display singular and plural forms.
- Feminization: Convert masculine forms to feminine forms and vice versa.
- Currency Formatting: Convert numerical currency values into Ukrainian words.
- Name generation: Generate placeholder names for persons, cities, and companies.
- Address Conversion: Convert addresses to Ukrainian standards.
- Phone Number Formatting: Convert phone numbers to Ukrainian standards.
Installation
Add the following line to your Cargo.toml dependencies:
[]
= "2"
Examples
Say "Hello" in Ukrainian
// ukraine = { version = "2", default-features = false, features = ["greeting"] }
use vitayu;
DSTU 9112:2021 System A (ДСТУ 9112:2021)
Cyrillic-Latin transliteration of Ukrainian texts
// ukraine = { version = "2", default-features = false, features = ["dstu9112a"] }
use transliterate_dstu9112a;
DSTU 9112:2021 System B (ДСТУ 9112:2021)
Cyrillic-Latin transliteration of Ukrainian texts
// ukraine = { version = "2", default-features = false, features = ["dstu9112b"] }
use transliterate_dstu9112b;
Transliteration system approved by Cabinet of Ministers resolution #55 (2010 year)
// ukraine = { version = "2", default-features = false, features = ["kmu55"] }
use transliterate_kmu55;
Lozynskyi's abecadło
// ukraine = { version = "2", default-features = false, features = ["lozynsky"] }
use transliterate_lozynsky;
Convert numbers into Ukrainian words
// ukraine = { version = "2", default-features = false, features = ["numbers"] }
use ;
Convert numbers into Ukrainian ordinal words
// ukraine = { version = "2", default-features = false, features = ["numbers"] }
use ;
New in 2.0.0
try_to_ordinal_words returns the ordinal words, or nothing when the number is too
large to name. MAX_ORDINAL is the largest value the converter accepts.
// ukraine = { version = "2", default-features = false, features = ["numbers"] }
use ;
Format dates and times in Ukrainian
// ukraine = { version = "2", default-features = false, features = ["datetime"] }
use ;
use ;
// ukraine = { version = "2", default-features = false, features = ["numbers", "dstu9112a"] }
use to_words;
use transliterate_dstu9112a;
Documentation
The full API documentation is available at docs.rs/ukraine.
Alternative
Alternative crates for supporting DSTU 9112:2021 and KMU 55:2010: the uklatn crate provides a solid regex-based implementation of these transliteration schemes.
Contributing
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
License
Licensed under the
GNU Affero General Public License v3.0 only
(AGPL-3.0-only).
Note for anyone upgrading: versions 1.x were LGPL-3.0-only. The AGPL is stricter, and
its §13 extends the obligation to offer source code to users who interact with a modified
version of this crate over a network. If that does not suit your project, pin ukraine = "1"
or open an issue to discuss.