Kotlin library built to provide an easy way of pulling actual Android string resources from Lokalise.
Add maven repository to your Gradle file:
// kotlin gradle dsl
repositories {
maven { url = uri("https://jitpack.io/") }
}
Add library definition to dependencies:
// kotlin gradle dsl
implementaion("com.github.Orangesoft-Development:lokalise-loader:
"
)
Library provides Gradle task to load string resources during builds. To use task register it like in sample below:
// kotlin gradle dsl
task<LokaliseUpdateTask>("lokalise-update") {
targetDir = "
"
apiToken = "
"
projectId = "
"
platforms = listOf(data.Platforms.Android)
}
Or use LokaliseLoader
directly using create
method:
val lokaliseLoader = LokaliseLoader.create { apiToken = "" projectId = "" outputDirPath = "" platforms = listOf(data.Platforms.Android) } lokaliseLoader.load()
Additionally, you can specify list of keys to load from Lokalise. This might be helpful if you want to load some translations in non-main module and prevent all resources to duplicated in main module.
task<LokaliseUpdateTask>("lokalise-update") {
targetDir = "
"
apiToken = "
"
projectId = "
"
platforms = listOf(data.Platforms.Android)
keys = listOf(
"my_first_string",
"my_second_string",
)
}