Page 1 of 1

Need help for bilingual website

Posted: Wed Nov 25, 2009 6:02 am
by asu23
Hi,

My name is Asutosh. We have develop a website in PHP and mySQL, out goal was make this website in bilingual. After we developed, now we are facing to make it bilingual. We want to add two language apart from English,

1. Arabic
2. french.

Can anyone suggest me, how I can make this changes.

Please send or reply me on my mail ID.

Regards
Asutosh roy
asutosh_rou@aol.in

Re: Need help for bilingual website

Posted: Wed Nov 25, 2009 10:12 am
by papa
It's usually a very big task so impossible to answer with the information given.

Re: Need help for bilingual website

Posted: Wed Nov 25, 2009 10:16 am
by pickle
To determine what language to use, I believe the browser passes the preferred language when it requests a page. You can use that to determine which language to display. To allow the user to choose a different language, have a simple form somewhere on your website. Whether you get the language from the form or the browser, you should set the language to use as a session variable, so it persists & you don't need to re-determine the language on every page load.

For actually showing your site in multiple languages, you use an include file with the strings translated into different languages, like so:

Language file

Code: Select all

 
<?php
$lang['welcome'] = array(
  'en'=>'Welcome',
  'fr'=>'Bienvenue',
  'ar'=>'Ya hala');
?>
Some file on your site

Code: Select all

<?php  echo $lang['welcome'][$_SESSION['lang']; ?>
Assuming $_SESSION['lang'] has been set to the language the user wants, either 'en', 'fr', or 'ar'.