|
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 |
YBTD Smarty n00b
Joined: 18 Nov 2011 Posts: 1
|
Posted: Fri Nov 18, 2011 2:21 pm Post subject: Problems with gettext |
|
|
Hello,
I seem to have a problem with the block.t plugin for smarty (http://smarty.incutio.com/?page=SmartyGettext)
I have a template, with the following text:
The output to the screens is the following:
Code: | Project-Id-Version: Want2Be
POT-Creation-Date:
PO-Revision-Date:
Last-Translator:
Language-Team:
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Poedit-SourceCharset: utf-8
X-Poedit-Language: Dutch
X-Poedit-Country: Belgium
X-Poedit-KeywordsList: _;gettext
Laatste nieuws |
The last line is the exact translation to Dutch, but what about all the stuff that is coming above it, how do I remove it, or what did I do wrong? |
|
Back to top |
|
Hal9000 Smarty n00b
Joined: 02 Dec 2011 Posts: 1
|
Posted: Fri Dec 02, 2011 10:00 pm Post subject: |
|
|
You are doing nothing wrong.
I was having the exact same problem since Smarty 3.1 came out.
After some digging today I found out that for some reason the block function gets called twice, once with an empty string, once with the string from the template.
I suspect this is a Smarty bug, however you can easily work around this problem by adding this at the beginning of the smarty_block_t function in block.t.php (i am using version 1.0b):
Code: | if (!$text) return; |
|
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Fri Dec 02, 2011 10:18 pm Post subject: |
|
|
It's not a smarty bug. Block functions are called always without content at the start tag to allow for initalization code (handle passed parameter etc).
What has changed since 3.1 is that a returned value is also eched on the starting tag. This was changed as we had lot of request for it. |
|
Back to top |
|
jebediah Smarty Rookie
Joined: 28 Jan 2012 Posts: 16
|
Posted: Sat Dec 01, 2012 3:42 pm Post subject: smarty-gettext |
|
|
Hi there,
I found the i18n support of Smarty (not per see, but as the whole process) a bit lacking. That's why I've implemented and released a smarty-gettext project that enables full i18n support for Smarty, including the creation of po files, etc.
Have a look here: http://code.google.com/p/smarty-gettext/
any feedback, etc. would be very much appreciated!
Bests,
Charly |
|
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
|