作者:Kris-Guo | 来源:互联网 | 2022-12-09 13:27
在我的Grails 2.4.4应用程序中,我使用messages.properties进行国际化,具有以下值:
my.app.thing.allowance(s)={0} Allowance(s)
它正在使用像这样的gsp:
对于任何大于0的值,都会正确显示该消息,例如,如果item.allowances.size() == 4
显示的消息是,则显示消息4 Allowances(s)
问题是,如果item.allowances.size() == 0
那时显示的消息是{0} Allowance(s)
我试图用几种不同的方式编写args,例如:
我调试过的东西,我确信item.allowances.size() == 0
但由于某种原因,它无法正确处理值0.将一个int值为0的参数传递给messages.properties的正确方法是什么?
1> Bharat Satij..:
在g.message
参数中总是作为一个传递List
.
来自:http://docs.grails.org/3.0.17/ref/Tags/message.html
args(可选) - 使用代码时应用于消息的参数值列表.
请尝试使用此代码: