SitePoint Sponsor

User Tag List

Results 1 to 9 of 9

Thread: Hindi Website

  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2009
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Hindi Website

    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

  2. #2
    Non-Member
    Join Date
    Oct 2009
    Posts
    1,852
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you need Hindi support on your PC installed

  3. #3
    SitePoint Enthusiast
    Join Date
    Jan 2009
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    UTF-8 fonts already work, as I said copy paste from a hindi website works, it displays it properly, I want a mechanism to get the input from the user.

    Regards

  4. #4
    Non-Member
    Join Date
    Oct 2009
    Posts
    1,852
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You weren't asking about fonts. you were asking about typing
    To let someone to type in particular language, their PC must support this language.
    Isn't it clear enough?

    There are no relation to PHP at all.

  5. #5
    SitePoint Enthusiast
    Join Date
    Jan 2009
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, I agree, there is no relation with PHP. But with UTF-8 the language support is not mandatory. 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/ajaxlang...tation/#Single
    They are using something else, although using google API could be best, I want to understand the implementation basics first..

  6. #6
    SitePoint Zealot
    Join Date
    Oct 2009
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well surely you need a hindi keyboard or something?
    The user would have to have a hindi keyboard - if they do, when they type on the keyboard it will display correctly in your input fields - as Shrapnel_N5 said you've got the right settings on the page and it's not a php problem.

    Are you saying that if a user types an "H" on a querty keyboard, you want to display the letter that corresponds to H in the hindi alphabet?

  7. #7
    SitePoint Enthusiast
    Join Date
    Jan 2009
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

    The transliteration will take care of conversion I believe as it happens at gmail and orkut.

    Type something in Search box and u'll see transliteration taking place:
    http://www.webduniya.com
    But they are not using google API:
    http://code.google.com/apis/ajaxlang...tation/#Single
    They are using something else, although using google API could be best, I want to understand the implementation basics first..

    Regards

  8. #8
    SitePoint Zealot
    Join Date
    Oct 2009
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So if i understand correctly you type on a normal qwerty keyboard and it comes up in hindi?

    Then what you may be able to do is this:

    <input type="text" style="font-family: hindi font;">
    Don't know if you can change the fon't in a text box (haven't tried it) but you can in a text area i know, so if that doesn't work try
    <text area style="font-family: hindi font;"></textarea>

    But then of course the user has to have the hindi fonts installed. You can put a whole load of fall back fonts consisting of all the popular hindi fonts and hopefully the person will have one of them.

    Give it a try and let me know

  9. #9
    SitePoint Enthusiast
    Join Date
    Jan 2009
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •