Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How will you create a bi-lingual site (multiple languages) ?

Answer Posted / ahmad pujianto

use session...it work better. Check my sample
<?php
session_start();
session_register("language");

if(empty($_SESSION['language']))
{
$_SESSION['language']='en';
}

if(isset($_GET[lang])){
if($_GET[lang]=='id' or $_GET[lang]=='en'){
$_SESSION['language']=$_GET[lang];

echo '<meta http-equiv="refresh" content="0;
url=?language='.$_GET[lang].'">';
}else{
echo '<meta http-equiv="refresh" content="0;
url=?error=Unavailable_Language_Option">';
}
}

?>
Make this script on a single file, include the file in each
pages, then simply add link that give value $_GET[lang].
Each time there is $_GET[lang], this script will change the
$_session['language'].

Then in each part that need to be bilingual, check for
$_SESSION['language'].

Thats all

Is This Answer Correct ?    14 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between require and include in php?

1069


Explain what is meant by pear in php?

986


which will print out the php call stack?

962


List the different types of print functions available in php?

911


Explain mail function in PHP with syntax?

993


What is session expiry?

945


What is namespace and use in php?

978


Why do we use csrf token?

927


How to access a specific character in a string?

969


Is laravel an oop?

887


How to create a web form?

1011


Explain whether it is possible to share a single instance of a memcache between multiple php projects?

954


Why print_r is used in php?

944


What is fetch array in php?

1079


What is the use of htmlspecialchars in php?

981