如何在messages.properties中设置消息以获取翻译的标签? (我在Grails 2.4.4上)
域:
int handledBy
messages.properties:
Case.handledBy.1=Handled by A
Case.handledBy.2=Handled by B```
查看:
<g:radioGroup name="handledBy" values="[1,2]">
<tr class="prop">
<td valign="top" class="name">
<label><g:message code="${it.label}" />:</label>
</td>
<td valign="top" class="value ${hasErrors(bean:CaseInstance,field:'handledBy','errors')}">
${it.radio}
</td>
</tr>
</g:radioGroup>
答案 0 :(得分:2)
您可以使用g:radioGroup标记的labels
属性,例如
<g:radioGroup name="handledBy" values="[1, 2]" labels="['Case.handledBy.1', 'Case.handledBy.2']">
...
<label><g:message code="${it.label}"/>:</label>
...
</g:radioGroup>
并在messages.properties
中添加消息Case.handledBy.1=Handled by A
Case.handledBy.2=Handled by B