ukraine 1.0.5

Glory to Ukraine. Library for transliterating Ukrainian Cyrillic text into Latin script representation
Documentation

Ukraine 🇺🇦

Crates.io Documentation License: LGPL-3.0-only Build

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

United24

Overview

This Rust crate provides functionality for converting Ukrainian Cyrillic text into various transliteration schemes described on the Ukrainian Latin alphabet page.

⭐️ This project is in an early stage of development; the goal is to draw attention to the implementation of the Ukrainian Latin alphabet and provide a technical solution for it. ⭐️

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: Conversion for ordinal numbers (e.g., "1st" to "перший")
  • 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:

[dependencies]
ukraine = "1"

Examples

// This example shows how to say "Hi" in Ukrainian.
//
// ukraine = { version = "1", default-features = false, features = ["greeting"] }

use ukraine::greeting::vitayu;

fn main() {
    println!("{}", vitayu()); // Вітаю
}
// Lozynskyi's abecadło
// https://en.wikipedia.org/wiki/Abecad%C5%82o
//
// ukraine = { version = "1", default-features = false, features = ["lozynsky"] }

use ukraine::latin::transliterate_lozynsky;

fn main() {
    assert_eq!(transliterate_lozynsky("❤️ Україна"), "❤️ Ukrajina");
}
// Convert numbers into Ukrainian words.
//
// ukraine = { version = "1", default-features = false, features = ["numbers"] }

use ukraine::numbers::to_words;

fn main() {
    assert_eq!(
        to_words(12_345_678),
        "дванадцять мільйонів триста сорок п'ять тисяч шістсот сімдесят вісім"
    );
}

Documentation

The full API documentation is available at docs.rs/ukraine.

Alternative

If you need transliteration based on official Ukrainian standards like DSTU 9112:2021 or KMU 55:2010, the uklatn crate provides a solid regex-based implementation of these government-approved transliteration schemes.

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.