|
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 |
zakwil Smarty n00b
Joined: 30 Jul 2014 Posts: 4 Location: France
|
Posted: Wed Jul 30, 2014 7:24 am Post subject: [Solved]Creation on a custom function for {_("")} |
|
|
Hello,
I want to display multilingual text with smarty3, I tried to use {_("text")}, which displays 'text', but I want to add custom php code to handle the i18n.
Can someone could tell me where should I put my php code?
Solution : In the cache dir the I found : <?php echo _("textned");?>
I just need to handle the php function _() |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Wed Jul 30, 2014 8:51 pm Post subject: |
|
|
The '_' function is an alias for the PHP gettext function. It can't be redeclared.
A possible solution would be to implement a modifier.
See http://www.smarty.net/docs/en/plugins.modifiers.tpl
Which could be called like this:
|
|
Back to top |
|
zakwil Smarty n00b
Joined: 30 Jul 2014 Posts: 4 Location: France
|
Posted: Thu Jul 31, 2014 6:14 am Post subject: |
|
|
Yes, a modifer call simply "t" is another good solution.
I can use the _() function because I don't add the php gettext extension ; that was my first choice, but I get a bug with the bindtextdomain...
Thanks for your answser by the way. |
|
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
|