Gettext - Problème de session
Bonjour à tous,
Voilà, j'utilise la méthode gettext pour internationaliser mon site web.
Cela marche parfaitement, d'origine le site est en anglais et il est possible de le passer en Fr avec gettext. Sauf que quand je le mets en Français et que je change de page, le site revient en anglais.
J'ai regardé plusieurs forum, et de base, enfin sans cookie, gettext devrait garder la session en cours.
J'aurais aimer avoir votre avis sur ce problème :)
Voici mon code qui initialise gettext:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| <?php
error_reporting(E_ALL | E_STRICT);
// define constants
define('PROJECT_DIR', realpath('./'));
define('LOCALE_DIR', PROJECT_DIR .'/language');
define('DEFAULT_LOCALE', 'en_US');
require_once('assets/trad/gettext.inc');
$supported_locales = array('en_US', 'fr_FR');
$encoding = 'UTF-8';
$locale = (isset($_GET['lang']))? $_GET['lang'] : DEFAULT_LOCALE;
// gettext setup
T_setlocale(LC_MESSAGES, $locale);
// Set the text domain as 'messages'
$domain = 'bruno';
bindtextdomain($domain, LOCALE_DIR);
// bind_textdomain_codeset is supported only in PHP 4.2.0+
if (function_exists('bind_textdomain_codeset'))
bind_textdomain_codeset($domain, $encoding);
textdomain($domain);
header("Content-type: text/html; charset=$encoding");
?> |