Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Apache and locales (Apache PHP locale gettext) please help
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
wetter
n00b
n00b


Joined: 13 Jan 2004
Posts: 26
Location: amsterdam

PostPosted: Tue Jun 24, 2008 6:22 am    Post subject: Apache and locales (Apache PHP locale gettext) please help Reply with quote

Hello everybody,

I have a strange problem running apache and php. date() amongst others gives me english month names where i need different ones set by setlocale().

I followed the Gentoo localization guide:

http://www.gentoo.org/doc/de/guide-localization.xml
http://www.gentoo.org/doc/en/guide-localization.xml

and this seems to work:


# locale -a
C
de_CH.utf8
de_DE
de_DE@euro
de_DE.iso88591
de_DE.iso885915@euro
de_DE.utf8
deutsch
en_US
en_US.iso88591
en_US.utf8
fr_CH.utf8
german
it_CH.utf8
POSIX



# locale
LANG=de_DE.utf8
LC_CTYPE="de_DE.utf8"
LC_NUMERIC="de_DE.utf8"
LC_TIME="de_DE.utf8"
LC_COLLATE="de_DE.utf8"
LC_MONETARY="de_DE.utf8"
LC_MESSAGES="de_DE.utf8"
LC_PAPER="de_DE.utf8"
LC_NAME="de_DE.utf8"
LC_ADDRESS="de_DE.utf8"
LC_TELEPHONE="de_DE.utf8"
LC_MEASUREMENT="de_DE.utf8"
LC_IDENTIFICATION="de_DE.utf8"
LC_ALL=de_DE.utf8

# date +%B
Juni

this is fine "Juni" is german for june.

But in Apache / PHP it is different:

there i have:



Available Locales

* C
* de_CH.utf8
* de_DE
* de_DE@euro
* de_DE.iso88591
* de_DE.iso885915@euro
* de_DE.utf8
* deutsch
* en_US
* en_US.iso88591
* en_US.utf8
* fr_CH.utf8
* german
* it_CH.utf8
* POSIX

Default PHP Locale

* LANG=de_DE.utf8
* LC_CTYPE="de_DE.utf8"
* LC_NUMERIC="de_DE.utf8"
* LC_TIME="de_DE.utf8"
* LC_COLLATE="de_DE.utf8"
* LC_MONETARY="de_DE.utf8"
* LC_MESSAGES="de_DE.utf8"
* LC_PAPER="de_DE.utf8"
* LC_NAME="de_DE.utf8"
* LC_ADDRESS="de_DE.utf8"
* LC_TELEPHONE="de_DE.utf8"
* LC_MEASUREMENT="de_DE.utf8"
* LC_IDENTIFICATION="de_DE.utf8"
* LC_ALL=de_DE.utf8

but

date('l F');

keeps outputting

"Tuesday June"

I have LINGUAS set in make.conf "de fr it en" also.

Please if anyone knows places on where to go on checking please share.
Back to top
View user's profile Send private message
TheAl
Tux's lil' helper
Tux's lil' helper


Joined: 22 Jan 2004
Posts: 134

PostPosted: Tue Jun 24, 2008 9:51 am    Post subject: Reply with quote

Add a line in start of you php file :

Code:
setlocale(LC_ALL, 'de_DE');


http://ch2.php.net/set_locale
Back to top
View user's profile Send private message
wetter
n00b
n00b


Joined: 13 Jan 2004
Posts: 26
Location: amsterdam

PostPosted: Tue Jun 24, 2008 1:26 pm    Post subject: Reply with quote

Hi TheAl,

thanks for your suggestion, unfortunately that is not solving my issue. When i put this:

Code:

setlocale(LC_ALL,"de_DE");
$date=date('l F');
echo '<hr><h3>';
echo $date;


i get that:

Code:
Tuesday June


how can that happen, i wonder...?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum