My smarty-gettext 'Hello world' sample is not working

289 views Asked by At

Using Smarty 2.6.28 over PHP 5.6.11, I'm trying to create a Multi-language website. For that, I'm trying to use 'smarty-gettext' (https://github.com/smarty-gettext/smarty-gettext). The root directory of my web server is '/foo'.

I followed the directions to install it, and "simply copied block.t.php and function.locale.php to my Smarty plugins directory" (i.e. 'foo/Smarty-2.6.28/libs/plugins').

I created the the 'foo/locale/de/LC_MESSAGES' directory, with a 'messages.po' file:

msgid "Hello_World"
msgstr "Hallo Welt!"

which I converted intto a 'messages.mo' file.

I created a .php file

<?php    
putenv('LC_ALL=de');
setlocale(LC_ALL, 'de');    
require_once("Smarty-2.6.28/libs/Smarty.class.php");
$smarty = new Smarty(); 
$smarty->display("test.html");
?>

And created a template 'test.html':

<h1>
{t}Hello_World{/t}
</h1> 

However, the text "Hallo Welt!" is not shown, but only "Hello_World".

What am I doing wrong? Thank you very much in advance.

0

There are 0 answers