by Raymanoff » Sat Jun 05, 2010 8:30 am
Free advise to translate your site in 2 languages without database...
Register a default session language
$_SESSION['lang']="en";
Then start a session on each page.
session_start();
Then replace each word in UI, Forms etc with the array caller like this: <?php echo $trans['Next']; ?>
The code above would look into tranlation file and look for an entry "Next"
Now, the translation file...
Lets call it inc.languages.php
the structure is simple....
<?php
if($_SESSION['lang']=="en") {
array $trans(
"Next"=>"Next",
"Yes"=>"Yes",
"No"=>"No");
}
if($_SESSION['lang']=="gr") {
array $trans(
"Next"=>"Επόμενο",
"Yes"=>"Ναί",
"No"=>"Όχι");
}
Obviously you would have to include this lang file on each page...
The encoding of the site should be UTF-8, then you can add more languages on your site by adding new session parameters and new entries in your translation file.
For Big blocks of content just use IF(SESSION) statements. This is supereasy...