Re: Gettext only returns english
| From: | Michael Wallner | Date: | Wed, 04 Aug 2004 15:28:17 +0000 |
| Subject: | Re: Gettext only returns english | ||
| References: | 1 2 | Groups: | php.i18n |
| Request: | Send a blank email to php-i18n+get-745@lists.php.net to get a copy of this message | ||
Hi Wil Clouser, you wrote:
[...]
Ususally a composition of
setlocale(LC_ALL, 'de_DE');
putenv('LANG=de');
putenv('LANGUAGE=de');
should work...
If you've got PEAR installed try the feollowing
with File_Gettext and I18Nv2 installed:
<?php
require_once 'System.php';
require_once 'File/Gettext.php';
require_once 'I18Nv2.php';
$po = &File_Gettext::factory('PO');
$po->strings = array('one' => 'eins');
$mo = &$po->toMO();
System::mkdir('-p locales/de/LC_MESSAGES');
$mo->save('locales/de/LC_MESSAGES/myapp.mo');
unset($mo, $po);
I18Nv2::setLocale('de');
bindTextDomain('myapp', 'locales');
textDomain('myapp');
echo _('one'), "\n";
?>
Cheers,
--
Michael - < mike(@)php.net >
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc