Forum OpenACS Development: Substitution of "@" and "#" in acs-templating ...

When "#" was added to the greenpeace custom templating code by Lars, "#" substitution was done after "@" substitution.

That means you can pull a message key out of the database, include it in your .adp file, and have it be translated automatically.

Is there any reason why this is not true in the production version of parse-procs.tcl in our code base?

In other words "set foo <span>#</span>package_key.message_key#" followed by @foo@ in the .adp file doesn't translate the key ...

No, no reason. I wasn't aware of (or had forgotten about) this possibility in the GP code.

/Lars

Don,
I think doing # substitution after the @ one would be a very nice change indeed. It would make the clumsy use of lang::util::localize that you can find scattered in the code now (in some places even in adp files I believe) unnecessary. I wish we would have thought of this earlier... 😊
Actually, I was wrong about it working in Greenpeace but heck, it's still a good idea and I'm going to investigate making it work on HEAD :)
OK this has been committed to HEAD, I'd appreciate some testing by y'all if you have a chance!

My portal edit page now displays the localized portlet name correctly and a simple test of vars and array vars with and without noquote seems to work ...

Can this be used to do double substitution in an .adp file?

For example:

#myvariable.@variable_name@#

?

Or is this only pertinent to internationalization?

No, this simply causes variable values to be translated at run time.  The kind of endless nested substitution you're asking about can't be done with a compiled template approach because the run time values aren't constant, of course.  Going to a compile-per-view model rather than a compile-and-cache model would make the template system very slow.