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: and unzip it …

2) Add the following files found in the package root in the same folder as test-language.php :
– gettext.php
– streams.php

gettext wampserver display

3) Open your php.ini and comment out wampserver php_gettext.dll:


RESTART All services

3) This is the new test file test-language.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');


$supported_locales = array('en_US', 'sr_CS', 'de_CH','es_ES');
$encoding = 'UTF-8';

$locale = (isset($_GET['lang']))? $_GET['lang'] : DEFAULT_LOCALE;


// 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);

echo gettext("HELLO_WORLD");

Now you can visit http://localhost/test/languages/test-language.php and you should see Hola



Since 30 years I work on Database Architecture and data migration protocols. I am also a consultant in Web content management solutions and medias protecting solutions. I am experienced web-developer with over 10 years developing PHP/MySQL, C#, VB.Net applications ranging from simple web sites to extensive web-based business applications. Besides my work, I like to work freelance only on some wordpress projects because it is relaxing and delightful CMS for me. When not working, I like to dance salsa and swing and to have fun with my little family.

You may also like...

Leave a Reply