Class

Locale

A Locale object represents a specific geographical, political, or cultural region.

Source set: Common
expect class 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.

Secondary Constructors

constructor(languageTag: String)

Create Locale object from a language tag.

Parameters

languageTag A IETF BCP47 compliant language tag.

Returns

a locale object

Properties

language

Source set: Common
val language: String

The ISO 639 compliant language code.

script

Source set: Common
val script: String

The ISO 15924 compliant 4-letter script code.

region

Source set: Common
val region: String

The ISO 3166 compliant region code.

Functions

toLanguageTag

fun toLanguageTag(): String

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

Returns

A IETF BCP47 compliant language tag.

Companion Object

Properties

Source set: Common
val current: Locale

Returns a Locale object which represents current locale

Source set: JvmAndAndroid
actual class Locale(val platformLocale: JavaLocale)

Secondary Constructors

actual constructor(languageTag: String) : this(parseLanguageTag(languageTag))

Properties

language

Source set: JvmAndAndroid
actual val language: String

script

Source set: JvmAndAndroid
actual val script: String

region

Source set: JvmAndAndroid
actual val region: String

Functions

toLanguageTag

actual fun toLanguageTag(): String

Companion Object

Properties

Source set: JvmAndAndroid
actual val current: Locale

Last updated: