faqts : Computers : Programming : Languages : PHP : Common Problems : Internationalization

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

4 of 4 people (100%) answered Yes
Recently 3 of 3 people (100%) answered Yes

Entry

gettext doesn't use locale
LANG is not used by gettext

May 9th, 2001 07:18
Diez B. Roggisch,


When using gettext, it didn't use the LANG variable as set by
<?php PutEnv("LANG=" . $LANG);
SetLocale("LC_ALL", "");
?>. 
The LANG was set by .htaccess, so I could distribute my code into different directorys (DE, EN, FR) and set the LANG var according to them.
But my server kept using one language, although I used the above code.
phpInfo() showed me that there was HTTP_ENV_VARS["LANG"] not overridden by my .htacces or php-code.

The problem occured because of the root environment had LANG and LANGUAGE preset. These values persited and forced gettext to the wrong locale. Unsetting them before starting my server works - at least for me.

Diez B. Roggisch