Enum Class LanguageCode

java.lang.Object
java.lang.Enum<LanguageCode>
com.luna.common.i18n.LanguageCode
All Implemented Interfaces:
Serializable, Comparable<LanguageCode>, java.lang.constant.Constable

public enum LanguageCode extends Enum<LanguageCode>
ISO 639-1 language code.

Enum names of this enum themselves are represented by ISO 639-1 code (2-letter lower-case alphabets).

 // List all the language codes.
 for (LanguageCode code : LanguageCode.values())
 {
     // For example, "[ar] Arabic" is printed.
     System.out.format("[%s] %s\n", code, code.getName());
 }

 // Get a LanguageCode instance by ISO 639-1 code.
 LanguageCode code = LanguageCode.getByCode("fr");

 // Convert to a Locale instance.
 Locale locale = code.toLocale();

 // Get a LanguageCode by a Locale instance.
 code = LanguageCode.getByLocale(locale);

 // Get a list by a regular expression for names.
 //
 // The list will contain:
 //
 //     LanguageCode.an : Aragonese
 //     LanguageCode.ja : Japanese
 //     LanguageCode.jv : Javanese
 //     LanguageCode.su : Sundanese
 //     LanguageCode.zh : Chinese
 //
 List<LanguageCode> list = LanguageCode.findByName(".*nese");
 
Author:
Takahiko Kawasaki