Locale

expect class Locale

Class representing a locale

actual typealias Locale = DefaultLocaleImpl
actual typealias Locale = java.util.Locale
actual typealias Locale = DefaultLocaleImpl

Constructors

Link copied to clipboard
expect constructor(language: String)
expect constructor(language: String, country: String)
expect constructor(language: String, country: String, variant: String)

Properties

Link copied to clipboard

Property to access Locale.getCountry

Link copied to clipboard

Property to access Locale.getLanguage

Link copied to clipboard

Creates a locale that is one step less specific than this locale.

Link copied to clipboard

Property to access Locale.getScript

Link copied to clipboard

Property to access Locale.getVariant

Functions

Link copied to clipboard
expect fun getCountry(): String

country/region code for this locale, which should either be the empty string, an uppercase ISO 3166 2-letter code, or a UN M.49 3-digit code.

Link copied to clipboard

Returns a name for the locale that is appropriate for display to the user in the language of the locale

Link copied to clipboard
expect fun getExtension(key: Char): String?

Returns the extension (or private use) value associated with the specified key, or null if there is no extension associated with the key.

Link copied to clipboard
expect fun getExtensionKeys(): Set<Char>

Returns the set of extension keys associated with this locale, or the empty set if it has no extensions.

Link copied to clipboard
expect fun getLanguage(): String

Language code.

Link copied to clipboard
expect fun getScript(): String

Returns the script for this locale, which should either be the empty string or an "ISO 15924 4"-letter script code.

Link copied to clipboard
expect fun getVariant(): String

the variant code for this locale. Can be an empty string

Link copied to clipboard

Returns a copy of this (or this itself) Locale with no extensions.

Link copied to clipboard
fun Locale.toTag(separator: String = "_"): String