Trigger a crowdin export before downloading the translations

This commit is contained in:
Modmuss50 2018-08-31 15:29:59 +01:00
parent edf0227598
commit d4e08ba976
No known key found for this signature in database
GPG key ID: 773D17BE8BF49C82

View file

@ -194,9 +194,22 @@ apiJar.mustRunAfter deobfJar
build.dependsOn deobfJar, apiJar build.dependsOn deobfJar, apiJar
//Triggers crowdin to export the latest translations
task crowdinExport() {
onlyIf {
hasProperty('crowdinKey')
}
doLast{
def apiKey = project.crowdinKey
def projectId = 'techreborn'
def response = new URL(sprintf('https://api.crowdin.com/api/project/$s/export?key=$s', [projectId, apiKey])).text
def metadata = new XmlSlurper().parseText(response)
project.logger.lifecycle("crowdin export status: " + metadata.@success)
}
}
//Taken from forge build script //Taken from forge build script
task crowdin(type: CrowdinDownload){ task crowdin(type: CrowdinDownload, dependsOn: 'crowdinExport'){
output = "build/translations.crowdin" output = "build/translations.crowdin"
projectId = 'techreborn' projectId = 'techreborn'
extract = true extract = true