jvmMain.com.vanniktech.locale.Multiplatform.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of multiplatform-locale-jvm Show documentation
Show all versions of multiplatform-locale-jvm Show documentation
Type Safe Kotlin Multiplatform Locale implementation
The newest version!
package com.vanniktech.locale
actual fun Language.displayName() = java.util.Locale(
code,
"",
).displayLanguage.capitalized()
actual fun Territory.displayName() = when (this) {
Region.INTERNATIONAL_WATERS -> "International Waters"
else -> java.util.Locale(
java.util.Locale.getDefault().language,
code,
).displayCountry.capitalized()
}
fun Locale.toJavaLocale() = java.util.Locale(
language.code,
territory?.code.orEmpty(),
)