Hi,

    I had really bad headaches with gettext some time ago
and since then I decided to no longer use it. It's unreliable on
heavy loads (mixed english + translated texts), moving the scritps to
another machine means more headache, it relies on system calls which
are not "isolated", which means scritps can step on each others toes.
    My advice is stay away of gettext. Try some DB framework for
translation; it definetely performs better and more reliable.
    Or, if the site is small you can rely on included files.

Cheers,
catalin

"Christian David" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hello!
>
> I wrote this skript, but gettext returns only the english string.
>
> I could not find a bug at bugs.php.net, so I think I forgot something.
> I have Debian Linux, PHP Version 4.3.4 and Gettext 0.14.1 (PHP and Gettext
> as debian pakages)
>
> gettext.php in /var/www/gymbay/
>
> <?php
> // Set language to German
> setlocale(LC_ALL, 'de_DE');
>
> // Specify location of translation tables
> bindtextdomain("messages", "i18n");
>
> // Choose domain
> textdomain("messages");
>
> // Translation is (should) looking for in
> i18n/de_DE/LC_MESSAGES/messages.mo now
>
> // Print a test message
> echo gettext("Welcome to My PHP Application");
>
> // Or use the alias _() for gettext()
> echo _("Have a nice day");
>
> // Output:
> // Welcome to My PHP ApplicationHave a nice day
>
> ?>
>
> messages.po
>
> # translation of messages.po to german
> # This file is distributed under the same license as the PACKAGE package.
> # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER.
> # Christian Dávid <[EMAIL PROTECTED]>, 2004.
> #
> msgid ""
> msgstr ""
> "Project-Id-Version: messages\n"
> "Report-Msgid-Bugs-To: \n"
> "POT-Creation-Date: 2004-09-11 15:50+0200\n"
> "PO-Revision-Date: 2004-09-11 15:52+0200\n"
> "Last-Translator: Christian Dávid <[EMAIL PROTECTED]>\n"
> "Language-Team: \n"
> "MIME-Version: 1.0\n"
> "Content-Type: text/plain; charset=UTF-8\n"
> "Content-Transfer-Encoding: 8bit\n"
> "X-Generator: KBabel 1.3.1\n"
> "Plural-Forms:  nplurals=2; plural=(n != 1);\n"
>
> #: gettext.php:15
> msgid "Welcome to My PHP Application"
> msgstr "Willkommen zu meiner PHP Anwendung"
>
> #: gettext.php:18
> msgid "Have a nice day"
> msgstr "Wir wünschen Ihnen einen schönen Tag"
>
> and the "messages.mo" is in /var/www/gymbay/i18n/de_DE/LC_MESSAGES/
>
> Thank you! 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to