PHP/Gettext Problems

后端 未结 2 584
太阳男子
太阳男子 2020-12-03 07:40

I remember running some tests a some months ago with gettext and the following code worked perfectly:

putenv(\'LANG=l33t\');
putenv(\'LANGUAGE=l33t\');
putenv         


        
2条回答
  •  长情又很酷
    2020-12-03 08:17

    This code won't run perfectly on every system, because every systems locale repository + php version is different, among other things.

    If you want consistency you need to use something like Zend_Translate, which if you install Zend on each system ( the same version of it ) they would all be consistent with one another because they're using the same localization data, locale names and codebase.

    There are numerous bugs with setlocale, it's just not reliable. See the comments @ http://php.net/manual/en/function.setlocale.php

提交回复
热议问题