Hi there,
I'm a real novice so apologies for my ignorance... any help would be greatly appreciated.
I'm trying to create a basic multilingual page using POEdit (which seems to work fine).
require_once('localization.php');
echo gettext("Hello World!");
echo "<p>" . _("Welcome to my translation test page."). "</p>";
localization.php:
$locale = "es_ES";
putenv("LC_ALL=$locale");
setlocale(LC_ALL, $locale);
bindtextdomain("messages", "./locale");
bind_textdomain_codeset("messages", 'UTF-8');
textdomain("messages");
So I have translated both strings in POEdit and the page loads in Spanish. All good up to here.
The next thing I want to do is create two links at the top of the page "English" and "Español" to enable the user to select the language they want to see the page in. The page should load by default in English. So I was going to add something along the lines of:
echo "<p><a href=\"".$_SERVER['PHP_SELF']."?locale=en_UK\">English</a> -
<a href=\"".$_SERVER['PHP_SELF']."?locale=es_ES\">Español</a></p>\n";
Here I'm stuck. The page loads in Spanish and the links don't change anything.
Sorry again if the problem is blatantly obvious. Thanks for any help. I'm using apache on windows.