|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
tarmstrong Smarty n00b
Joined: 15 Feb 2016 Posts: 3
|
Posted: Mon Feb 15, 2016 6:05 pm Post subject: My smarty-gettext 'Hello world' sample is not working |
|
|
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:
Code: | msgid "Hello_World"
msgstr "Hallo Welt!" |
which I converted intto a 'messages.mo' file.
I created a .php file
Code: |
<?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':
Code: | <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. |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Mon Feb 15, 2016 6:20 pm Post subject: |
|
|
You're not debugging your application.
And you're using Smarty2 for a new project. |
|
Back to top |
|
CrazyTemplate Smarty Rookie
Joined: 12 Sep 2011 Posts: 31
|
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|