iosMain.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 Show documentation
Show all versions of multiplatform-locale Show documentation
Type Safe Kotlin Multiplatform Locale implementation
The newest version!
package com.vanniktech.locale
import platform.Foundation.NSLocale
import platform.Foundation.currentLocale
import platform.Foundation.localizedStringForCountryCode
import platform.Foundation.localizedStringForLanguageCode
actual fun Language.displayName(): String =
NSLocale.currentLocale.localizedStringForLanguageCode(code).orEmpty().capitalized()
actual fun Territory.displayName() = when (this) {
Region.INTERNATIONAL_WATERS -> "International Waters"
else -> NSLocale.currentLocale.localizedStringForCountryCode(code).orEmpty().capitalized()
}