Locale

Locale code.

The list of the enum entries was generated based on the output from java.util.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()][Language.GEtName];
String country  = code.[.getCountry] != null
? code.[.getCountry].[getName()][Market.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][.getByCode]("en-GB");
code = LocaleCode.[getByCode][.getByCode]("es", "ES");
code = LocaleCode.[getByLocale][.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. See [.toLocale] for details.
if (locale == Locale.ENGLISH)
{
System.out.println("Locale.en.toLocale() returned Locale.ENGLISH");
}

// Get a list of LocaleCode instances whose language is Arabic.
List<LocaleCode> list = LocaleCode.[getByLanguage][.getByLanguage]([LanguageCode.ar]);

// Get a list of LocaleCode instances whose country is Switzerland.
list = LocaleCode.[getByCountry][.getByCountry]([Market.CH]);
*

Author

Takahiko Kawasaki

Entries

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

LanguageCode. is, Iceland

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard

Returns a representation of an immutable list of all enum entries, in the order they're declared.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open override fun toString(): String

Get the string representation of this locale code. Its format is either of the following:

Link copied to clipboard
fun valueOf(value: String): Locale

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Link copied to clipboard

Returns an array containing the constants of this enum type, in the order they're declared.