Search code examples
phpgettextphp-gettext

How to get gettext work on IIS/PHP


I have Windows XP + IIS + PHP (fastcgi) installed.

I want to use gettext for multilanguage application.

index.php:

bindtextdomain('APP', './locale');
textdomain('APP');

Directory structure:

src\index.php
src\locale\en\LC_MESSAGES\APP.mo
src\locale\ru\LC_MESSAGES\APP.mo

The code works only if I setup enviroment variable LANG in My Computer's properties (and if I want to change it, I must restart IIS). However when I'm trying to change the environment variable using putenv('LANG=en') it does not work.

Is there any other way to tell gettext which language to use?


Solution

  • What version of PHP are you using? Could it be PHP 5.3? If yes, then check PHP Bug #49349.