开发者

Java EE i18n without property files

开发者 https://www.devze.com 2023-01-12 16:19 出处:网络
开发者_StackOverflow中文版normally I place my translations etc in properties - e.g. message_de.properties etc. I\'m facing now a situation where I have to provide this data in a database. (Translation
开发者_StackOverflow中文版

normally I place my translations etc in properties - e.g. message_de.properties etc. I'm facing now a situation where I have to provide this data in a database. (Translations will be imported/edited in an other system)

Is there a common way/best practises to use a database table for messages in my webapp? One way I would thinking of was to build properties from the database but this seems not the right way to go.


A ResourceBundle doesn't need to be based on a properties file, you can write your own implementation and back them with JDBC or whatever tickles your fancy. The ResourceBundle javadoc page has an example on how to make a custom implementation.


To me it sounds like exporting the database to properties files would be the correct way to go. It's simple and I would assume the database does not change that often? The export can then be automated different ways.

0

精彩评论

暂无评论...
验证码 换一张
取 消