Are there any constants for language codes like "en" or "de" in java or in a java library? (Or is using the strings OK?)
I know that something like
Locale.COUNTRY-NAME.getLanguage()
would work, but I am searching for something more streamlined like
Locale.LANGUAGE-NAME
I am afraid there aren’t constants for all languages.
You do have several predefined Locales such as
Locale.UKLocale.US, etc. Each locale has a language code which can be obtained via thegetLanguage()method.To get all language code supported by the underlying JVM use
getISOLanguages()More details: http://download.oracle.com/javase/1.4.2/docs/api/java/util/Locale.html