Code Monkey home page Code Monkey logo

wanakana's Introduction

ワナカナ <-> 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:

wanakana's People

Contributors

mims-huge avatar vietqhoang avatar mimshwright avatar dotfold avatar ale110 avatar matank avatar vladh avatar johnnyshields avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.