I'm using Zymic, its a great hosting but it doesn't support the php gettext extension. I'm planning to buy some hosting in the future, but from now I want the simplest solution in order to replace the function of gettext, in this case I want to display different text (English, Spanish, Chinese, etc...) without modyfing the file too much (at least not having to create seaprated files for each language).
I tried something like this:
<?php
$lang = "";
switch ($lang) {
case "en":
$lang = "Hello World";
break;
case "es":
$lang = 'Hola Mundo';
break;
}
?>
<div>
<p><?php echo $lang;?></p>
</div>
When I change the $lang
variable it works. I'm a PHP beginner and I can't think of a way to make it change in the browser (by clicking a link).
Or is there a better way of doing this?