grails 列出i18n内容

在gsp页面中增加以下代码

<body>
<g:each in="${grailsApplication.domainClasses}" var="dc">
    ## --------------  ${dc.logicalPropertyName} -----------------------<br/>
    <g:each in="${dc.properties?.sort { it.name }}" var="f" status="i">
        <%
            def propLabel = dc.logicalPropertyName + "." + f.name + ".label"
            def propI18n = message(message: propLabel)

        %>
        <g:if test="${i == 0}">
            <%
                def domainLabel = dc.logicalPropertyName + ".label"
                def domainI18n = message(message: domainLabel)
            %>
            ${domainLabel}=${domainI18n.equals(domainLabel) ? '' : domainI18n}<br/>
        </g:if>
        <g:if test="${!'version'.equals(f.name)}">
            ${propLabel}=${propI18n.equals(propLabel) ? '' : propI18n}<br/>
        </g:if>
    </g:each>
    <br/>
</g:each>
</body>

会列出所有的字段,以及i18n对比

你可能感兴趣的:(grails)