How do I get gettext and poedit to work with WAMP?
The problem can be solved but not in the traditional way. You have to use the php-gettext extension instead of the gettext which comes default built into php wampserver.
Follow these steps :
1) Download php-gettext from here: https://launchpad.net/php-gettext/+download and unzip it …
2) Add the following files found in the package root in the same folder as test-language.php :
– gettext.inc
– gettext.php
– streams.php
3) Open your php.ini and comment out wampserver php_gettext.dll:
;extension=php_gettext.dll
RESTART All services
3) This is the new test file test-language.php
<?php error_reporting(E_ALL | E_STRICT); // define constants define('PROJECT_DIR', realpath('./')); define('LOCALE_DIR', 'C:/wamp/www/test/languages'); define('DEFAULT_LOCALE', 'es_ES'); require_once('gettext.inc'); $supported_locales = array('en_US', 'sr_CS', 'de_CH','es_ES'); $encoding = 'UTF-8'; $locale = (isset($_GET['lang']))? $_GET['lang'] : DEFAULT_LOCALE; //var_dump($locale);die(); // gettext setup T_setlocale(LC_MESSAGES, $locale); // Set the text domain as 'messages' $domain = 'messages'; bindtextdomain($domain, LOCALE_DIR); // bind_textdomain_codeset is supported only in PHP 4.2.0+ if (function_exists('bind_textdomain_codeset')) bind_textdomain_codeset($domain, $encoding); textdomain($domain); echo gettext("HELLO_WORLD"); ?>
Now you can visit http://localhost/test/languages/test-language.php and you should see Hola
Cheers