Easy Multilingual (English & Tamil) Website creation using php

This article will help you to learn how multi lingual web sites can be done by your own. This is a try by testing with 2 languages (English & Tamil). This may useful for web developers for creating multi language web sites.

Ok, let we start..,

It’s very simple work, by fetching data from 2 different databases. In these 2 databases, one will holds data about Tamil (or any language) and another will holds English. Once, Tamil language is clicked, data from Tamil (or any language) database will fetched and if English language is clicked, data from English database will fetched. So, you need to know 2 things very clearly,

1)     How to handle 2 different databases in a project? and

2)     How to insert Tamil language (or any language) into DB?

Ok let we see the answers for above questions,

1) How to handle 2 databases in a project? (This is my logic; you can use by your own, if u has any method to call databases)

<?php

session_start();

ob_start();

if(isset($_REQUEST['ta']))

{

$sess = $_REQUEST['ta']; //Tamil language

$_SESSION['ta']=$sess;

$database = ‘multitamil’;

}

else if(isset($_REQUEST['en']))

{

unset($_SESSION['ta']);

$sess = $_REQUEST['en']; //English language

$_SESSION['en']=$sess;

$database = ‘multienglish’;

}

mysql_connect(“localhost”,”root”,”") or die(‘Server down for maintenence, please try again later’);

mysql_select_db($database);

?>

In above code, if once Tamil language (or any language) link clicked, pass the variable to the same page as ‘ta’ ie., ($_REQUEST['ta']) , like below,

www.youdomain.com/?ta

Once ‘ta’ is set, unset `en` session and set the session as ta. Once ‘ta’ set, database for Tamil language will be called. Tamil language Database will be active till session expired.

If, English language is clicked; pass the variable to the same page as ‘en’ i.e. ($_REQUEST['en']) , like below,

www.youdomain.com/?en

Once ‘en’ is set, unset ‘ta’ session and set the session as en. Once ‘en’ set, database for English language will be called.

Note: Default language is English.

2)  How to insert Tamil language (or any language) into DB?

If Tamil (or any language) language want to insert into DB means it will store as bulk Unicode characters. So, type Tamil language (or any language) using text box or comment box etc. and submit the form, like given below example,

<form id=”form1″ method=”post” action=”<?php $_SERVER['PHP_SELF'];?>”>

<textarea name=”language”></textarea>

<input name=”submit” type=”submit” />

</form>

Store the content in Tamil (any) Language database by using insert query. You didn’t need to worry about Unicode conversion, it will automatically converted by browsers while submission. See the link for Unicode chart supported by browsers by clicking here .

tamil textbox Easy Multilingual (English & Tamil) Website creation using php

Or use Google transliteration tool for typing (Click here). Note: Once typed, copy it and paste it in text box and submit the form. Write insert query to store in Tamil database (or any of your language database).

tamil google tool Easy Multilingual (English & Tamil) Website creation using php

Requirements to run this code:

1) PHP Editor,

2) WAMP server or your own server,

3) Basic knowledge in PHP, MYSQL.

Features of this code:

1) Displays same content in both Tamil Language and English,

2) Search option in both English and Tamil,

3) Search terms will be highlighted with different color in both English and Tamil language.

Download:

Click here [ RAR format ] for download [ unlimited download ]

Click here [ ZIP format ] for download [ unlimited download ]

[ Any problem in downloading, please report me ]

Installation:

1) Download the source code, and unzip it.

2) Place it in your server,

3) Open your database; create 2 databases name as multienglish and multitamil. Import the sql files (multienglish.sql & multitamil.sql) into database. (See the Database folder).

4) Change database username and password in ‘connect.php’ file.

5) Run the code now.

You can leave a response, or trackback from your own site.

