Bonjour, j'ai des difficultés à faire fonctionner la librairie gettext chez ovh.
Pour commencer, tout fonctionne bien en local avec EasyPHP.
En ligne, je n'ai aucun message d'erreur, mais aucune traduction non plus et je n'arrive pas à trouver pourquoi. Es-ce les fichier .po qui pose problème ? Car je les ai créés sous windows avant de les importer via ftp sur le serveur ? Et si oui, y a-t-il une solution ?
Es-ce la librairie qui serai déjà sur le serveur et le fait que je l'importe dans mon code poserai problème ?
Voici le code configurant gettext :
Et enfin, je ne sais comment m'y prendre pour débugger ça et cibler l'erreur. J'ai fait quelques echo en suivant un autre forum :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 .'./traductions'); define('DEFAULT_LOCALE', 'fr_FR'); require_once('lib/gettext/gettext.inc'); $supported_locales = array('en_UK', '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 = 'trad'; 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"); ?>
echo textdomain("LC_ALL=$locale"); // ne retourne rien
echo putenv("LC_ALL=$locale"); // retourne 1
echo bindtextdomain("trad", "./traductions"); // ne retourne rien
Merci d'avance pour votre aide.
Partager