I'm implementing a PHP function to translate my website based on HTTP_ACCEPT_LANGUAGE, but also by user choice:
<?php
if (!isset($language)) {
$language = explode(',',$_SERVER['HTTP_ACCEPT_LANGUAGE']);
$language = strtolower(substr(chop($language[0]),0,2));
}
include("functions/content_".$language.".php");
?>
User choice comes when the user clicks a link in the navbar, like this:
<ul>
<li><a href="portfolio.php?language=es">Español</a></li>
<li><a href="portfolio.php?language=en">Enshlish</a></li>
<li><a href="portfolio.php?language=fr">Français</a></li>
</ul>
Problem is I can't get to change the value of $language with the hrefs, it always self-defines as "es" (my browser is set to Spanish).
$language = $_GET['language'];(register_globals is probably off)