[horde] error with gettext

heva help_debian at yahoo.fr
Sun Jul 13 09:58:11 PDT 2003


On Wed, Jul 02, 2003 at 02:20:31AM +0200, heva wrote:
> hello,
> 
> I have a cvs version of horde with imp and i can't display it
> in others langages.
> I have reconfigured my locale, do make install in po directory,
> check in horde/test.php:
> PHP Module Capabilities
> 
>     * Ctype Support: Yes
>     * DOM XML Support: Yes
>     * FTP Support: Yes
>     * Gettext Support: Yes
>     * Iconv Support: Yes
>     * IMAP Support: Yes
>     * LDAP Support: Yes
>     * Mbstring Support: Yes
>     * MCAL Support: Yes
>     * Mcrypt Support: Yes
>     * MIME Magic Support: N/A
>     * MySQL Support: Yes
>     * OpenSSL Support: No
>     * PostgreSQL Support: No
>     * XML Support: Yes
> 
> check in phpinfo():
> GetText Support         enabled
> 
> choose my favorite langage in login screen, but horde/imp
> always display in english...
> 
> I also try to do a :
> $>php ./translation.php help
> Content-type: text/html
> X-Powered-By: PHP/4.3.2
> 
> 
> Fatal error: Call to undefined function:  _() in /var/www/horde_cvs/config/nls.php on line 168
> 
> 
> If someone could help me.
> 

I have no answers so i try to understand how gettext work in horde:

I made the following script

<?


    function setTextdomain($app, $directory, $charset)
    {
        $bind = bindtextdomain($app, $directory);
        echo"bindtextdomain = $bind <br><br>";

        $text = textdomain($app);
        echo"textdomain = $text <br><br>";

        /* The existence of this function depends on the platform. */
        if (function_exists('bind_textdomain_codeset')) {
        $codset =  bind_textdomain_codeset($app, $charset);
        echo"codeset = $codset <br><br>";
        }

        if (!headers_sent()) {
            header('Content-Type: text/html; charset=' . $charset);
        }
    }


$lang_charset = "fr_FR";


@putenv('LANG=' . $lang_charset);
@putenv('LANGUAGE=' . $lang_charset);


setTextdomain("horde", "./locale/", "ISO-8859-1");

$title = _("User Registration");


echo ">>>>>> $title <<<<<<";

?>


and when i test it, it show:

------

bindtextdomain = /var/www/test/locale

textdomain = horde

codeset = ISO-8859-1

>>>>>> User Registration <<<<<

-------

The variables seems to be right
(In the directory of my script i have
locale/fr_FR/LC_MESSAGES/horde.mo),
but the "User Registration" should be "Enregistrement des utilisateurs"
according with fr_FR.po:
msgid "User Registration"
msgstr "Enregistrement des utilisateurs"

Or there's something i don't understand...

Is it the right way to use gettext ?

thanks

PS: sorry for my bad english.



More information about the horde mailing list