Update translationFileWriter to include missing strings (#4578)

* Update translationFileWriter to include strings from new json files

* Fix promotions with multiple uniques not getting translated

* Add missing translatable strings (thanks to DuffLagerleff for finding these)
This commit is contained in:
Xander Lenstra
2021-07-20 16:07:15 +02:00
committed by GitHub
parent 239a406bc4
commit 3d13680602
3 changed files with 20 additions and 6 deletions

View File

@ -566,12 +566,13 @@ No =
Acquire =
Under construction =
Gold =
Science =
Happiness =
Production =
Culture =
Food =
Production =
Gold =
Happiness =
Culture =
Science =
Faith =
Crop Yield =
Territory =
@ -739,6 +740,7 @@ Luxury resource =
Strategic resource =
Fresh water =
non-fresh water =
Natural Wonder =
# improvementFilters
@ -938,6 +940,10 @@ All policies adopted =
Choose an Icon and name for your Religion =
Choose a [$beliefType] belief! =
Found [religionName] =
Choose a pantheon =
Found Religion =
Found Pantheon =
Follow [belief] =
# Terrains

View File

@ -11,7 +11,7 @@ class Promotion : INamed{
var effect = ""
var unitTypes = listOf<String>() // The json parser wouldn't agree to deserialize this as a list of UnitTypes. =(
var uniques = listOf<String>()
var uniques = ArrayList<String>()
val uniqueObjects: List<Unique> by lazy { uniques.map { Unique(it) } + Unique(effect) }
fun getDescription(promotionsForUnitType: Collection<Promotion>, forCivilopedia:Boolean=false, ruleSet:Ruleset? = null):String {

View File

@ -222,6 +222,7 @@ object TranslationFileWriter {
|| parameter == "non-fresh water"
|| parameter == "Open Terrain"
|| parameter == "Rough Terrain"
|| parameter == "Natural Wonder"
-> "tileFilter"
RulesetCache.getBaseRuleset().units.containsKey(parameter) -> "unit"
RulesetCache.getBaseRuleset().tileImprovements.containsKey(parameter)
@ -280,6 +281,10 @@ object TranslationFileWriter {
}
fun serializeElement(element: Any) {
if (element is String) {
submitString(element)
return
}
val allFields = (element.javaClass.declaredFields + element.javaClass.fields
+ element.javaClass.superclass.declaredFields) // This is so the main PolicyBranch, which inherits from Policy, will recognize its Uniques and have them translated
.filter {
@ -333,11 +338,14 @@ object TranslationFileWriter {
private fun getJavaClassByName(name: String): Class<Any> {
return when (name) {
"Beliefs" -> emptyArray<Belief>().javaClass
"Buildings" -> emptyArray<Building>().javaClass
"Difficulties" -> emptyArray<Difficulty>().javaClass
"Eras" -> emptyArray<Era>().javaClass
"Nations" -> emptyArray<Nation>().javaClass
"Policies" -> emptyArray<PolicyBranch>().javaClass
"Quests" -> emptyArray<Quest>().javaClass
"Religions" -> emptyArray<String>().javaClass
"Specialists" -> emptyArray<Specialist>().javaClass
"Techs" -> emptyArray<TechColumn>().javaClass
"Terrains" -> emptyArray<Terrain>().javaClass