Locale

Class

Common
class Locale internal constructor(val platformLocale: PlatformLocale)

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.

Parameters

platformLocalePlatform specific Locale object that provides the actual values for the members of this class.

Secondary Constructors

constructor(languageTag: String) : this(platformLocaleDelegate.parseLanguageTag(languageTag))

Create Locale object from a language tag.

Parameters

languageTagA 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