469,889 Members | 1,268 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,889 developers. It's quick & easy.

Gettext doesn't worh, help!


I'm testing gettext on my website but it doesn't work.

phpinfo returns correct informations:
configure command => '--with-gettext=/usr'
GetText Support => enabled

I have no problem to create messages.mo and messages.po files.
I've created all directories under a 'locale' root directory
Here's the source of a fr_FR messages.po (en_US is similar):
# Copyright (C) 2004 Free Software Foundation, Inc.
# Daniel xxx <xx*@yyy.com>, 2004.
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2004-07-06 13:30+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Daniel xxx <xx*@yyy.com>\n"
"Language-Team: French <tr****@traduc.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"

# Exemples de texte a traduire

msgid "ADM0001"
msgstr "Traduction en cours ..."

msgid "ADM0002"
msgstr "Verifiez les valeurs de vos variables"

Here's the source of a test script:
// Specification de la langue dans la variable d'environnement LANG.
echo "Variable d'environnement LANG = " . $vLang;
echo "<BR />\n";
echo "Variable d'environnement LANG = " . $vLang;
echo "<BR />\n";
$vLC_ALL = getenv("LC_ALL");
echo "Variable d'environnement LC_ALL = " . $vLC_ALL;
echo "<BR />\n";
$vLocale = setlocale(LC_ALL, "en_US");
echo "Variable locale LC_ALL = " . $vLocale;
echo "<BR />\n";
$vLC_ALL = getenv("LC_ALL");
echo "Variable d'environnement LC_ALL = " . $vLC_ALL;
echo "<BR />\n";

// Test de gettext
$vDomaine = "messages";
$vCodeset = bind_textdomain_codeset($vDomaine, "ISO-8859-1");
echo "Resultat de bind_textdomain_codeset = " . $vCodeset;
echo "<BR />\n";
$vBind = bindtextdomain($vDomaine, "./gettext/locale");
echo "Resultat de bindtextdomain = " . $vBind;
echo "<BR />\n";
$vTextDomain = textdomain($vDomaine);
echo "Resultat de textdomain = " . $vTextDomain;
echo "<BR />\n";

echo gettext("ADM0001");
echo "<BR />\n";
echo gettext("ADM0002");
echo "<BR />\n";
echo gettext("ADM0003");
echo "<BR />\n";
echo _("ADM0001");
echo "<BR />\n";
echo _("ADM0002");
echo "<BR />\n";
echo _("ADM0003");
echo "<BR />\n";

Here's the result of th script:
Variable d'environnement LANG = en_us
Variable d'environnement LANG = en_US
Variable d'environnement LC_ALL = en_US
Variable locale LC_ALL = en_US
Variable d'environnement LC_ALL = en_US
Resultat de bind_textdomain_codeset = ISO-8859-1
Resultat de bindtextdomain = /home/web/site123/admin/gettext/locale
Resultat de textdomain = messages
I don't understand what's wrong, I've run the test script with fr_FR
configuration too, the result is the same, only the msgid is displayed,
help needed.
Jul 17 '05 #1
0 1738

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Dave Patton | last post: by
14 posts views Thread by Pierre Rouleau | last post: by
13 posts views Thread by cantabile | last post: by
7 posts views Thread by russ.phillips.nospam | last post: by
reply views Thread by redhog | last post: by
4 posts views Thread by Mike P2 | last post: by
1 post views Thread by James T. Dennis | last post: by
6 posts views Thread by =?iso-8859-1?B?QW5kcuk=?= | last post: by
2 posts views Thread by paolob | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.