Javascript library that provides utilities for detecting and transliterating Hiragana <--> Katakana <--> Romaji.
View demo site to see WanaKana in action.
- Clone repository.
- Install all dependencies from
package.json
usingnpm install
. - Run grunt.
- General development
grunt default
or justgrunt
- Open test suite (Mac only)
grunt test
- Deploy
grunt deploy
- Demo
grunt demo
- runs adeploy
then copies html and opens a browser window - Full list of tasks
grunt --help
- General development
// HTML
<textarea id="ime"></textarea>
// Javascript
var input = document.getElementById('ime');
wanakana.bind(input);
// Automatically bind IME functionality to a form textarea or input.
wanakana.bind(element);
// Unbind IME from element.
wanakana.unbind(element);
// Returns false if string contains mixed characters, otherwise true if Hiragana.
wanakana.isHiragana(string);
// Returns false if string contains characters outside of the kana family, otherwise true if Hiragana and/or Katakana.
wanakana.isKana(string);
// Returns false if string contains mixed characters, otherwise true if Katakana.
wanakana.isKatakana(string);
// Convert Katakana or Romaji to Hiragana.
wanakana.toHiragana(string [, options]);
// Convert Romaji to Kana. Lowcase entries output Hiragana, while upcase entries output Katakana.
wanakana.toKana(string [, options]);
// Convert Hiragana or Romaji to Katakana.
wanakana.toKatakana(string [, options]);
// Convert Kana to Romaji.
wanakana.toRomaji(string [, options]);
// Options:
// Many functions take an optional `options` object.
// Here is the default object used for options.
{
useObsoleteKana: false, // Set to true to use obsolete characters, such as ゐ and ゑ.
IMEMode: false // Set to true to handle input from a text input as it is typed.
}
Project sponsored by Tofugu & WaniKani
- Mims H. Wright Author
- James McNamee Contributor
The following are ports created by the community:
- Java (MasterKale/WanaKanaJava)