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