Re: Gettext only returns english

Michael Wallner <[email protected]>
Newsgroups gmane.comp.php.internationalization
Organization IWORKS
Message-ID <[email protected]>
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 >
signature.asc (application/pgp-signature, 186 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (Cygwin)

iD8DBQFBEQCT2pTtEijQyW0RAvtNAJ9lP18jRguqWwDauMtCg1QyHqgfsQCfV1po
XtPXQNsQWvpsX/2Ge9FLMqk=
=4dL4
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.