2017-12-27 207 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