Using the default smarty variable modifier with gettext

I am currently using smarty with the zend framework and I configured smarty to use gettext like this:

{gettext text="resource-identifier"}

      

This works correctly, but I'm having a problem trying to use this with the smarty default variable handler. I want to do this:

{$somevar|default:gettext text="resource-identifier"}

      

But this only prints "gettext". Any suggestions how I can do this. Is it possible?

0


a source to share


1 answer


It is not possible for smarty to link the result of a function. You will need to see if gettext can assign its result to a variable (assign = varname param) or write your own (at which point just write a new modifier that looks like default_gettext: "resource-id")

in its intended purpose, it would look like this:

{gettext text="resource-id" assign="myvar"}
{$somevar|default:$myvar}

      



In the new modifier, it will look like this:

{$somevar|default_gettext:"resource-id"}

      

0


a source







All Articles