Make your own IME

Previously I wrote about Mr. Hasin Hayder’s jQuery plugin on bangla input script.  All of us by now know, this plugin would allow us to make our “very own” or “private” keyboard-layout for use. Now, the next simple question is “just-how”?

In this post I will try to explain the process.

Step 1: Get the original package from here

Step 2: Make a chart of how to you want to map your keys?

For example, which key you want to use to print ক or খ . According to many existing keyboard layout, ‘j’ is used to print ‘ক’.  You might want to use some other character. Just make a list of all of them.  In my case I will show the example on the letters ট and  ত.

Step 4: Open the zip folder you just downloaded

Step 5: Go to the sub folder \bnKb and open the file test.html

Step 6:  If you try to use the Phonetic layout, then simply type ‘t’ and notice what it prints. As the letter ‘t’ sounds, it prints ‘ট’. Now, suppose, I don’t like the idea. I want ‘t’ to print ‘ত’ and ‘T’ to print ‘ট’. How you do that?

Step 7:  Open the file driver.phonetic.js with any text editor, (gedit/notepad/vi)

After the copyright note part, you can see

/**
var phonetic = {
    keymaps: {
... ... ... ... ... ...
... ... ... ... ... ...
... ... ... ... ... ...
       't': '\u099F',
... ... ... ... ... ...
... ... ... ... ... ...
... ... ... ... ... ...
        'T':'\u09A4',
    },
};

As you can see, letters ‘t’ and ‘T’ are manually assigned to 2 specific unicode character code for the bengali letter ‘ত’ (\u09A4) and ‘ট’ (\u099F) . Since I want, T=’ট’ and t=’ত’ i will simply alter the values.

/**
var phonetic = {
    keymaps: {
... ... ... ... ... ...
... ... ... ... ... ...
... ... ... ... ... ...
't':'\u09A4',
... ... ... ... ... ...
... ... ... ... ... ...
... ... ... ... ... ...
        'T':'\u099F',
    },
};

Step 7: Save the file and refresh test.html in a browser. You can check it here (live).
Step 8: Try letter T and t.

Alteration done. I am happy.

The full list of all unicode characters are available from here.

This same engine can be modified for any language as long as you have their unicode character list.

So, making your own keyboard mapping is not so tough, yet people claims patent for this.

One Reply to “Make your own IME”

  1. Great work! Well done. I was just looking for this. Will try to implement it today and will also put a translated version on my blog with a link to this source page.

    Thanks again and keep it up.

Comments are closed.