Problem with gettext() and POEdit
Posted: Sat Apr 10, 2010 5:56 am
Hi everyone,
my problem is the following: I've recently learned how to internationnalize my website using .mo files. I think that I've done everything good and the fact is that my page is translated but in one language only
Whatever the link I click on, it keeps showing the text in French (which is not normal). I've restarded my server like a zillion times and nothing's changed.
That's how my site looks like:
.local\page.php
.local\fr_FR\LC_MESSAGES\default.mo
.local\en_EN\LC_MESSAGES\default.mo
And this is the code of my "page.php":
If you have experienced the same think, please share
This thing is driving me crazy.
Thanks a lot.
my problem is the following: I've recently learned how to internationnalize my website using .mo files. I think that I've done everything good and the fact is that my page is translated but in one language only
That's how my site looks like:
.local\page.php
.local\fr_FR\LC_MESSAGES\default.mo
.local\en_EN\LC_MESSAGES\default.mo
And this is the code of my "page.php":
Code: Select all
<?php
if (!empty($_GET['lang'])) {
switch ($_GET['lang']) {
case 'fr':
$langage = 'fr_FR';
break;
case 'en':
$langage = 'en_EN';
break;
case 'de':
$langage = 'de_DE';
break;
default:
$langage = 'en_EN';
break;
}
putenv("LANG=$langage");
setlocale(LC_ALL, $langage);
$nomDesFichiersDeLangue = 'default'; // File .mo
bindtextdomain($nomDesFichiersDeLangue, "C:\wamp\www\local");
textdomain($nomDesFichiersDeLangue);t
echo gettext('Welcome !');
echo '<br >';
echo _('Goodbyer !');
echo _('Ciao !');
echo '<br /><br />';
}
echo '<a href="page.php?lang=fr">français</a><br />';
echo '<a href="page.php?lang=en">english</a><br />';
echo '<a href="page.php?lang=de">deutsch</a><br />';
?>
Thanks a lot.