Fix #1875
This commit is contained in:
parent
d04e1d7dec
commit
b74d46101b
1 changed files with 21 additions and 1 deletions
22
build.gradle
22
build.gradle
|
@ -134,7 +134,7 @@ jar {
|
|||
classifier = 'universal'
|
||||
|
||||
from { crowdin.getDidWork() ? fileTree('build/translations').matching{exclude "**/en_US.json"} : null}
|
||||
dependsOn 'renameCrowdin'
|
||||
dependsOn 'fixTranslations'
|
||||
}
|
||||
|
||||
|
||||
|
@ -171,6 +171,26 @@ task renameCrowdin(type: Copy, dependsOn: ['crowdin', 'cleanCrowdin']){
|
|||
rename {
|
||||
String filename -> return filename.toLowerCase()
|
||||
}
|
||||
doFirst {
|
||||
file('build/translations').deleteDir()
|
||||
}
|
||||
}
|
||||
|
||||
import groovy.json.JsonSlurper
|
||||
import groovy.json.JsonOutput
|
||||
|
||||
//Remove all translations that do not have an entry, ensures that minecraft falls back to EN_US over writing out an empty string.
|
||||
task fixTranslations(dependsOn: ['renameCrowdin']) {
|
||||
def jsonSlurper = new JsonSlurper()
|
||||
doLast {
|
||||
file('build/translations').eachFileRecurse(groovy.io.FileType.FILES) {
|
||||
if(it.name.endsWith(".json")) {
|
||||
def lang = jsonSlurper.parseText(it.text)
|
||||
lang.values().removeIf { val -> val.empty}
|
||||
it.text = JsonOutput.prettyPrint(JsonOutput.toJson(lang))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
||||
|
|
Loading…
Reference in a new issue