Unit to develop a Web program, I do not understand PHP, Java, the emergency cramming Internet to find a bit, said Grails development how fast, and so on. A trial, a few minutes on the use of scaffold (scaffolding) developed a program, but the effect is full English, database fields do not accept Chinese. Online with the Chinese field, change the field display related articles, posts did not, had to buy the province science and Technology bookstore only one of the grails aspects of the book, but according to the book operation to modify the i18n inside the Chinese information, no effect, I feel that my version is different from the version introduced in the book, because I use the most new version 1.3.7. Fortunately, the book has an experience to help me, it said can generate scaffold all the code to analyze, I actually do not understand the groovy language, but reluctantly programming also a bit of a bottom, carefully analyzed to see how to use the i18n "Han" scaffold generated interface.
Attached: Grails version: 1.3.7
I use NetBeans6.9 as the IDE, and NetBeans support for grails is pretty good. NetBeans After you open the project name, the general i18n file is stored in the "message package", locate and open the Messages_zh_cn.properties file, and NetBeans will automatically help you with all Unicode transcoding issues. Add the following lines to the file for the buttons and hints for the Chinese scaffold:
Default.create.label= new Record {0}
Default.edit.label= Edit {0}
Default.home.label= Home
DEFAULT.LIST.LABEL={0} List of details
Default.new.label= new {0} record
default.show.label= Display {0}
Default.button.create.label= New Save
default.button.delete.label= Delete
Default.button.delete.confirm.message= Are you sure you want to delete it.
Default.button.edit.label= Edit
default.button.update.label= Change
Default.created.message= a new
Default.deleted.message= deleted the
Default.updated.message= has updated
Then also to the database field of the title of the Chinese, for example, there is a database table called student, the database of a table in Grails called Domain (field), the table has name name, learning number SID, gender gender and other fields, and then add the following information in the file ( Note that the student has been changed to lowercase, and this is done with the Grails case-sensitive principle and case sensitivity, especially field names, which cannot begin with uppercase:
student.label= Student Information
student.name.label= Name
Student.sid.label= School Number
student.gender.label= Sex
Attached: The original contents of the Student.groovy file for the reader to reference:
Class Student {
String Name//Name
String SID//study number
String Gender//gender
static constraints = {
}
}
2011/2/25 change: default.edit.label= edit to default.edit.label= edit {0}, this {0} shows the database name, here is the student information, English is student.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.