Re: gettext i18n

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/ ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-04-2003
Catalin Trifu
 
Posts: n/a
Default Re: gettext i18n

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.

Reply With Quote
  #2 (permalink)  
Old 09-04-2003
Desi
 
Posts: n/a
Default Re: gettext i18n

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.

Reply With Quote
  #3 (permalink)  
Old 09-04-2003
Christophe Chisogne
 
Posts: n/a
Default Re: [PHP] Re: gettext i18n

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
Reply With Quote
  #4 (permalink)  
Old 09-04-2003
Catalin Trifu
 
Posts: n/a
Default Re: [PHP] Re: gettext i18n

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
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:52 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0