Locale

@Immutable class Locale
kotlin.Any
   ↳ androidx.ui.text.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.

Summary

Public constructors

<init>(languageTag: String)

Create Locale object from a language tag.

Public methods

Boolean
equals(other: Any?)

Int

String

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

String

Inherited extension functions

From androidx.compose
operator T

IMPORTANT: This global operator is TEMPORARY, and should be removed whenever an answer for contextual composers is reached.

Properties

String

The ISO 639 compliant language code.

String

The ISO 3166 compliant region code.

String

The ISO 15924 compliant 4-letter script code.

Companion properties

Locale

Returns a Locale object which represents current locale

Public constructors

<init>

Locale(languageTag: String)

Create Locale object from a language tag.

Parameters
languageTag: String A IETF BCP47 compliant language tag.
Return
a locale object

Public methods

equals

fun equals(other: Any?): Boolean

hashCode

fun hashCode(): Int

toLanguageTag

fun toLanguageTag(): String

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

Return
A IETF BCP47 compliant language tag.

toString

fun toString(): String

Properties

language

val language: String

The ISO 639 compliant language code.

region

val region: String

The ISO 3166 compliant region code.

script

val script: String

The ISO 15924 compliant 4-letter script code.

Companion properties

current

val current: Locale

Returns a Locale object which represents current locale