ๅฝ้ๅ (Kokusai-ka "internationalization") is a simple kotlin internationalization library that makes use of kotlinx.serialization and Java's Locale class.
repositories {
maven { url "https://dimensional.jfrog.io/artifactory/maven" }
}
dependencies {
implementation "gg.mixtape:kokusaika:1.0.0"
}
repositories {
maven {
name = "dimensional.fun"
url = uri("https://dimensional.jfrog.io/artifactory/maven")
}
}
dependencies {
implementation("gg.mixtape:kokusaika:1.0.0")
}
import kokusaika.Kokusaika
import kotlinx.serialization.json.Json
import java.util.*
fun main() {
val kokusaika = Kokusaika {
format = Json { }
languagesPath = "/assets/languages" // path within the resources folder
fallback = Locale.US
}
val myString = kokusaika[Locale.US]?.read<String>("hello")
println(myString) // -> world
}
{
"hello": "world"
}
/resources
/assets
/languages
list.json
en-US.json
Copyright ยฉ mixtape bot 2019 - 2021 all rights reserved