Locale

expect class Locale(language: String, country: String, variant: String)

Class representing a locale

actual data class Locale(val language: String, val country: String, val variant: String)
actual typealias Locale = java.util.Locale
actual data class Locale(val language: String, val country: String, val variant: String)

Constructors

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

Properties

country
Link copied to clipboard
Link copied to clipboard

Property to access Locale.getCountry

language
Link copied to clipboard
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.

variant
Link copied to clipboard
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.

actual fun getCountry(): String
actual fun getCountry(): String
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 getLanguage(): String

Language code. Should be a ISO 639-1 code

actual fun getLanguage(): String
actual fun getLanguage(): String
Link copied to clipboard
expect fun getVariant(): String

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

actual fun getVariant(): String
actual fun getVariant(): String
toString
Link copied to clipboard
open override fun toString(): String
open override fun toString(): String
Link copied to clipboard
fun Locale.toTag(separator: String = "_"): String