#katakana #hiragana #japanese #localization

bin+lib to-kana

Converts English phonetics to Kana, And Kana to small/half-width versions

6 releases (breaking)

0.6.0 Sep 16, 2019
0.5.1 Sep 13, 2019
0.4.0 Aug 23, 2019
0.3.0 Aug 16, 2019
0.1.0 Aug 13, 2019

#184 in Internationalization (i18n)

22 downloads per month

MIT/Apache

83KB
2K SLoC

to-kana

Crates.io docs.rs dependency status Crates.io downloads Crates.io downloads of latest version License

GitHub Release Date GitHub commits since latest release

Converts English lettering to Kana. Please see the wiki to get supported inputs.

Basic Usage

As Library

Using to_kana!

Check out docs.rs to get all available formats for to_kana!

use to_kana::to_kana;

// こんにちは、ワールド!
let hello_world = to_kana!("{:H}{:K}", "konnichiha,", "wa-rudo!").unwrap();

// Half-width カタカナ works too!
let half = to_kana!("Half-width {:K/2} works too!", "katakana").unwrap();

The Old Ways

use to_kana::ToKana;

let hello = "konnichiha,".hira().unwrap(); // Works on &str
let world = String::from("wa-rudo!").kata().unwrap(); // And String!

println!("{}{}", hello, world)); // こんにちは、ワールド!
use to_kana::{
    hira, // Hiragana
    kata, // Katakana
};

let hello = hira("konnichiha,").unwrap();
let world = kata("wa-rudo!").unwrap();

println!("{}{}", hello, world); // こんにちは、ワールド!

What if you don't want to just convert to Kana? What if you want to convert to small, half-width Katakana? You can!

use to_kana::{
    ToKana,
    SmallKana,
    HalfWidth,
};

// Not to be confused with "ヤ", "ャ" or "ヤ"
assert_eq!("", "ya".kata().small().half_width().unwrap());

From Command Line

# Install
cargo install to-kana

# Get Help
to-kana -h
to-kana hira -h
to-kana kata -h

# Convert to Hiragana
to-kana hira <STRING>

# Convert to Katakana
to-kana kata <STRING>

# Convert to small, half-width Katakana
to-kana --small kata yo --half

Dependencies

~3.5–5MB
~79K SLoC