chore: diplomatic modifier text auto-translated

This commit is contained in:
Yair Morgenstern 2023-02-19 11:20:19 +02:00
parent 90708fe138
commit 0b5ded98c9
2 changed files with 24 additions and 49 deletions

View File

@ -168,36 +168,6 @@ Ally =
Current leader is [civInfo] with [amount] [stat] generated. =
Current leader is [civInfo] with [amount] Technologies discovered. =
## Diplomatic modifiers
You declared war on us! =
Your warmongering ways are unacceptable to us. =
You have captured our cities! =
We applaud your liberation of our conquered cities! =
We applaud your liberation of conquered cities! =
Years of peace have strengthened our relations. =
Our mutual military struggle brings us closer together. =
We have signed a public declaration of friendship =
You have declared friendship with our enemies! =
You have declared friendship with our allies =
Our open borders have brought us closer together. =
Your so-called 'friendship' is worth nothing. =
You have publicly denounced us! =
You have denounced our allies =
You have denounced our enemies =
You betrayed your promise to not settle cities near us =
You fulfilled your promise to stop settling cities near us! =
You refused to stop settling cities near us =
Your arrogant demands are in bad taste =
Your use of nuclear weapons is disgusting! =
You have stolen our lands! =
You gave us units! =
You destroyed City-States that were under our protection! =
You attacked City-States that were under our protection! =
You demanded tribute from City-States that were under our protection! =
You sided with a City-State over us =
You returned captured units to us =
Demands =
Please don't settle new cities near us. =
Very well, we shall look for new lands to settle. =

View File

@ -4,6 +4,7 @@ import com.badlogic.gdx.Gdx
import com.badlogic.gdx.files.FileHandle
import com.unciv.json.fromJsonFile
import com.unciv.json.json
import com.unciv.logic.civilization.diplomacy.DiplomaticModifiers
import com.unciv.logic.civilization.managers.SpyAction
import com.unciv.models.metadata.BaseRuleset
import com.unciv.models.metadata.LocaleCode
@ -89,6 +90,15 @@ object TranslationFileWriter {
if (templateFile.exists())
linesToTranslate.addAll(templateFile.reader(TranslationFileReader.charset).readLines())
linesToTranslate += "\n\n#################### Lines from Unique Types #######################\n"
for (uniqueType in UniqueType.values()) {
val deprecationAnnotation = uniqueType.getDeprecationAnnotation()
if (deprecationAnnotation != null) continue
if (uniqueType.flags.contains(UniqueFlag.HiddenToUsers)) continue
linesToTranslate += "${uniqueType.getTranslatable()} = "
}
for (uniqueParameterType in UniqueParameterType.values()) {
val strings = uniqueParameterType.getTranslationWriterStringsForOutput()
if (strings.isEmpty()) continue
@ -96,6 +106,19 @@ object TranslationFileWriter {
linesToTranslate.addAll(strings.map { "$it = " })
}
for (uniqueTarget in UniqueTarget.values())
linesToTranslate += "$uniqueTarget = "
linesToTranslate += "\n\n#################### Lines from spy actions #######################\n"
for (spyAction in SpyAction.values()) {
linesToTranslate += "$spyAction = "
}
linesToTranslate += "\n\n#################### Lines from diplomatic modifiers #######################\n"
for (diplomaticModifier in DiplomaticModifiers.values())
linesToTranslate += "${diplomaticModifier.text} = "
for (baseRuleset in BaseRuleset.values()) {
val generatedStringsFromBaseRuleset =
GenerateStringsFromJSONs(Gdx.files.local("jsons/${baseRuleset.fullName}"))
@ -112,29 +135,11 @@ object TranslationFileWriter {
for ((key, value) in fileNameToGeneratedStrings) {
if (value.isEmpty()) continue
linesToTranslate.add("\n#################### Lines from $key ####################\n")
linesToTranslate += "\n#################### Lines from $key ####################\n"
linesToTranslate.addAll(value)
}
fileNameToGeneratedStrings.clear() // No longer needed
if (modFolder == null) { // base game
linesToTranslate.add("\n\n#################### Lines from Unique Types #######################\n")
for (uniqueType in UniqueType.values()) {
val deprecationAnnotation = uniqueType.getDeprecationAnnotation()
if (deprecationAnnotation != null) continue
if (uniqueType.flags.contains(UniqueFlag.HiddenToUsers)) continue
linesToTranslate.add("${uniqueType.getTranslatable()} = ")
}
for (uniqueTarget in UniqueTarget.values())
linesToTranslate.add("$uniqueTarget = ")
for (spyAction in SpyAction.values()) {
linesToTranslate.add("$spyAction = ")
}
}
var countOfTranslatableLines = 0
val countOfTranslatedLines = HashMap<String, Int>()