Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File naming convention for i18n Internationalization

 
Darien Cheung
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using Struts 1.2, JSP 2.0 and Tomcat 5.5. Does the message resource bundle file name have to follow the convention "bundlename_language_country.properties"? I find that some examples such as on apache.org simply use "bundlename_xx.properties" but when I use that naming convention, my messages are not formatted, instead I get the usual ??US_keyname??
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The way it works is this:

1-bundlename.properties (no suffix) is the defult, and is used if there is no match to language or country.

2-If you specify bundlename_xx where xx is a two-character language code, this bundle will match all locales that use that language.

3-If you specify bundlename_xx_YY where xx is a language code and YY is a country code, The bundle must match both the language and the country of the user's locale.

4-if you specify bundlename_yy where yy is a country code, it will not work.
[ September 12, 2006: Message edited by: Merrill Higginson ]
 
Darien Cheung
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for clarifying!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic