我想将messages.properties拆分成几个文件,例如一个将包含验证消息,而另一个则为FAQ或ToS文本。grails拆分i18n文件(messages.properties)
我一直在寻找,我发现这个网站:http://mrhaki.blogspot.com.es/2011/03/grails-goodness-splitting-i18n-message.html
但没有奏效。
这是可能的,或者我只是失去了我的时间?
谢谢先进。
编辑:我使用Grails 2.3.0
我想将messages.properties拆分成几个文件,例如一个将包含验证消息,而另一个则为FAQ或ToS文本。grails拆分i18n文件(messages.properties)
我一直在寻找,我发现这个网站:http://mrhaki.blogspot.com.es/2011/03/grails-goodness-splitting-i18n-message.html
但没有奏效。
这是可能的,或者我只是失去了我的时间?
谢谢先进。
编辑:我使用Grails 2.3.0
在国际化的文件夹中,我创建customValidation.properties和view.properties。对我来说工作得很好。您必须遵守保留在i18n文件夹中的惯例,除了表示语言环境外,您不能在名称中使用下划线。
@Gregg,谢谢你的提示。
顺便说一句,要保持良好的结构工程,你也可以嵌套的i18n文件中的子目录,这样的:
grails-app
|--i18n
|--|--en_US
|--|--|--messagesUserProfile_en_US.properties
|--|--|--messagesRegistration_en_US.properties
|--|--|--messagesCommon_en_US.properties
|--|--pl_PL
|--|--|--messagesUserProfile_pl_PL.properties
|--|--|--messagesRegistration_pl_PL.properties
|--|--|--messagesCommon_pl_PL.properties
+1为“无底线”的规则 - 这抓住了我了第一次我试过了... –
它像一个魅力工作!但是我每次创建新的属性文件时都需要重新启动应用程序。 – Gerard
是的,但不是每次你修改一个。 – Gregg