Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

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

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
tarmstrong
Smarty n00b


Joined: 15 Feb 2016
Posts: 3

PostPosted: Mon Feb 15, 2016 6:05 pm    Post subject: My smarty-gettext 'Hello world' sample is not working Reply with quote

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
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Mon Feb 15, 2016 6:20 pm    Post subject: Reply with quote

You're not debugging your application.
And you're using Smarty2 for a new project.
Back to top
View user's profile Send private message
CrazyTemplate
Smarty Rookie


Joined: 12 Sep 2011
Posts: 31

PostPosted: Mon Feb 15, 2016 9:52 pm    Post subject: Reply with quote

First of all, download and start using Smarty v3.

You are probably not loading Smarty correctly, take a look how I do it, here:
https://github.com/noumenia/nyx/blob/master/library/templatefactory.inc.php
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP