Skip to content
forked from WaniKani/WanaKana

Javascript library for detecting and transliterating Hiragana <--> Katakana <--> Romaji

License

Notifications You must be signed in to change notification settings

ak1394/WanaKana

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ワナカナ <-> WanaKana <-> わなかな

Javascript library that provides utilities for detecting and transliterating Hiragana <--> Katakana <--> Romaji.

View demo site to see WanaKana in action.

Build using Grunt

  • Clone repository.
  • Install all dependencies from package.json using npm install.
  • Run grunt.
    • General development grunt default or just grunt
    • Open test suite (Mac only) grunt test
    • Deploy grunt deploy
    • Demo grunt demo - runs a deploy then copies html and opens a browser window
    • Full list of tasks grunt --help

Usage

HTML

<textarea id="ime"></textarea>

Javascript

var input = document.getElementById('ime');
wanakana.bind(input);

Documentation

// 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.
}

Credits

Project sponsored by Tofugu & WaniKani

Contributors

Ports

The following are ports created by the community:

About

Javascript library for detecting and transliterating Hiragana <--> Katakana <--> Romaji

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 65.8%
  • CoffeeScript 28.1%
  • HTML 6.1%