49 Responses to “Easy Multilingual (English & Tamil) Website creation using php”

  1. Mabares Kannan says:

    I went through the site and i can see few useful techniques that helps to brush up my knowledge.Thanks!

  2. Chandra moha J says:

    ya it’s really nice! i got the solution for my problem using this article, Thanks

  3. Chandra moha J says:

    i have a doubt? can you resolve it? here we store our content into database.if it’s small type of content means it’s fine. but it’s a large size of content means this way is possible. can you tell me any other way is there. that’s i except dynamic site, so kindly give me some idea for that me too think of that
    Thanks
    chandra MOha J

  4. Set content field type as ‘longtext’ in database table and also before inserting into DB, use addslashes() i.e., addslashes($_REQUEST['content']). It will be more flexible for dynamic sites.Is this help full?

  5. andalusia says:

    why i cannot unzip this file?

    • Vijay Kumar says:

      Hi andalusia,
      A lot thanks for informing me broken link. I changed all download links. You can download directly on posts. Thanks once again.

      Regards,
      Vijaya Kumar S,
      +91 9952838699,

  6. kutti says:

    hi
    i have planned to start tamil websites can any one help

  7. ragav says:

    http://rapidshare.com/files/280267876/multilanguage.rar.html

    link shows ERROR! how can i download the zip file. Thanks!

  8. Ragav says:

    Great! Works Perfect!

    Thanks for immediate action.

  9. ragav says:

    தமிழ் this is for tamil (as in the content.php)..I have to use this unicode to display tamil text in UI.. How can i get unicode if i wants to display my name(ragav) in tamil.. Any simple way..Thanks!

  10. ragav says:

    oh! unicode is missing in the previous post but i have pasted it..

    • Vijay Kumar says:

      Dear Ragav,
      It’s very easy to handle, Open google tranliteration tool (http://www.google.com/transliterate/) and type the text, what u need. Then, copy the text and put it in ur text box on your site.Submit the form (Note: while submitting, write insert query to store text box content in database). Once done,see your mysql database, text tamil unicode, will be there. Copy it and place it where u need. got it?

      URL: http://www.alanwood.net/unicode/browser-coverage.html. Working very fine. Please double check once again.

      Note: This will works fine only on browsers but while u tried to alert the tamil text using JavaScript, it will not works.

  11. ragav says:

    Thanks For The Idea. Awesome.

  12. ramakrishna says:

    Hi vijay!

    Thanks in advance.
    I need to implement multilanguages in my site, as you said type the letter in google translator or some thing,then copy and paste that letters and submit the form.But your’s demo link no need to do above process, we can directly type in tamil or english,as the same way how can we implement this process to other languages(without copy from google translator or something..).Can you suggest any Idea.

  13. Vijay Kumar says:

    You can use Java Script codes for typing the languages. I used JS code for searching in my demo. Excluding above mentioned ideas, i did’t tried with different. If u have any suggestions, please update me. Thank You!

  14. ragav says:

    தமிழ் i got this as unicode from phpmyadmin database, when i copy n paste தமிழ் in textbox and submit the form – (unicode conversion not happened)

    i wrote insert query as u said!
    thanks!

  15. Dear ragav,
    Send me that code as mail to my mail ID. I will see it and send u the correct code. Thanks.

  16. Navas says:

    Why my database content look like this ?

    ஒவ்வொர&#

    is the any way to directly save the tamil fonts.

    Because i am not able to read it through database

  17. alaguraja says:

    hi

    I do’t know hindi then how to convert to unicode fromat

  18. Fernando Pereira says:

    Hi, I see that your table have only one row, than you select that row where the “content_id = 1″. If you have more pages in your website, how can you display the content of another row, without creating another select with the “content_id = 2″ and so on?

    Is there anyway to do something like: ?

    Thanks

  19. @alaguraja, Please use google transliteration tool for typing it in Hindi. Follow same procedure, i had mentioned above. So, i hope that it will converts to Hindi Unicode. Got it?

  20. Vijay Kumar says:

    @Fernando Pereira. You can use different style for fetching data from database. You can use different styles like using different tables for each pages, calling unique ID’s(mentioned in post).

  21. Badharudeen says:

    I got more idea from this code.How can i use my own page in database? how can insert other than tamil and english in database?
    Thanks

  22. Its simple, follow the same procedure. No changes.

  23. Cosmin says:

    can u update the links to multilanguage.rar file.

  24. R. Jaiganesh says:

    Hi Vijaya Kumar S,

    Nice one. You give good idea for me.
    I am freelancer. If you have any website client inform me.

    thanks,
    J.

  25. k00dez says:

    Hi!

    What is necessary to change to have three languages? And if more than one page? How to proceed? Would you mind putting an example of a website with multiple languages?

    Tks!

  26. Meena says:

    In local website its changed but in live website not changed wat is the pbm??

  27. Thank you. – behindvfx

  28. Detox Diet : says:

    the google translator si a nice free tool that you can get online”“

  29. Keven Larrow says:

    Thanks for sharing, it can be a very informative post and really helpful for some form of companies like mine. I really like when I am looking the internet and that i can come across a web site with helpful issues similar to this. Thanks lots for the study, I have noted some of them right here so I can use them in a future. Kudos for you and sustain the good blogging operate.

  30. Petrol Leaf Blower says:

    “*’ I am very thankful to this topic because it really gives up to date information ~’~

  31. Balaji says:

    Hi,

    This is a good one. Helped me a lot.

    Thanks,

  32. niyaz says:

    Thanks great work brither, please let us clear sessions and cookie concepts in php through tamil tutorials..

  33. Vivek says:

    Hello vijay kumar, if i wanted to make my site into more langauges around 25 l;anguages then how would i make it……will i have to make 25 databases or what or plz suggest me , i need ur helping hands

  34. Zabi says:

    How to create registration page such that it should store both english and tamil text in the database (ex: if he types in tamil it should store in tamil and english as well). Thanks in advance.

  35. prakash says:

    Hi vijayakumar Please Reupload the file…
    Prakash

  36. Please tell me is it possible to store multilingual data by using some non unicode font not unicodes. If yes then plzzz help me out. :-\

  37. laxman says:

    This post very useful for me…good work vijayakumar…keep it up

  38. vish says:

    plz tell me now hpw to change my all website label in gujarati?????plz reply soon in my mail address ..thnxxxx

  39. Jyotsna says:

    Hi,

    I am working on developing a multi-language survey.
    My problem is – the chinese version of the survey is displayed correctly on the php page but in the mysql DB, they are crap (您对中国的总体看法如何?) and hence when the data is exported to excel for analysis, i get only this. I want to chinese contents so that I can ask the translator to translate it.

    • Jyotsna says:

      BY crap i typed – %^$%$!$^$, some gibberish words, looks like your website translates it correctly to chinese:D but they are a set of meaningless symbols in my excel sheet

  40. vanilla says:

    Hello

    Its very nice and helpful for me :) ..
    But i have a query that can you tell me how can i have french.js when i want site in english and french.

  41. vanilla says:

    My site is very big so i have big database.I want site in french at client side but not in admin side. so when i insert data from admin,what is the idea i get data in french at client side.

  42. Mansoor Abbas P says:

    Im new in PHP. how to make like this site using English to Arabic.? can u help me, pls..?

Leave a Reply