Converts keyboard layouts, when user forgot to change it.
var ru = require('convert-layout/ru');
bankcardName.keyup(function () {
bankcardName.value = ru.toEn(bankcardName.value);
});
There are 2 ways to load layout. If you need only one layout, just load file directly:
var ru = require('convert-layout/ru');
Also you can get objects with all layouts:
var layouts = require('convert-layout');
layout = layouts[name];
Every layout has fromEn
and toEn
methods:
ru.toEn('руддщ') //=> "hello"
ru.fromEn('ghbdtn') //=> "привет"
Supported keyboard layouts:
- Belarusian
- English QWERTY
- German
- Kazakh
- Russian
- Ukrainian
If you want to add new keyboard layout:
- Fork a project. Create a branch.
- Add
CODE.js
file with layout buttons map. See example inru.js
. Lower case letters will be converted to upper case automatically. But all non-letters symbol should be added in both cases. - Add
CODE
key toindex.js
. - Add layout to list above.
- Send a pull request.