Hindi Website

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rajoo.sharma
Forum Newbie
Posts: 7
Joined: Sat Nov 14, 2009 4:51 am

Hindi Website

Post by rajoo.sharma »

Hello,

I'm wondering how can I accept input in Hindi from my website's users?
All I know about is:

1. UTF-8 is the solution
2. add the following to the HTML Page:
<meta http-equiv="Content-Language" content="hi">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
3. MySQL database connection collation must be utf8_unicode_ci

If I paste anything from a hindi website like webduniya.com in my page's textbox it displays it correctly.
But I do not know how to get it by typing?

Do I need to use some javascript library?

Kindly suggest to achieve the same.
Regards
User avatar
Apollo
Forum Regular
Posts: 794
Joined: Wed Apr 30, 2008 2:34 am

Re: Hindi Website

Post by Apollo »

rajoo.sharma wrote:But I do not know how to get it by typing?
What do you mean, if you visit your own site you can't manually enter text in Hindi?

Can you do it on other (Hindi) sites?
rajoo.sharma
Forum Newbie
Posts: 7
Joined: Sat Nov 14, 2009 4:51 am

Re: Hindi Website

Post by rajoo.sharma »

yes, thats correct, I do not know how to get the input in Hindi, its basically transliteration I guess. Please check the following website:
http://www.webduniya.com/

and enter something in the search box, u'll see transliteration taking place. This has to be done using some javascript code, it can not be done by default just by specifying the UTF-8 charset.

Please correct me if I am wrong.

Regards
rajoo.sharma
Forum Newbie
Posts: 7
Joined: Sat Nov 14, 2009 4:51 am

Re: Hindi Website

Post by rajoo.sharma »

Just check this website and it will open fine on your PC too. Type something in Search box and u'll see transliteration taking place:
http://www.webduniya.com
They are not using google API:
http://code.google.com/apis/ajaxlanguag ... on/#Single
They are using something else, although using google API could be best, I want to understand the implementation basics first.
User avatar
Apollo
Forum Regular
Posts: 794
Joined: Wed Apr 30, 2008 2:34 am

Re: Hindi Website

Post by Apollo »

Hmm interesting, I've never seen anything like that before 8O

Then again, I don't know squat about writing or translating Hindi, how do you 'normally' type text in Hindi? Do you need a special keyboard? (it is an alphabetical language, right?)
rajoo.sharma
Forum Newbie
Posts: 7
Joined: Sat Nov 14, 2009 4:51 am

Re: Hindi Website

Post by rajoo.sharma »

Generally for this we install hindi font(s), in the word processor select the font and start typing, no need to install anything else.

But UTF-8 is something different, this encoding is supported by almost all the latest browsers including IE6. So the advantage is that there is no need to install additional fonts on client's browser.

Regards
User avatar
Apollo
Forum Regular
Posts: 794
Joined: Wed Apr 30, 2008 2:34 am

Re: Hindi Website

Post by Apollo »

rajoo.sharma wrote:Generally for this we install hindi font(s), in the word processor select the font and start typing, no need to install anything else.
Exactly how do you type? I mean, what keys or letters do you press? (and on what kind of keyboard?)
Do you just press A, B, C etc on an English keyboard, and then in the word processor, अ ब क etc appears?
But UTF-8 is something different, this encoding is supported by almost all the latest browsers including IE6. So the advantage is that there is no need to install additional fonts on client's browser.
I don't think so.. UTF-8 is merely the encoding, which specifies how the characters are stored. No Hindi font = no displaying Hindi characters, regardless of whether how they are stored.
rajoo.sharma
Forum Newbie
Posts: 7
Joined: Sat Nov 14, 2009 4:51 am

Re: Hindi Website

Post by rajoo.sharma »

yes, u said right, but for browsers, it is a javascript toolkit will do this tranliteration like this google API:
http://code.google.com/apis/ajaxlanguag ... on/#Single
User avatar
Vegan
Forum Regular
Posts: 574
Joined: Fri Sep 05, 2008 3:34 pm
Location: Victoria, BC
Contact:

Re: Hindi Website

Post by Vegan »

If you are using the code as above, it should be OK on modern browsers. Make sure the entire site is tagged properly so that any language will display properly.

I have make many documents in many languages other than English and all work fine for me.
Hardcore Games™ Legendary is the Only Way to Play™
My site is powered by LAMP
rajoo.sharma
Forum Newbie
Posts: 7
Joined: Sat Nov 14, 2009 4:51 am

Re: Hindi Website

Post by rajoo.sharma »

I finally used Google transliteration API, I think there is no other solution. Or if somebody is interested, he can develop his own transliteration API.

An implementation can be seen on http://www.greyboxtechnologies.com/dreamland
type something in the search box and when u press spacebar, it will be transliterated. I've used the same thing in the admin panel to enter the data, and it gets stored properly in my MySQL DB. This can be displayed on all modern browsers, no need to download any font, it can also be searched in the database, Zen-Cart's (The open source I used here) default search works fine on it.

I'll be more than happy to help anybody looking for similar implementation.

Regards.
User avatar
Vegan
Forum Regular
Posts: 574
Joined: Fri Sep 05, 2008 3:34 pm
Location: Victoria, BC
Contact:

Re: Hindi Website

Post by Vegan »

I put the word chess on my chess site in a huge basket of languages. I also carefully used HTML lang tags on each so that it would be recognized correctly by a search engine.

I have seen many of the words used on Google Analytics which told me my effort was worth it.

So I believe in the usefulness of correct language designations of all web pages.

And yes I even used Hindi for the great nation of India who I am sure still likes chess.
Hardcore Games™ Legendary is the Only Way to Play™
My site is powered by LAMP
Post Reply