Skip to content

Kotlin multiplatform internationalization library (experimental)

License

Notifications You must be signed in to change notification settings

fluidsonic/fluid-i18n

Repository files navigation

fluid-i18n

Maven Central Tests Kotlin #fluid-libraries Slack Channel

Kotlin multiplatform internationalization support backed by Unicode CLDR data.
Highly experimental. Feel free to contribute!

Installation

build.gradle.kts:

dependencies {
	implementation("io.fluidsonic.i18n:fluid-i18n:0.13.0")
}

Usage

Country names

val usa = Country.byCode("US")
println(usa.name) // United States
println(usa.shortName) // US
println(usa.variantName) // null

val locale = Locale.forLanguage("de")
println(usa.name(locale)) // Vereinigte Staaten
println(usa.shortName(locale)) // USA
println(usa.variantName(locale)) // null

val ivoryCoast = Country.forCode("CI")
println(usa.name) // Côte d’Ivoire
println(usa.shortName) // null
println(usa.variantName) // Ivory Coast

Building

Build generated Kotlin files for Unicode CLDR data:

./gradlew generateCode   # macOS
gradlew generateCode     # Windows

License

Apache 2.0