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 .

Vijay Name in Tamil

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.