简体   繁体   English

重命名Grails域类中的显示字段名称

[英]Rename Displayed Field Name in Grails Domain Class

Given the following Grails Domain Classes, how do I go about renaming the displayed field name for isbn to be "ISBN" (as opposed to the default "Isbn") and authors to be "Author(s)" (as opposed to the default "Authors")? 鉴于以下Grails域类,如何将isbn的显示字段名称重命名为“ISBN”(而不是默认的“Isbn”),并将作者重命名为“Author(s)”(与默认值相对) “作者”)?

class Book {
    String name
    String isbn
    static hasMany = [ authors: Author ]
}

class Author {
    String name
}

You can just use messages.properties file for that. 你可以使用messages.properties文件。 Go to grails-app --> i18n --> messages.properties 转到grails-app - > i18n - > messages.properties

and define message like: 并定义如下消息:

'<full packagePath>.<domain name>.<propertyName>.<attribute>' = <message>

book.isbn.label = ISBN book.isbn.label = ISBN

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM