I wrote the first version of this script on 26th July, 2006. Since then, It is being used in almost every Bangla websites and applications which provides support to write Bangla in Internet. From the very beginning Omi Azad from Ekushey Team helped me to improve this script by debugging and testing. Manchu Mahara also fixed some bugs on formation of conjunctions and specially on Dirgho-I kar and Dirgho-U kar. Manchu also wrote a script which is able to parse keystrokes in probhat layout.
The main problem of that script is that it was a container for both the dictionary table and the engine itself. So when someone was going to provide support for multiple layouts together, there was unnecessary inclusion of scripts. And there were also some minor bugs which needed to be fixed, for example hard coded switch key which helped to swicth writing mode from Bangla to English and vice versa. There were also lack of support for copy-paste (Ctrl+C and Ctrl+V) in Mac OS.
So I decided to rewrite the complete engine as a jQuery plugin. Now the engine is totally separate from the dictionary table. It provides flexible overriding of switch key by user’s choice. Default switch key is Ctrl+E (Command+E in Mac). Now anyone can develop their own layout just by writing the dictionary table.
The package contains four files. One is engine.js which is the main parser script, and is a jQuery plugin itself. The other two are dictionary files whcih we will call as “Driver”. These two drivers are driver.phonetic.js (For phonetic layout) and driver.probhat.js (For probhat layout). White writing drivers you can use the intellisense feature and hook the default execution process in the engine and process any key-strokes separately as you wish.
How to use this script
1. Give all your “Input” elements a class name “bangla” – for example
<input type=’text’ class=’bangla’ /> or
2. Initiate the plugin in document.ready event 🙂 That’s also pretty simple
You can also check the included test.html file to get a better idea on how to swith from one layout to another easily. I have excluded driver.unijoy.js because I HATE ALL FUCKING *JOY layouts or their Derivatives. However it would be very easy to write a driver for unijoy if you want that.
When we help our children to learn writing Bangla, we always do that with pride. Because they are learning and writing in our own language. And thats why I BELIEVE KEYBOARD LAYOUTS or WRITING STYLES cannot be ANY FUCKING PROPERTY to any MO-FO. This should be free forever, free as in freedom – free as in beer.
Download this new package and demo files from the following URL