|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD | ||||||||
java.lang.Objectjava.lang.Enum<LocaleCode>
com.neovisionaries.i18n.LocaleCode
public enum LocaleCode
Locale code.
The entries of this enum was generated based on the output from
Locale.getAvailableLocales() of Java SE 7, but locales whose
format do not match either 'xx' or 'xx-XX' were excluded.
// List all the locale codes. for (LocaleCode code : LocaleCode.values()) { String language = code.getLanguage().getName(); String country = code.getCountry()!= null ? code.getCountry().getName(): null; // For example, "[de-DE] German, Germany" is printed. System.out.format("[%s] %s, %s\n", code, language, country); } // Get a LocaleCode instance in various ways. LocaleCode code; code = LocaleCode.getByCode("en-GB"); code = LocaleCode.getByCode("es", "ES"); code = LocaleCode.getByLocale(new Locale("pt", "BR")); // Convert to a Locale instance. Locale locale = LocaleCode.en.toLocale(); // toLocale() of some LocaleCode instances does not create // a new Locale instance but returns a static variable of // Locale class instead. SeetoLocale()for details. if (locale == Locale.ENGLISH) { System.out.println("Locale.en.toLocale() returned Locale.ENGLISH"); }
| Method Summary | |
|---|---|
static LocaleCode |
getByCode(String code)
Get a LocaleCode instance that corresponds to the given code. |
static LocaleCode |
getByCode(String code,
boolean caseSensitive)
Get a LocaleCode instance that corresponds to the given code. |
static LocaleCode |
getByCode(String language,
String country)
Get a LocaleCode instance that corresponds to the given pair of language code and country code. |
static LocaleCode |
getByCode(String language,
String country,
boolean caseSensitive)
Get a LocaleCode instance that corresponds to the given pair of language code and country code. |
static LocaleCode |
getByLocale(Locale locale)
Get a LocaleCode instance that corresponds to the given Locale instance. |
CountryCode |
getCountry()
Get the country code. |
LanguageCode |
getLanguage()
Get the language code. |
Locale |
toLocale()
Convert this LocaleCode instance to a Locale instance. |
String |
toString()
Get the string representation of this locale code. |
static LocaleCode |
valueOf(String name)
Returns the enum constant of this type with the specified name. |
static LocaleCode[] |
values()
Returns an array containing the constants of this enum type, in the order they are declared. |
| Methods inherited from class java.lang.Enum |
|---|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Enum Constant Detail |
|---|
public static final LocaleCode ar
Arabic
public static final LocaleCode ar_AE
Arabic, United Arab Emirates
public static final LocaleCode ar_BH
Arabic, Bahrain
public static final LocaleCode ar_DZ
Arabic, Algeria
public static final LocaleCode ar_EG
Arabic, Egypt
public static final LocaleCode ar_IQ
Arabic, Iraq
public static final LocaleCode ar_JO
Arabic, Jordan
public static final LocaleCode ar_KW
Arabic, Kuwait
public static final LocaleCode ar_LB
Arabic, Lebanon
public static final LocaleCode ar_LY
Arabic, Libya
public static final LocaleCode ar_MA
Arabic, Morocco
public static final LocaleCode ar_OM
Arabic, Oman
public static final LocaleCode ar_QA
Arabic, Qatar
public static final LocaleCode ar_SA
Arabic, Saudi Arabia
public static final LocaleCode ar_SD
Arabic, Sudan
public static final LocaleCode ar_SY
Arabic, Syrian Arab Republic
public static final LocaleCode ar_TN
Arabic, Tunisia
public static final LocaleCode ar_YE
Arabic, Yemen
public static final LocaleCode be
Belarusian
public static final LocaleCode be_BY
Belarusian, Belarus
public static final LocaleCode bg
Bulgarian
public static final LocaleCode bg_BG
Bulgarian, Bulgaria
public static final LocaleCode ca
Catalan
public static final LocaleCode ca_ES
Catalan, Spain
public static final LocaleCode cs
Czech
public static final LocaleCode cs_CZ
Czech, Czech Republic
public static final LocaleCode da
Danish
public static final LocaleCode da_DK
Danish, Denmark
public static final LocaleCode de
German
public static final LocaleCode de_AT
German, Austria
public static final LocaleCode de_CH
German, Switzerland
public static final LocaleCode de_DE
German, Germany
public static final LocaleCode de_LU
German, Luxembourg
public static final LocaleCode el
Greek
public static final LocaleCode el_CY
Greek, Cyprus
public static final LocaleCode el_GR
Greek, Greece
public static final LocaleCode en
English
public static final LocaleCode en_AU
English, Australia
public static final LocaleCode en_CA
English, Canada
public static final LocaleCode en_GB
English, United Kingdom
public static final LocaleCode en_IE
English, Ireland
public static final LocaleCode en_IN
English, India
public static final LocaleCode en_MT
English, Malta
public static final LocaleCode en_NZ
English, New Zealand
public static final LocaleCode en_PH
English, Philippines
public static final LocaleCode en_SG
English, Singapore
public static final LocaleCode en_US
English, United States
public static final LocaleCode en_ZA
English, South Africa
public static final LocaleCode es
Spanish
public static final LocaleCode es_AR
Spanish, Argentina
public static final LocaleCode es_BO
Spanish, Plurinational State of Bolivia
public static final LocaleCode es_CL
Spanish, Chile
public static final LocaleCode es_CO
Spanish, Colombia
public static final LocaleCode es_CR
Spanish, Costa Rica
public static final LocaleCode es_DO
Spanish, Dominican Republic
public static final LocaleCode es_EC
Spanish, Ecuador
public static final LocaleCode es_ES
Spanish, Spain
public static final LocaleCode es_GT
Spanish, Guatemala
public static final LocaleCode es_HN
Spanish, Honduras
public static final LocaleCode es_MX
Spanish, Mexico
public static final LocaleCode es_NI
Spanish, Nicaragua
public static final LocaleCode es_PA
Spanish, Panama
public static final LocaleCode es_PE
Spanish, Peru
public static final LocaleCode es_PR
Spanish, Puerto Rico
public static final LocaleCode es_PY
Spanish, Paraguay
public static final LocaleCode es_SV
Spanish, El Salvador
public static final LocaleCode es_US
Spanish, United States
public static final LocaleCode es_UY
Spanish, Uruguay
public static final LocaleCode es_VE
Spanish, Bolivarian Republic of Venezuela
public static final LocaleCode et
Estonian
public static final LocaleCode et_EE
Estonian, Estonia
public static final LocaleCode fi
Finnish
public static final LocaleCode fi_FI
Finnish, Finland
public static final LocaleCode fr
French
public static final LocaleCode fr_BE
French, Belgium
public static final LocaleCode fr_CA
French, Canada
public static final LocaleCode fr_CH
French, Switzerland
public static final LocaleCode fr_FR
French, France
public static final LocaleCode fr_LU
French, Luxembourg
public static final LocaleCode ga
Irish
public static final LocaleCode ga_IE
Irish, Ireland
public static final LocaleCode he
Hebrew
public static final LocaleCode he_IL
Hebrew, Israel
public static final LocaleCode hi_IN
Hindi, India
public static final LocaleCode hr
Croatian
public static final LocaleCode hr_HR
Croatian, Croatia
public static final LocaleCode hu
Hungarian
public static final LocaleCode hu_HU
Hungarian, Hungary
public static final LocaleCode id
Indonesian
public static final LocaleCode id_ID
Indonesian, Indonesia
public static final LocaleCode is
Icelandic
public static final LocaleCode is_IS
Icelandic, Iceland
public static final LocaleCode it
Italian
public static final LocaleCode it_CH
Italian, Switzerland
public static final LocaleCode it_IT
Italian, Italy
public static final LocaleCode ja
Japanese
public static final LocaleCode ja_JP
Japanese, Japan
public static final LocaleCode ko
Korean
public static final LocaleCode ko_KR
Korean, Republic of Korea
public static final LocaleCode lt
Lithuanian
public static final LocaleCode lt_LT
Lithuanian, Lithuania
public static final LocaleCode lv
Latvian
public static final LocaleCode lv_LV
Latvian, Latvia
public static final LocaleCode mk
Macedonian
public static final LocaleCode mk_MK
Macedonian, The former Yugoslav Republic of Macedonia
public static final LocaleCode ms
Malay
public static final LocaleCode ms_MY
Malay, Malaysia
public static final LocaleCode mt
Maltese
public static final LocaleCode mt_MT
Maltese, Malta
public static final LocaleCode nl
Dutch
public static final LocaleCode nl_BE
Dutch, Belgium
public static final LocaleCode nl_NL
Dutch, Netherlands
public static final LocaleCode nn_NO
Norwegian Nynorsk, Norway
public static final LocaleCode no
Norwegian
public static final LocaleCode no_NO
Norwegian, Norway
public static final LocaleCode pl
Polish
public static final LocaleCode pl_PL
Polish, Poland
public static final LocaleCode pt
Portuguese
public static final LocaleCode pt_BR
Portuguese, Brazil
public static final LocaleCode pt_PT
Portuguese, Portugal
public static final LocaleCode ro
Romanian
public static final LocaleCode ro_RO
Romanian, Romania
public static final LocaleCode ru
Russian
public static final LocaleCode ru_RU
Russian, Russian Federation
public static final LocaleCode sk
Slovak
public static final LocaleCode sk_SK
Slovak, Slovakia
public static final LocaleCode sl
Slovene
public static final LocaleCode sl_SI
Slovene, Slovenia
public static final LocaleCode sq
Albanian
public static final LocaleCode sq_AL
Albanian, Albania
public static final LocaleCode sr
Serbian
public static final LocaleCode sr_BA
Serbian, Bosnia and Herzegovina
public static final LocaleCode sr_CS
Serbian, Serbia and Montenegro
public static final LocaleCode sr_ME
Serbian, Montenegro
public static final LocaleCode sr_RS
Serbian, Serbia
public static final LocaleCode sv
Swedish
public static final LocaleCode sv_SE
Swedish, Sweden
public static final LocaleCode th
Thai
public static final LocaleCode th_TH
Thai, Thailand
public static final LocaleCode tr
Turkish
public static final LocaleCode tr_TR
Turkish, Turkey
public static final LocaleCode uk
Ukrainian
public static final LocaleCode uk_UA
Ukrainian, Ukraine
public static final LocaleCode vi
Vietnamese
public static final LocaleCode vi_VN
Vietnamese, Viet Nam
public static final LocaleCode zh
Chinese
public static final LocaleCode zh_CN
Chinese, China
public static final LocaleCode zh_HK
Chinese, Hong Kong
public static final LocaleCode zh_SG
Chinese, Singapore
public static final LocaleCode zh_TW
Chinese, Taiwan, Province of China
| Method Detail |
|---|
public static LocaleCode[] values()
for (LocaleCode c : LocaleCode.values()) System.out.println(c);
public static LocaleCode valueOf(String name)
name - the name of the enum constant to be returned.
IllegalArgumentException - if this enum type has no constant
with the specified name
NullPointerException - if the argument is nullpublic LanguageCode getLanguage()
public CountryCode getCountry()
LocaleCode.en.getCountry() returns null.public String toString()
-country
where language is an ISO 639-1 code and country is an ISO 3166-1 alpha-2 code.
toString in class Enum<LocaleCode>public Locale toLocale()
Locale instance.
In most cases, this method creates a new Locale instance
every time it is called, but some LocaleCode instancess
return their corresponding entries in Locale class.
For example, LocaleCode.it always returns
Locale.ITALIAN.
The table below lists LocaleCode entries whose toLocale() do not create new Locale instances but return entries in Locale class.
public static LocaleCode getByCode(String code)
This method just calls getByCode(code, false).
code - A locale code.
getByCode(String, boolean)
public static LocaleCode getByCode(String code,
boolean caseSensitive)
The format of the code should be either of the following:
-country
where language is an ISO 639-1 code
and country is an ISO 3166-1
alpha-2 code. The separator between language and
country should be a hyphen (-) or an underscore
(_).
Note that if the language part of the given code is one of legacy ones { "iw", "ji" and "in" }, it is regarded as its newer official counterpart { "he", "yi" and "id", respectively }.
code - A locale code.caseSensitive - If true, the language part of the given code must be
lower-case and the country part, if not null, must be
upper-case. If false, this method internally canonicalizes
the given code and then performs search.
public static LocaleCode getByCode(String language,
String country)
This method just calls getByCode(language, country, false).
language - ISO 639-1 language code. If the given language code
is one of legacy ones { "iw", "ji" and "in" }, it is
regarded as its newer official counterpart { "he", "yi"
and "id", respectively }.country - ISO 3166-1 alpha-2 country code.
getByCode(String, String, boolean)
public static LocaleCode getByCode(String language,
String country,
boolean caseSensitive)
language - ISO 639-1 language code. If the given language code
is one of legacy ones { "iw", "ji" and "in" }, it is
regarded as its newer official counterpart { "he", "yi"
and "id", respectively }.country - ISO 3166-1 alpha-2 country code.caseSensitive - If true, the given language code must be lower-case and
the given country code, if not null, must be upper-case.
If false, this method internally canonicalizes the given
codes and then performs search.
public static LocaleCode getByLocale(Locale locale)
Locale instance.
locale - A Locale instance.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD | ||||||||