Gettext on WAMP / Windows

Discussion in 'PHP' started by vineld, Feb 26, 2014.

  1. #1
    I have some difficulties working out how to make the native gettext extension work in my WAMP environment on Windows 7. I have tried everything I can think of but still nothing. I have now stripped everything down to a simple example:

    <?php
    header( 'Content-Type: text/html; charset=UTF-8' );
    
    $locale = "Dutch_Netherlands.1252";
    
    if (!function_exists("gettext"))
      {
      echo "gettext is not installed";
      }
      else
      {
      echo "gettext is supported";
      }
    
    var_dump(putenv("LC_ALL=$locale"));
      echo "Exist?: ".setlocale(LC_ALL,  $locale);
      textdomain('messages');
      bindtextdomain('messages', '/[MY LOCAL PATH]/locale');
      echo gettext("Service");
    ?>
    PHP:
    Everything seems to work as it should until the gettext() function where everything just hangs and I eventually get a "connection interrupted" reply from the browser.

    I have placed the messages.po/mo file couple in this structure (which is correct I guess?):

    locale/Dutch_Netherlands.1252/LC_MESSAGES/

    The gettext extension has been activated in WAMP. I currently use the following setup:

    WAMP 2.1
    Apache 2.2.17
    PHP 5.3.4
     
    vineld, Feb 26, 2014 IP
  2. vineld

    vineld Greenhorn

    Messages:
    53
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    18
    #2
    Just figured it out myself. I simply installed a newer WAMP version. 32 bit this time, I think the previous installation was 64 bit but I'm not sure. Wish I did this immediately instead of spending 5 hours yesterday trying to solve the issue :) Now it works just fine..., although the local Windows locales are a bit annoying.
     
    vineld, Feb 26, 2014 IP