var input = document.getElementById('ime');
wanakana.bind(input);
Additional functions
nihongonotesuto
wanakana.toRomaji(str);
トフグのすし
wanakana.toKana(str);
あめりか
wanakana.toHiragana(str);
ワニカニ
wanakana.toKatakana(str);
Documentation
View the extended
API including extra conversion and checking methods.
Quick Usage
Function | Usage |
---|---|
wanakana.bind( element ) | Automatically bind IME (toKana) functionality to a form textarea or input. |
wanakana.unbind( element ) | Unbind IME from element. |
wanakana.isKana( string ) | Returns true if string contains only Hiragana and/or Katakana. |
wanakana.isHiragana( string ) | Returns false if string contains mixed characters, otherwise true if Hiragana. |
wanakana.isKatakana( string ) | Returns false if string contains mixed characters, otherwise true if Katakana. |
wanakana.toKana( string ) | Convert Romaji to Kana. outputs Hiragana by default; uppercase text outputs Katakana. |
wanakana.toHiragana( string ) | Convert Katakana or Romaji to Hiragana. |
wanakana.toKatakana( string ) | Convert Hiragana or Romaji to Katakana. |
wanakana.toRomaji( string ) | Convert Kana to Romaji. |
wanakana.stripOkurigana( string ) | Remove trailing kana. |
wanakana.tokenize( string ) | Split text into language/kana tokens. |
options = {
IMEMode: false, useObsoleteKana: false passRomaji: false, upcaseKatakana: false, convertLongVowelMark: true, customKanaMapping: {}, customRomajiMapping: {} } |
IMEMode: Set true, 'toHiragana', or 'toKatakana' to convert input from a text input as it is typed. useObsoleteKana: Set true to use obsolete characters, such as ゐ and ゑ passRomaji: Pass through romaji when using toKatakana() or toHiragana() upcaseKatakana: Convert katakana to uppercase when using toRomaji() convertLongVowelMark: Convert 'ー' (e.g. スー to すう) with toHiragana() customKanaMapping: custom map to be merged with default in toKana() customRomajiMapping: custom map to be merged with default in toRomaji() |
Community Library Ports
Language | Library Name |
---|---|
Python | WanaKanaPython |
Java | WanaKanaJava |
Rust | WanaKanaRust |
Swift | WanaKanaSwift |
Kotlin | WanaKanaKotlin |
C# | WanaKanaShaapu |