smarty and GNU gettext
[email protected] (D_C) Tue, 30 May 2006 21:11:05 +0900
| Newsgroups | php.smarty.general |
|---|---|
| Message-ID | <[email protected]> |
hi list -
there is a great GNU library for dealing with localisation, that has a
php function gettext()
http://www.php.net/manual/en/function.gettext.php
many high-end PHP projects use this (wordpress, drupal).
I was wondering if there is a way to use this with smarty?
basically gettext is a php function, so if this is used in the middle
of a smarty template, it will make templates really ugly. I think!
Unless there is a clean way to inline php funcs inside smarty...
also, since a php funciton is being called in the middle of a
template, i imagine this stops smarty from being able to pre-compie/
cache the template itself?
So, any suggested approaches?
Can a modifier function work directly on a string? eg if i created a
localize() modifier that called gettext, then:
had a template like this:
{ "message list" | localize }
rather than puttig the english "message list" in a separate tag to be
passed to smarty:
{$messageListTag|localize}
this would require all the tags to be read in ahead of time, and
another level of indirection + probably reading lots of irrelevant
tags per page.
thanks for any help as always!
/dc
--
_______________________________________________
David "DC" Collier
[email protected]
skype: callto://d3ntaku
http://www.pikkle.com
+81 (0)80 6521 9559
http://charajam.com
J-POP
FlashFlash
_______________________________________________