2017-12-27 206 views
1

我有多个.gsp视图使用一个Grails模板文件,被称为是这样的:传递一个国际化的消息作为参数传递给一个Grails模板

<g:render template="/template/mail/notification/notification_email" model="[ 
    title: 'A string', 
    text: 'Another string', 
]"/> 

不过,我想移动A stringAnother string添加到messages.properties文件。

如果我不能在<g:render>标记内使用<g:message>,我如何才能将模板模型值设置为适当的值?

回答

1

对我来说,以下工作:

<g:render template="/template/mail/notification/notification_email" model="[ 
    title: g.message(code: 'your.title'), 
    text: g.message(code: 'your.text'), 
]"/> 
+0

是的这是正确的感谢! – Raibaz