Class
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(https://tools.ietf.org/html/bcp47) compliant language tag.

Returns

a locale object

Properties

Common
val language: String

The ISO 639 compliant language code.

Common
val script: String

The ISO 15924 compliant 4-letter script code.

Common
val region: String

The ISO 3166 compliant region code.

Functions

fun toLanguageTag(): String

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

Returns

A IETF BCP47 compliant language tag.

Companion Object

Properties

Common
val current: Locale

Returns a Locale object which represents current locale

JvmAndAndroid
actual class Locale(val platformLocale: JavaLocale)

Secondary Constructors

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

Properties

JvmAndAndroid
actual val language: String
JvmAndAndroid
actual val script: String
JvmAndAndroid
actual val region: String

Functions

actual fun toLanguageTag(): String

Companion Object

Properties

JvmAndAndroid
actual val current: Locale