views:

1228

answers:

4

I've been tasked with the awesome job of generating a look-up table for our application culture information. The columns I need to generate data for are:

  • Dot Net Code
  • Version
  • Culture Name
  • Country Name
  • Language Name
  • Java Country Code
  • Java Language Code
  • Iso Country Code
  • Iso Language Code

I have found the globalization name space, but I'm sure someone out there has asked the same question, or there is a table already available.

Thanks for any help

+1  A: 

Java uses the 2-letter ISO country and language codes. I recommend getting rid of the "Java Country Code" and "Java Language Code" fields in your lookup table, since they would be redundant.

I assume that wherever you get your ISO country and language codes, you'll find their corresponding names in English. However, the Java Locale API will give also you the localized names for the country and language, if you need them. (I.e., what is America called in Japan?)

For example, you can do this:

Locale l = Locale.ITALY;
System.out.println(l.getDisplayCountry() + ": " + l.getDisplayLanguage());
System.out.println(l.getDisplayCountry(l) + ": " + l.getDisplayLanguage(l));

Which, running in the US English locale prints:

Italy: Italian 
Italia: italiano

Note that you can obtain 3-letter ISO codes from the Locale class, but when constructing them, be sure to only use 2-letter codes.

erickson
A: 

Java uses Locales to store this information. Most of all the information you need regarding it can be found on Sun's Internationalization page. Java uses a syntax similar to the "en-us" syntax, however rather than using a hyphen it delineates with an underscore.

Elijah
A: 

I'm guessing that you mean Localization or Internationalization or i18n.

Try this tutorial:
    http://java.sun.com/docs/books/tutorial/i18n/index.html

Good Luck, Randy Stegbauer

Randy Stegbauer
+2  A: 

That's strange, the last time I visited this page, someone had beaten me to posting the links to the Java references for Localization.

However, since their post is gone, here's what I was writing before they beat me to it.

Java uses two ISO standards for localization with java,util.Locale.

R. Bemrose