- Code: Select all
include "classes/lang.class.php";
require_once "gettext.inc"; /* for php-gettext */
define ("DEFAULT_LOCALE", 'es_ES');
/* Required if using PHP-gettext support */
define ("PROJECT_DIR", realpath("./"));
define ("LOCALE_DIR", PROJECT_DIR . '/locale');
$dl = new lang_detect;
$dl->lang_detect();
$locale = $dl->get_primarylang();
if (empty($locale))
$locale = DEFAULT_LOCALE;
if (isSet($_GET["locale"]))
$locale = $_GET["locale"];
/* PHP-gettext Support */
$encoding = 'UTF-8';
// gettext setup (Linux)
// T_setlocale(LC_MESSAGES, $locale);
// Windows Fix
T_setlocale(LC_ALL, $locale);
// Set the text domain as 'messages'
$domain = 'messages';
T_bindtextdomain($domain, LOCALE_DIR);
T_bind_textdomain_codeset($domain, $encoding);
T_textdomain($domain);
I've correctly set the strings to be located with print (T_("text")); In a linux server this works, but not on my windows box, were I get this error:
Fatal error: Call to undefined function mb_detect_encoding() in C:\Archivos de programa\apachefriends\xampp\htdocs\testSite\gettext.inc on line 101
searching a little bit I've found this page which says :
PHP must be compiled with the --enable-mbstring option to support multi-byte characters like those used with Korean, and Japanese.
I have nothing to do with Korean and Japanese, just want the mb_detect_encoding() do the job, so I've enabled in php.ini:
- Code: Select all
extension=php_gettext.dll
extension=php_mbstring.dll
...
mbstring.language = Spanish
mbstring.http_input = auto
mbstring.encoding_translation = Off
mbstring.detect_order = auto
mbstring.substitute_character = none;
restarted XAMPP, but nothing happens. I don't know if I need to change the [mbstring] section in php.ini. Isn't clear for me the documentation.
Is this a problem of the compiled php.exe in XAMPP? should I install the latest version and move the current configuration there?
phpinfo() doesn't reveal nothing about mbstring . Any help or comments?
cheers