Locale


A Locale object represents a specific geographical, political, or cultural region. An operation that requires a Locale to perform its task is called locale-sensitive and uses the Locale to tailor information for the user. For example, displaying a number is a locale-sensitive operation— the number should be formatted according to the customs and conventions of the user's native country, region, or culture.

See also
TextStyle
SpanStyle

Summary

Public companion properties

Locale

Returns a Locale object which represents current locale

Cmn
android

Public constructors

Locale(languageTag: String)

Create Locale object from a language tag.

Cmn
android
Locale(platformLocale: Locale)
android

Public functions

open operator Boolean
equals(other: Any?)
Cmn
android
open Int
Cmn
android
String

Returns a IETF BCP47 compliant language tag representation of this Locale.

Cmn
android
open String
Cmn
android

Public properties

String

The ISO 639 compliant language code.

Cmn
android
Locale
android
String

The ISO 3166 compliant region code.

Cmn
android
String

The ISO 15924 compliant 4-letter script code.

Cmn
android

Public companion properties

current

val currentLocale

Returns a Locale object which represents current locale

Public constructors

Locale

Locale(languageTag: String)

Create Locale object from a language tag.

Parameters
languageTag: String

A IETF BCP47 compliant language tag.

Returns
Locale

a locale object

Locale

Locale(platformLocale: Locale)

Public functions

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

toLanguageTag

fun toLanguageTag(): String

Returns a IETF BCP47 compliant language tag representation of this Locale.

Returns
String

A IETF BCP47 compliant language tag.

toString

open fun toString(): String

Public properties

language

val languageString

The ISO 639 compliant language code.

platformLocale

val platformLocaleLocale

region

val regionString

The ISO 3166 compliant region code.

script

val scriptString

The ISO 15924 compliant 4-letter script code.