-
Notifications
You must be signed in to change notification settings - Fork 27
How to create a locale ?!
Welcome to this guide on how to create locales for LocaleKeyboard.js. There is few steps to make you a true locale creator :D !
Since LocaleKeyboard.js is a generator, you need to generate a version of the lib that you will modify later.. For that we will use Dckuino.js, a project who uses it.
You need to go to the Dckuino.js live version, then enter this DuckyScript on the left Text Area :
STRING !"#$%&'()*+,-./0123456789:;<=>?ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^`_abcdefghijklmnopqrstuvwxyz{|}~ @
You need to click Compile, and then click Download sketch !, now select the sample locale and finally click Start Download !
Save the zip and extract it wherever you are.
Keep in you head that your goal it to make you "Arduino"(Official or clone) write this :
!"#$%&'()*+,-./0123456789:;<=>?ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^`_abcdefghijklmnopqrstuvwxyz{|}~ @
when you upload your code and you plug it in you computer.
I strongly recommend you to test without modifying anything first and removing good chars from the test string.
You need only to modify the _asciimap var and the initAltGr() function in the Keyboard.cpp.
The modification are made on the _asciimap to fit with
the commented char (Example : 0x27, // 0
), and _altGrMap is optional,
you need to use it only if this is needed by you keyMap.
Example : to make '@' you need to do 'AltGR' + '0', so
you add _altGrMap[n] = true;
in function intAltGr(), where
n is the rank of the key (in this case the key is '0' so
n=64).
When you tested all the keymap you made, you can now fork this repository, create a new file named [a-z]_[A-Z].lang (Example : en_US.lang) in lang/ dir and fill it with the _asciimap + initAltGr() section.
Then add you file name without the .lang extension in a new line in lang/localeList file (Example : en_US).
Now you can send a pull request with your new locale :D
Thanks for your contribution !