Use GitHub Action to check for missing translations (#1019)
* Use GitHub Action to check for missing translations * fix: missing translations * fix: Traditional Chinese in I18N_zh_CN * fix: I18N_zh
This commit is contained in:
33
build.gradle
33
build.gradle
@@ -122,4 +122,37 @@ task 'preTouchOpenJFXDependencies' {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task 'checkTranslations' {
|
||||
group 'verification'
|
||||
doLast {
|
||||
var en = new Properties()
|
||||
var zh = new Properties()
|
||||
var zh_CN = new Properties()
|
||||
|
||||
file("HMCL/src/main/resources/assets/lang/I18N.properties").withInputStream { en.load(it) }
|
||||
file("HMCL/src/main/resources/assets/lang/I18N_zh.properties").withInputStream { zh.load(it) }
|
||||
file("HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties").withInputStream { zh_CN.load(it) }
|
||||
|
||||
boolean success = true
|
||||
|
||||
zh_CN.forEach { k, v ->
|
||||
if (!en.containsKey(k)) {
|
||||
project.logger.log(LogLevel.WARN, "I18N.properties missing key '$k'")
|
||||
success = false
|
||||
}
|
||||
}
|
||||
|
||||
zh_CN.forEach { k, v ->
|
||||
if (!zh.containsKey(k)) {
|
||||
project.logger.log(LogLevel.WARN, "I18N_zh.properties missing key '$k'")
|
||||
success = false
|
||||
}
|
||||
}
|
||||
|
||||
if (!success) {
|
||||
throw new GradleException("Part of the translation is missing")
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user