html - Grails render tag and message.properties -
i using g:render grails tag avoid repeat common part of html in app repeated. need in of them pass properties, such title of sections, through message.properties file can translated. make work i'm using structure:
<g:set var="title" value="${g.message (code: 'completed.thanks')}" /> <g:render template="thankyou" contextpath="/completed/" model="[title:title,other:other]" />
but wondering if there better solution provide string in model of render tag itself.
if properties passed many approach can not best. in case suggest reate custo implementation of g:message using customtaglib. custom gmessage can example convention looking properties prefixed model parameter. in render of gsp can set prefix string in model.
<g:render template="thankyou" contextpath="/completed/" model="[prefix: 'pagex']" />
in template gsp:
... <custom:message code="completed.thanks" prefix="${prefix}"/> <custom:message code="completed.byebye" prefix="${prefix}"/> ...
in properties file
pagex.thanks=bla bla bla pagex.byebye=bla bla bla pagey.thanks=bla bla bla pagey.byebye=bla bla bla
Comments
Post a Comment