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

Answers were Sorted based on User's Feedback



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

Answer / 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

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

Answer / prasadkonnur

u can create your site multi langual by specifying seperate
folders for different languages like english, hindi, kannada
and more for seperate languages.

Is This Answer Correct ?    11 Yes 8 No

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

Answer / abinash grahacharya

I am working on an application which is multilingual we have
basically 3 languages , french, dutch and English

Our structure doing it best way...

What we are doing ?

The structure of the files are same but we are using 3
language files for the site as fr.php, nl.php and en.php

language selected by user we are keeping that in cookie and
if there is no cookie we are setting french as default and
in cookie.

How it works ?
Based on cookie we are including the language file in
controller or main page and it is effecting the site.

Example : suppose there is a button called sendemail and the
value or button text be different in three language

in fr - Réponse
in nl - Respond
in en - Send

so in en.php
<?php
define("button_text",Send);
?>

so in fr.php
<?php
define("button_text",Réponse );
?>

so in nl.php
<?php
define("button_text",Respond);
?>


so in main controller or index page

<?php
include($_COOKIE['languague'].".php");

<input type='button' name='sendemail' value='<?php echo
button_text;?>'>


Why it is good ?
It will work very well and we can use any new language in
site like spenish - how ? create only language file called
sp.php and define value and set language cookie it will work

Thanks
:)

Is This Answer Correct ?    4 Yes 4 No

Post New Answer

More PHP Interview Questions

How can we get the browser properties using PHP?

7 Answers  


what is the dirrence in PHP4 & PHP5 . ?

8 Answers  


Declare a new variable in php equal to the number 3;

0 Answers  


Do you know what does mvc stand for and what does each component do?

0 Answers  


Is php free to use?

0 Answers  


How to remove the new line character from the end of a text line in php?

0 Answers  


What are the features and advantages of object-oriented programming in php?

0 Answers  


Is null check in php?

0 Answers  


What is csrf token and how it works?

0 Answers  


Is it more secure to use cookies to transfer session ids?

0 Answers  


What are the encryption functions in php?

0 Answers  


What is the use of ajax in php?

0 Answers  


Categories