And*_*rew 14 grails internationalization
使用国际插件,是否有一种"正确"的方式来动态复数单词,或选择属性的复数版本?
Rob*_*her 21
您可以ChoiceFormat在i18n消息中使用嵌入式.使用从一个例子中java.text.MessageFormat的Javadoc您可以定义是这样的:
numfiles.message = "There {0,choice,0#are no files|1#is one file|1<are {0,number,integer} files}."
Run Code Online (Sandbox Code Playgroud)
然后在你的GSP中:
<g:message code="numfiles.message" args="[numfiles]"/>
Run Code Online (Sandbox Code Playgroud)
哪里numfiles是整数值.