wampserver 64 bits php gettext
Bonjour à tous, pourriez-vous m'aider s'il vous plaît?
Impossible de faire fonctionner gettext j'ai tout essayé il-y à quelque chose que je fais mal mais je en trouve pas.
voilà sous wamp le chemin ou se trouve mon test C:\wamp\www\test\languages
voici les fichiers dans ce répertoire : gettext.inc , streams.php , Makefile , test-language.php qui est le fichier que je veux traduire. voici le contenu du fichier test:
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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| <?php
/*
Copyright (c) 2003,2004,2005,2009 Danilo Segan <danilo@kvota.net>.
Copyright (c) 2005,2006 Steven Armstrong <sa@c-area.ch>
This file is part of PHP-gettext.
PHP-gettext is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
PHP-gettext is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with PHP-gettext; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
error_reporting(E_ALL | E_STRICT);
// define constants
define('PROJECT_DIR', realpath('./'));
define('LOCALE_DIR', 'C:/wamp/wwww/test/languages');
define('DEFAULT_LOCALE', 'es_ES');
require_once('gettext.inc');
$supported_locales = array('en_US', 'sr_CS', 'de_CH', 'es_ES');
$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 = 'messages';
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);
echo gettext("HELLO_WORLD");
?> |
j'ai également dans ce dossier mon dossier es_ES le chemin jusqu'au fichier message.po est C:\wamp\www\test\languages\es_ES\LC_MESSAGE
voici son contenu
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
"Project-Id-Version: \n"
"POT-Creation-Date: 2015-11-18 16:28+0100\n"
"PO-Revision-Date: 2015-11-18 16:30+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.6\n"
"X-Poedit-Basepath: .\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Language: es\n"
msgid "HELLO_WORLD"
msgstr "HOLA" |
le fichier est compilé avec poedit j'ai également dans mon php.ini extension=php_gettext.dll qui n'ai plus en commentaire, mais quand je tape dans mon navigateur http://localhost/test/languages/test-language.php il m'affiche hello_world alors qu'il devrait me le traduire.
N'hésitez pas si je ne suis pas clair et merci pour votre aide :) .