Translations gradle plugin automates work with lokalise translations in Android application code base.
Define plugin
plugins {
id("com.intermedia.translations").version("<latest version>")
}Then set it up:
import com.intermedia.translations.SupportedLanguages
import com.intermedia.translations.lokalise.LanguageMapping
translations {
api {
lokalise {
apiToken = "<your lokalise api token>"
projectId = "<your lokalise project id>"
languageMappings = [
new LanguageMapping("fr_CA", "fr"),
new LanguageMapping("nl_NL", "nl"),
new LanguageMapping("es_419", "es")
]
}
}
supportedLanguages = new SupportedLanguages(
['de', 'es', 'fr', 'it', 'ja', 'nl'],
['en-rAU', 'en-rGB']
)
notTranslatedFile = file("./src/main/res/values/strings_not_translated.xml")
resourcesFolder = file("./src/main/res/")
}
...
android {
...
}api- it's a service used to download up-to-date translationslokalise- Lokalise implementation. Plugin uses their download files APIapiToken- lokalise api tokenprojectId- lokalise project identifierlanguageMappings- optional mapping for lokalise api language ISO names
supportedLanguages- list of supported languages in ISO formatnotTranslatedFile- resources file with strings, which you added for future translatingresourcesFolder- folder which containsvalues-*folders with your local translations files
To pull new translations run the task translationsPull:
./gradlew translationsPullIt will download fresh translations from the API, found new translations (based
on strings from notTranslatedFile) and apply them.
TBD
0.0.1- initial version