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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What is string function sql?

531


How are cookies created?

549


Can we run php in apache tomcat?

523


What is mysql_fetch_object?

560


Can we run php on tomcat server?

566






What is magic quotes?

604


How to create and destroy cookies in php?

498


Is php case sensitive?

518


What u mean by query?

486


Why overriding is called runtime polymorphism?

527


What are the benefits of using php?

518


What is a trait in php?

574


How break and continue while loop in php?

490


What’s the difference between htmlentities() and htmlspecialchars()?

579


Tell me what are the functions to be used to get the image's properties (size, width and height)?

544