I once did a project with multiple languages. It was a big hassle. I am not recommending my method below, but showing it to you as an example of how it can be achieved.
lang.en.php
$lang = array();
$lang['menu'] = array(
'home' => 'Home',
'projects' => 'Projects',
'about' => 'About',
'contact' => 'Contact'
);
$lang['some_other_section'] = array(
'some_value' => 'some value',
...
...
);
lang.no.php
$lang = array();
$lang['menu'] = array(
'home' => 'Hjem',
'projects' => 'Prosjekter',
'about' => 'Om',
'contact' => 'Kontakt'
);
$lang['some_other_section'] = array(
'some_value' => 'En annen verdi',
...
...
);
Now, the big hassle was to write all the text in the application using variables, then add them and translate in each language file.
index.php
<div class="menu">
<a href="#"><?php echo $lang['menu']['home']; ?></a>
<a href="#"><?php echo $lang['menu']['projects']; ?></a>
<a href="#"><?php echo $lang['menu']['about']; ?></a>
<a href="#"><?php echo $lang['menu']['contact']; ?></a>
</div>
You would have to set the "active" language some place in the initialization of the page. i.e:
<?php
session_start();
if($_SESSION['lang'] == "en") {
require('lang.en.php');
} elseif($_SESSION['lang'] == "no") {
require('lang.no.php');
}
?>
<html>
<head>
...
...