How to organize Java properties entries for internationalization?

北城以北 提交于 2019-12-05 13:43:24

I don't think there is a universal "better way". I tried Googling for "best practice" advice on this, and found nothing that talked about how best to structure the property namespace for i18n.

(This I found somewhat surprising. There's usually someone out there who is prepared to put forward their ill-considered opinions on something like this as "best practice". Or perhaps, I'm too cynical.)

FWIW, my general advice would be:

  • be systematic and consistent about the property names and the property file structure,.
  • don't be afraid to use resource bundle inheritance if there is a lot of duplication,
  • if the property files or resource bundles get too large, partition them.

But I expect you already know and do all of that.

Finally, don't get too hung up about getting this "just right". There is no perfect solution, and what you are currently doing is probably good enough ... according to the criteria of whoever is paying you to do this work.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!