enapps-enorman commented on PR #22:
URL: 
https://github.com/apache/sling-org-apache-sling-scripting-sightly/pull/22#issuecomment-1340162867

   Could this be solved with something like a looking for a well known request 
attribute name that specifies the default basename to use?  Then you could use 
something like a servlet filter to set that request attribute for the pages 
where you can't or don't want to change the HTL files?
   
   I'm thinking something that a request attribute may be more flexible than a 
component interface.  For example, I would like to declare the default basename 
in the PostContruct init method of my page model so I don't have to keep 
repeating the basename on every i18n expression.
   
   I've been using a technique (see example below) to shorten the repetitive 
basename on every string by declaring the basename as a variable at the top of 
the page and using that variable everywhere, but if I could declare the 
basename once in the page model's PostConstruct init method as a request 
attribute (or some other declarative way), it would simplify the HTL code as I 
could exclude the repetitive basename clauses everywhere.
   
   For example, currently I have to do something like this:
   `<sly data-sly-set.rb="my.basename.here"></sly>
   
   ${"key1" @ i18n, basename=rb}
   ${"key2" @ i18n, basename=rb}`
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to