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

Can i display the config label when entry is not existing ?

 
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
bougli
Smarty Rookie


Joined: 04 Oct 2018
Posts: 6

PostPosted: Mon Oct 22, 2018 7:10 am    Post subject: Can i display the config label when entry is not existing ? Reply with quote

Hello
I can't find anything about that.
Is there a way to display by default the translation label i used if this entry is not present in config file ?

For instance : {#something_here#}

If something_here is not present in config file, so it will display as is, instead of displaying nothing.

It's really helpful when you have several translations and texts are missing in some of them.

thanks for you help !
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Mon Oct 22, 2018 12:06 pm    Post subject: Reply with quote

`{#name#}` is not a localization string, it's a configuration variable.
In absence of value it is expanded to an empty string, which is quite predictable.
If you want proper localization, go ahead and write one.
Set up parser that will capture and account all the config variables used in your templates, and ensure they all accounted for in the respective configuration files.
Back to top
View user's profile Send private message
bougli
Smarty Rookie


Joined: 04 Oct 2018
Posts: 6

PostPosted: Mon Oct 22, 2018 12:43 pm    Post subject: Reply with quote

Thanks for your answer, yes i'm using configuration variable.
i understand what you said, but my question is still good.
For some reasons, it would be very helpful to display the variable name when not refering to an existing entry in config files.
So the only way for me is to "hack" smarty ?
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Mon Oct 22, 2018 1:30 pm    Post subject: Reply with quote

No, "hacking" is what you are doing right now.
The only way out of "hacking" is to use proper tools to solve specific issues.
Back to top
View user's profile Send private message
bsmither
Smarty Elite


Joined: 20 Dec 2011
Posts: 322
Location: West Coast

PostPosted: Mon Oct 22, 2018 3:59 pm    Post subject: Reply with quote

I am not aware of any specific Smarty setting, but if you are willing to go the extra step, this may work:
Code:
{$variable|default:"<strong>{ldelim}variable{rdelim}</strong>"}
(I haven't tested this.)

See also: https://www.smarty.net/docs/en/tips.tpl#tips.blank.var.handling
Back to top
View user's profile Send private message
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