Categories
General

Bangla Input Script as jQuery Plugin

Ekushey.org

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
<textarea class=’bangla’></textarea>

2. Initiate the plugin in document.ready event 🙂 That’s also pretty simple
[source language=”javascript”]
$(document).ready(function(){
$(".bangla").bnKb({
‘switchkey’: {"webkit":"k","mozilla":"y","safari":"k","chrome":"k","msie":"y"},
‘driver’: phonetic
});
});
[/source]
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.

My utmost gratitude to Omi Azad and Manchu Mahara for their continuous support. I hope you will enjoy this improved version of Bangla Input Script. God Bless!

Download this new package and demo files from the following URL

Download: BnKb jQuery Plugin with Phonetic and Probhat Driver

31 replies on “Bangla Input Script as jQuery Plugin”

🙂 Sure – see the source of probhat driver, change the mapping and create a *joy driver. Should be pretty easy, eh?

Now I would suggest you to leave *joy where they are. Why do you have to use that anyway?

No doubt its another GreatHasin Haider Presentation. 🙂
but specially like this quotes 😀

“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. ”
Hats Off 🙂

Vaiya,
I will mail you more updates like jatiya layout mapping file 🙂
btw, I made some changes on banglakb for wordpress
1. reduce the codes using jquery
2. no need to add the kb in comment form by editing file, can be inject after comment box automaticaly using jquery as wordprss by default use jquery or max theme uses jquery.
3. will send the updates asap.

গুগল ক্রোমে cntrl + y অর্থাৎ শর্টকাট কী টা কাজ করছে না। 🙁

প্রভাত লেআউটে Arrow Key, Home, End, Del কী গুলাতে চাপলে বিভিন্ন অনাকাঙ্খিত সব অক্ষর আসে।

ভাইয়া, অসাধারন কাজটির জন্য ধন্যবাদ।

আমি যে পেইজটি বানাতে চাই তার ৯৫% ইউজারই বিজয় ফন্ট/ম্যাপিং এ টাইপে অভ্যস্ত। কাজেই আমার পেইজে বিজয় কিবোর্ড থাকতেই হবে। আপনার কাছে কি driver.probhat.js এর মতো driver.bijoy.js পেইজ আছে যেটা আমাকে দয়া করে দিতে পারেন। আমি আপনার দেয়া জাভাস্ক্রিপ্ট পেইজের keymaps কোডিং এ বিজয় অনুসারে কোড বসিয়ে নিতে জানি না বিধায় আপনার সরনাপন্ন হলাম।

সম্ভব হলে সাহায্য করবেন। আপনাকে অগ্রীম ধন্যবাদ।

Well , the view of the passage is totally correct ,your details is really reasonable and you guy give us valuable informative post, I totally agree the standpoint of upstairs. I often surfing on this forum when I m free and I find there are so much good information we can learn in this forum!
..http://www.ipolos.com ..
,’,”,.╱◥██◣”o’,”’,,’,.”.”,,’,.welcome to come|田|田田│ ”,,’,.’,”’,,’,.”╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬

Thanks Boss, Its working nice.

But i stored it in oracle database and now want to show from database
can you help me about this matter ?

Thanks
Mehedi.

Hello I’m using this plugins and it working very well, I just have one major problem with it, I’m using it in a CMS system that using ajax everywhere on the site and I use this mode on all text area on the page once any ajax call on the page the text area goes back to english

I use ”

$(document).ready(function(){
$(“textarea”).bnKb({
‘switchkey’: {“webkit”:”k”,”mozilla”:”y”,”safari”:”k”,”chrome”:”k”,”msie”:”y”},
‘driver’: phonetic
});

});


do I do something wrong, Thanks

Leave a Reply to Zia Cancel reply

Your email address will not be published. Required fields are marked *