This is a discussion on Re: gettext i18n within the PHP General forums, part of the PHP Programming Forums category; Hi, Thanks for the reply, but it doesn't work this way either. in /www/locale I do have de/ ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi,
Thanks for the reply, but it doesn't work this way either. in /www/locale I do have de/ LC_MESSAGES/ messages.mo de_DE/ LC_MESSAGES/ messages.mo btw! on win32 it works :( Catalin "Desi" <desi@mediate.sk> wrote in message news:20030904140349.97568.qmail@pb1.pair.com... > Hello, > > Try: > > putenv("LANG=de_DE") . '<br>'; > putenv("LC_ALL=de_DE") . '<br>'; > setlocale(LC_ALL, "de_DE", "german") . '<br>'; > > Desi > > > Catalin Trifu wrote: > > Hi, > > > > I want to add i18n support for my web site, but > > it doesn't seem to work. > > PHP 4.3.3., Apache 1.3.28, Mandrake 9.0 > > Here comes the test code. As you can see I try all sorts of things. > > > > <?php > > echo putenv("LANG=de") . '<br>'; > > echo putenv("LC_ALL=de") . '<br>'; > > echo setlocale(LC_ALL, "de", "german") . '<br>'; > > echo bindtextdomain("messages", "/www/locale") . '<br>'; > > echo textdomain("messages") . '<br>'; > > > > echo gettext("User") . '<br>'; > > > > echo strftime ("%A %e %B %Y", time()) . '<br>'; > > ?> > > > > The funny thing is that strftime prints correctly. > > Any ideas > > > > Catalin. |
|
|||
|
Send me your messages.po file, I try it... Gettext is cool, it works
very well for me... Desi Catalin Trifu wrote: > Hi, > > Thanks for the reply, but it doesn't work > this way either. > in /www/locale I do have > de/ > LC_MESSAGES/ > messages.mo > de_DE/ > LC_MESSAGES/ > messages.mo > > btw! on win32 it works :( > > Catalin > > "Desi" <desi@mediate.sk> wrote in message > news:20030904140349.97568.qmail@pb1.pair.com... > >>Hello, >> >>Try: >> >>putenv("LANG=de_DE") . '<br>'; >>putenv("LC_ALL=de_DE") . '<br>'; >>setlocale(LC_ALL, "de_DE", "german") . '<br>'; >> >>Desi >> >> >>Catalin Trifu wrote: >> >>> Hi, >>> >>> I want to add i18n support for my web site, but >>>it doesn't seem to work. >>> PHP 4.3.3., Apache 1.3.28, Mandrake 9.0 >>> Here comes the test code. As you can see I try all sorts of things. >>> >>><?php >>> echo putenv("LANG=de") . '<br>'; >>> echo putenv("LC_ALL=de") . '<br>'; >>> echo setlocale(LC_ALL, "de", "german") . '<br>'; >>> echo bindtextdomain("messages", "/www/locale") . '<br>'; >>> echo textdomain("messages") . '<br>'; >>> >>> echo gettext("User") . '<br>'; >>> >>> echo strftime ("%A %e %B %Y", time()) . '<br>'; >>>?> >>> >>> The funny thing is that strftime prints correctly. >>> Any ideas >>> >>>Catalin. |
|
|||
|
Catalin Trifu wrote:
>>Try: >> >>putenv("LANG=de_DE") . '<br>'; >>putenv("LC_ALL=de_DE") . '<br>'; >>setlocale(LC_ALL, "de_DE", "german") . '<br>'; I would have done this: putenv("LANG=de_DE"); putenv("LANGUAGE=de_DE"); // better to be paranoid, works for me ;-) putenv("LC_ALL=de_DE"); setlocale(LC_ALL, "de_DE", "german"); (see some user comments in php manual) Then you can try to reload the apache webserver (because of the gettext cache, which could hide modifications). "/etc/init.d/apache reload" on a Debian GNU/Linux system. "/etc/rc.d/httpd reload" on RedHat likes Perhaps check german locales are correctly installed on the *nix server. (php uses the setlocale() system call). Yes, locales are system specific. It should be better documented in the php manual :( > btw! on win32 it works :( I solved it the stupid way, because locale names are different on *nix and windows (ex: fr_BE vs French_Belgium). On my test systems, some aliases were common (french, dutch, german) but the path where php looks for the mo file was different (ex fr_BE vs french, de_DE vs german). So I simply copied the /de_DE dir to /german and so on. (for french, I had fr/, fr_BE/ and french/ as dir for it to work on 2 linux servers and 1 test NT server :( Hope it helps, -- Christophe Chisogne Developper, Publicityweb sprl http://www.publicityweb.com |
|
|||
|
Thank you!
> putenv("LANG=de_DE"); > putenv("LANGUAGE=de_DE"); // better to be paranoid, works for me ;-) this one did the trick ! > putenv("LC_ALL=de_DE"); > setlocale(LC_ALL, "de_DE", "german"); > > (see some user comments in php manual) i already read the all before posting here :) Again thx, Catalin |