PHP-gettext / mb_detect_encoding() / --enable-mbstring ?

Problems with the Windows version of XAMPP, questions, comments, and anything related.

PHP-gettext / mb_detect_encoding() / --enable-mbstring ?

Postby matiasdag » 13. July 2006 08:08

Hi, I've made a site under windows which uses PHP-gettext 1.0.3 (i.e. NO native gettext support) and set up some locales files (.po and .mo) under locale/(lang)/LC_MESSAGES/ directory. Then I've used the following script to enable dynamically a multilingual site:

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
matiasdag
 
Posts: 5
Joined: 13. July 2006 07:32

Postby Wiedmann » 13. July 2006 13:24

so I've enabled in php.ini:
Code: Select all
extension=php_gettext.dll
extension=php_mbstring.dll

You have used the correct "php.ini"?
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby matiasdag » 22. July 2006 05:04

Yep :oops:
Anyway, I run with another problem HTTP_ACCEPT_LANGUAGE, see my last post.
matiasdag
 
Posts: 5
Joined: 13. July 2006 07:32

Postby Izzy » 22. July 2006 07:08

matiasdag wrote:Yep :oops:
Anyway, I run with another problem HTTP_ACCEPT_LANGUAGE, see my last post.
Nothing wrong with XAMPP or its use of php. You edited a php.ini file and if those edits are not reflected in the phpinfo() then you must obviously have edited the wrong php.ini file. The most obvious php.ini file to edit is in the xampp/php directory but this is not the one used by XAMPP by default. XAMPP uses xampp/apache/bin/php.ini
Try making your edits in that file and see what phpinfo() tells you then.
Good Luck :)
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 45 guests