In order to run the sample - choose projectDebug for both :app and :dynodict-android modules.

- Deploy to MavenLocal:
- Open app/build.gradle.kts
- Comment out line:
id("org.dynodict.plugin") version Versions.dynodictPlugin- Run
./deploy.sh- Sync and run using mavenDebug
This is the SDK to generate and update the list of Strings used in your project. Use plugin to generate Kotlin placeholders for strings. For example:
{
"translations": [
{
"key": "LoginScreen.ButtonName",
"params": [
{
"type": "string",
"key": "param1"
},
{
"type": "long",
"key": "param2",
"format":"startDate"
}
],
"value": "Log in {param1} ({param2})"
}
]
}
is converted to:
object LoginScreen : StringKey("LoginScreen") {
object ButtonName : StringKey("ButtonName", LoginScreen) {
fun get(param1: String, param2: Long): String {
return DynoDict.instance.get(
this,
Parameter.StringParameter(param1, key = "param1"),
Parameter.LongParameter(param2, key = "param2", format = "startDate"))
}
}
}
and can be used further in code:
val loginButtonName = LoginScreen.ButtonName.get("Param1", time)
- Apply plugin:
plugins { id 'org.dynodict.plugin' } - run gradle script
./gradlew clean :app:downloadStrings --package=org.dynodict --url=metadata_url - run gradle script
./gradlew clean migrateStrings --input=app/src/main/res/values/strings.xml
This task will download metadata from metadata_url and will generate Kotlin file Strings.kt with Kotlin placeholders as well as json/yaml buckets.
- Enjoy!
For :downloadStrings there is only one mandatory parameters which need to be passed:
--url - Url where to get the data from.
There are some optional parameters which can be used:
--package - package which should be used to place Kotlin files. It is also used to set package at the top of the file. Default is evaluated based on the first non-single folder
--output - location where generated Kotlin file should be placed to. Default src/main/java
--assets - location of the assets folder where default .json files are placed to