diff --git a/android/assets/jsons/Translations.json b/android/assets/jsons/Translations.json index ad1ce406..554ec764 100644 --- a/android/assets/jsons/Translations.json +++ b/android/assets/jsons/Translations.json @@ -7674,4 +7674,19 @@ "Wolfpack III":{ Italian:"Attacco in massa III" } -} + + // Civilopedia texts + "Basics":{} + "Resources":{} + "Terrains":{} + "Tile improvements":{} + + "Unique to [civName], replaces [unitName]":{} + "Requires [buildingName] to be built in the city":{} + "Requires [buildingName] to be built in all cities":{} + "Provides a free [buildingName] in the city":{} + "Requires worked [resource] near city":{} + "Required tech: [requiredTech]":{} + "Upgrades to [upgradedUnit]":{} + "Obsolete with [obsoleteTech]":{} +} \ No newline at end of file diff --git a/core/src/com/unciv/models/gamebasics/Building.kt b/core/src/com/unciv/models/gamebasics/Building.kt index edb582f7..61c41189 100644 --- a/core/src/com/unciv/models/gamebasics/Building.kt +++ b/core/src/com/unciv/models/gamebasics/Building.kt @@ -61,7 +61,7 @@ class Building : NamedStats(), IConstruction{ infoList += improvedResources.joinToString()+ " {provide} ".tr()+ resourceBonusStats.toString() } if(requiredNearbyImprovedResources!=null) - infoList += "requires worked "+requiredNearbyImprovedResources!!.joinToString("/")+" near city" + infoList += ("Requires worked ["+requiredNearbyImprovedResources!!.joinToString("/"){it.tr()}+"] near city").tr() if(uniques.isNotEmpty()) infoList += uniques.joinToString { it.tr() } if(cityStrength!=0) infoList+="{City strength} +".tr()+cityStrength if(cityHealth!=0) infoList+="{City health} +".tr()+cityHealth @@ -72,17 +72,17 @@ class Building : NamedStats(), IConstruction{ fun getDescription(forBuildingPickerScreen: Boolean, adoptedPolicies: HashSet): String { val stats = getStats(adoptedPolicies) val stringBuilder = StringBuilder() - if(uniqueTo!=null) stringBuilder.appendln("Unique to $uniqueTo, replaces $replaces") + if(uniqueTo!=null) stringBuilder.appendln("Unique to [$uniqueTo], replaces [$replaces]".tr()) if (!forBuildingPickerScreen) stringBuilder.appendln("{Cost}: $cost".tr()) if (isWonder) stringBuilder.appendln("Wonder".tr()) if (!forBuildingPickerScreen && requiredTech != null) - stringBuilder.appendln("Requires {$requiredTech} to be researched".tr()) + stringBuilder.appendln("Required tech: [$requiredTech]".tr()) if (!forBuildingPickerScreen && requiredBuilding != null) - stringBuilder.appendln("Requires a $requiredBuilding to be built in this city") + stringBuilder.appendln("Requires [$requiredBuilding] to be built in the city".tr()) if (!forBuildingPickerScreen && requiredBuildingInAllCities != null) - stringBuilder.appendln("Requires a $requiredBuildingInAllCities to be built in all cities") + stringBuilder.appendln("Requires [$requiredBuildingInAllCities] to be built in all cities".tr()) if (providesFreeBuilding != null) - stringBuilder.appendln("Provides a free $providesFreeBuilding in this city") + stringBuilder.appendln("Provides a free [$providesFreeBuilding] in the city".tr()) if(uniques.isNotEmpty()) stringBuilder.appendln(uniques.asSequence().map { it.tr() }.joinToString("\n")) if (stats.toString() != "") stringBuilder.appendln(stats) @@ -95,10 +95,10 @@ class Building : NamedStats(), IConstruction{ } if (this.greatPersonPoints != null) { val gpp = this.greatPersonPoints!! - if (gpp.production != 0f) stringBuilder.appendln("+" + gpp.production.toInt() + " Great Engineer points") - if (gpp.gold != 0f) stringBuilder.appendln("+" + gpp.gold.toInt() + " Great Merchant points") - if (gpp.science != 0f) stringBuilder.appendln("+" + gpp.science.toInt() + " Great Scientist points") - if (gpp.culture != 0f) stringBuilder.appendln("+" + gpp.culture.toInt() + " Great Artist points") + if (gpp.production != 0f) stringBuilder.appendln("+" + gpp.production.toInt()+" " + "[Great Engineer] points".tr()) + if (gpp.gold != 0f) stringBuilder.appendln("+" + gpp.gold.toInt() + " "+"[Great Merchant] points".tr()) + if (gpp.science != 0f) stringBuilder.appendln("+" + gpp.science.toInt() + " "+"[Great Scientist] points".tr()) + if (gpp.culture != 0f) stringBuilder.appendln("+" + gpp.culture.toInt() + " "+"[Great Artist] points".tr()) } if (resourceBonusStats != null) { val resources = GameBasics.TileResources.values.filter { name == it.building }.joinToString { it.name.tr() } @@ -106,7 +106,7 @@ class Building : NamedStats(), IConstruction{ } if(requiredNearbyImprovedResources!=null) - stringBuilder.appendln("Requires worked "+requiredNearbyImprovedResources!!.joinToString("/")+" near city") + stringBuilder.appendln(("Requires worked ["+requiredNearbyImprovedResources!!.joinToString("/"){it.tr()}+"] near city").tr()) if(cityStrength!=0) stringBuilder.appendln("{City strength} +".tr() + cityStrength) if(cityHealth!=0) stringBuilder.appendln("{City health} +".tr() + cityHealth) diff --git a/core/src/com/unciv/models/gamebasics/unit/BaseUnit.kt b/core/src/com/unciv/models/gamebasics/unit/BaseUnit.kt index b9512b42..8793a3bc 100644 --- a/core/src/com/unciv/models/gamebasics/unit/BaseUnit.kt +++ b/core/src/com/unciv/models/gamebasics/unit/BaseUnit.kt @@ -56,14 +56,14 @@ class BaseUnit : INamed, IConstruction, ICivilopedia { fun getDescription(forPickerScreen:Boolean): String { val sb = StringBuilder() - if(requiredResource!=null) sb.appendln("Requires {$requiredResource}".tr()) + if(requiredResource!=null) sb.appendln("{Requires} {$requiredResource}".tr()) if(!forPickerScreen) { if(uniqueTo!=null) sb.appendln("Unique to $uniqueTo, replaces $replaces") if (unbuildable) sb.appendln("Unbuildable".tr()) else sb.appendln("Cost: $cost") - if(requiredTech!=null) sb.appendln("Required tech: {$requiredTech}".tr()) - if(upgradesTo!=null) sb.appendln("Upgrades to $upgradesTo") - if(obsoleteTech!=null) sb.appendln("Obsolete with $obsoleteTech") + if(requiredTech!=null) sb.appendln("Required tech: [$requiredTech]".tr()) + if(upgradesTo!=null) sb.appendln("Upgrades to [$upgradesTo]".tr()) + if(obsoleteTech!=null) sb.appendln("Obsolete with [$obsoleteTech]".tr()) } if(strength!=0){ sb.append("{Strength} $strength".tr()) diff --git a/core/src/com/unciv/ui/CivilopediaScreen.kt b/core/src/com/unciv/ui/CivilopediaScreen.kt index 2de03ac1..f8a9d8fa 100644 --- a/core/src/com/unciv/ui/CivilopediaScreen.kt +++ b/core/src/com/unciv/ui/CivilopediaScreen.kt @@ -9,6 +9,7 @@ import com.unciv.UnCivGame import com.unciv.models.gamebasics.BasicHelp import com.unciv.models.gamebasics.GameBasics import com.unciv.models.gamebasics.ICivilopedia +import com.unciv.models.gamebasics.tr import com.unciv.ui.utils.CameraStageBaseScreen import com.unciv.ui.utils.onClick import com.unciv.ui.utils.toLabel @@ -29,26 +30,26 @@ class CivilopediaScreen : CameraStageBaseScreen() { val label = "".toLabel() label.setWrap(true) - val goToGameButton = TextButton("Return \r\nto game", CameraStageBaseScreen.skin) + val goToGameButton = TextButton("Close".tr(), CameraStageBaseScreen.skin) goToGameButton.onClick { game.setWorldScreen() dispose() } buttonTable.add(goToGameButton) - val map = LinkedHashMap>() + val categoryToInfos = LinkedHashMap>() val language = UnCivGame.Current.settings.language.replace(" ","_") val basicHelpFileName = if(Gdx.files.internal("jsons/BasicHelp_$language.json").exists())"BasicHelp_$language" else "BasicHelp" - map["Basics"] = GameBasics.getFromJson(kotlin.Array::class.java, basicHelpFileName).toList() - map["Buildings"] = GameBasics.Buildings.values - map["Resources"] = GameBasics.TileResources.values - map["Terrains"] = GameBasics.Terrains.values - map["Tile Improvements"] = GameBasics.TileImprovements.values - map["Units"] = GameBasics.Units.values - map["Technologies"] = GameBasics.Technologies.values + categoryToInfos["Basics"] = GameBasics.getFromJson(kotlin.Array::class.java, basicHelpFileName).toList() + categoryToInfos["Buildings"] = GameBasics.Buildings.values + categoryToInfos["Resources"] = GameBasics.TileResources.values + categoryToInfos["Terrains"] = GameBasics.Terrains.values + categoryToInfos["Tile Improvements"] = GameBasics.TileImprovements.values + categoryToInfos["Units"] = GameBasics.Units.values + categoryToInfos["Technologies"] = GameBasics.Technologies.values val nameList = List(CameraStageBaseScreen.skin) @@ -62,14 +63,14 @@ class CivilopediaScreen : CameraStageBaseScreen() { val buttons = ArrayList