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 .
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).

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.


September 2nd, 2009 at 2:32 PM
I went through the site and i can see few useful techniques that helps to brush up my knowledge.Thanks!
September 5th, 2009 at 2:43 PM
ya it’s really nice! i got the solution for my problem using this article, Thanks
September 5th, 2009 at 2:48 PM
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
September 5th, 2009 at 2:57 PM
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?
September 15th, 2009 at 9:41 AM
why i cannot unzip this file?
September 15th, 2009 at 11:15 AM
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,
September 17th, 2009 at 9:19 PM
hi
i have planned to start tamil websites can any one help
September 25th, 2009 at 12:01 AM
http://rapidshare.com/files/280267876/multilanguage.rar.html
link shows ERROR! how can i download the zip file. Thanks!
September 25th, 2009 at 10:10 AM
Dear Ragav,
I modified the multilanguage downloading link. Please use the link in post. Downloading problem will not arise once again. Thanks.
For quick download, use below links,
http://www.splendidwebtech.com/downloads/downloads.php?fileID=105331vijay-multimultilanguage.rar
http://www.splendidwebtech.com/downloads/downloads.php?fileID=520624zip-formatmultilanguage.zip
September 25th, 2009 at 12:21 PM
Great! Works Perfect!
Thanks for immediate action.
September 26th, 2009 at 12:59 AM
தமிழ் 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!
September 26th, 2009 at 1:03 AM
oh! unicode is missing in the previous post but i have pasted it..
September 26th, 2009 at 8:17 AM
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.
October 8th, 2009 at 10:20 PM
Thanks For The Idea. Awesome.
October 13th, 2009 at 10:39 AM
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.
October 18th, 2009 at 2:47 PM
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!
October 20th, 2009 at 9:54 PM
தமிழ௠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!
October 21st, 2009 at 7:44 AM
Dear ragav,
Send me that code as mail to my mail ID. I will see it and send u the correct code. Thanks.
November 2nd, 2009 at 10:57 AM
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
November 25th, 2009 at 2:45 PM
hi
I do’t know hindi then how to convert to unicode fromat
November 26th, 2009 at 12:01 AM
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
November 26th, 2009 at 10:45 AM
@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?
November 26th, 2009 at 10:54 AM
@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).
December 14th, 2009 at 8:11 AM
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
December 14th, 2009 at 10:52 AM
Its simple, follow the same procedure. No changes.
January 8th, 2010 at 3:31 AM
can u update the links to multilanguage.rar file.
January 8th, 2010 at 1:07 PM
I will update those links soon.
January 12th, 2010 at 3:03 AM
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.
January 12th, 2010 at 1:20 PM
Thank you R. Jaiganesh, i will inform u once i got any clients regarding this. Please don’t forget to update ur profile to me(through mail) for further move.
February 2nd, 2010 at 3:20 AM
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!