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
Need help for bilingual website
Moderator: General Moderators
Re: Need help for bilingual website
It's usually a very big task so impossible to answer with the information given.
Re: Need help for bilingual website
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
Some file on your site
Assuming $_SESSION['lang'] has been set to the language the user wants, either 'en', 'fr', or 'ar'.
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');
?>Code: Select all
<?php echo $lang['welcome'][$_SESSION['lang']; ?>Real programmers don't comment their code. If it was hard to write, it should be hard to understand.