Hi,
For this post I was hoping to get some detailed feedback and maybe links for my issue.
Presently I am using a fixed php file with my translations which is called with a simple case switch like so:
<?php
if ($_SESSION[lang] == "") {
$_SESSION[lang] = "en";
$currLang = "en";
} else {
$currLang = $_GET[lang];
$_SESSION[lang] = $currLang;
}
switch($currLang) {
case "en":
define("CHARSET","ISO-8859-1");
define("LANGCODE", "en");
break;
case "de":
define("CHARSET","ISO-8859-1");
define("LANGCODE", "de");
break;
default:
define("CHARSET","ISO-8859-1");
define("LANGCODE", "en");
break;
}
header("Content-Type: text/html;charset=".CHARSET);
header("Content-Language: ".LANGCODE);
?>
This is called using:
<li><a href="<? echo $_SERVER[PHP_SELF] . "?lang=en"; ?>"><img src="../images/en_flag.gif" border=0></a></li>
<li><a href="<? echo $_SERVER[PHP_SELF] . "?lang=de"; ?>"><img src="../images/de_flag.gif" border=0></a></li>
This I know is not an ideal situation. Mainly because when someone changes to a different page they need to select the language again.
I have seen many examples on the internet making use of the .po extension and storing it in the LC_MESSAGES folder, but I just cant seem to get it to work. As you can see I so want the functionality of being able to select the language using the flag system at the top of the page.
Can some assist me with this. I want to learn and obviously put your advice into practice?