diff --git a/core/src/com/unciv/logic/automation/Automation.kt b/core/src/com/unciv/logic/automation/Automation.kt index fd579a5cd6..a427f66ab4 100644 --- a/core/src/com/unciv/logic/automation/Automation.kt +++ b/core/src/com/unciv/logic/automation/Automation.kt @@ -10,6 +10,7 @@ import com.unciv.models.gamebasics.GameBasics import com.unciv.models.gamebasics.unit.Unit import com.unciv.models.gamebasics.unit.UnitType import com.unciv.ui.utils.getRandom +import com.unciv.ui.utils.tr class Automation { @@ -114,7 +115,7 @@ class Automation { } if (cityInfo.civInfo == cityInfo.civInfo.gameInfo.getPlayerCivilization()) - cityInfo.civInfo.addNotification("Work has started on $currentConstruction", cityInfo.location, Color.BROWN) + cityInfo.civInfo.addNotification("{Work has started on} $currentConstruction".tr(), cityInfo.location, Color.BROWN) } } diff --git a/core/src/com/unciv/logic/battle/Battle.kt b/core/src/com/unciv/logic/battle/Battle.kt index 2ba426f0e6..6276c9c598 100644 --- a/core/src/com/unciv/logic/battle/Battle.kt +++ b/core/src/com/unciv/logic/battle/Battle.kt @@ -54,7 +54,7 @@ class Battle(val gameInfo:GameInfo=UnCivGame.Current.gameInfo) { val defenderString = if (defender.getUnitType() == UnitType.City) " " + defender.getName() else " our " + defender.getName() - val notificationString = "An enemy " + attacker.getName() + whatHappenedString + defenderString + val notificationString = "{An enemy} ".tr() + attacker.getName() + whatHappenedString + defenderString defender.getCivilization().addNotification(notificationString, attackedTile.position, Color.RED) } @@ -149,7 +149,7 @@ class Battle(val gameInfo:GameInfo=UnCivGame.Current.gameInfo) { return } // barbarians don't capture civilians! val capturedUnit = (defender as MapUnitCombatant).unit - capturedUnit.civInfo.addNotification("An enemy ".tr()+attacker.getName()+" has captured our "+defender.getName()+"!", + capturedUnit.civInfo.addNotification("{An enemy} ".tr()+attacker.getName()+" {has captured} our "+defender.getName()+"!", defender.getTile().position, Color.RED) capturedUnit.civInfo = attacker.getCivilization() capturedUnit.owner = capturedUnit.civInfo.civName diff --git a/core/src/com/unciv/logic/city/CityConstructions.kt b/core/src/com/unciv/logic/city/CityConstructions.kt index 51e30a1782..29c0341c0f 100644 --- a/core/src/com/unciv/logic/city/CityConstructions.kt +++ b/core/src/com/unciv/logic/city/CityConstructions.kt @@ -45,14 +45,14 @@ class CityConstructions { fun getCityProductionTextForCityButton(): String { var result = currentConstruction if (result != "Science" && result != "Gold") - result += "\r\n" + turnsToConstruction(currentConstruction) + " "+"turns".tr() + result += "\r\n" + turnsToConstruction(currentConstruction) + " {turns}".tr() return result } fun getProductionForTileInfo(): String { var result = currentConstruction if (result != "Science" && result != "Gold") - result += "\r\nin " + turnsToConstruction(currentConstruction) + " "+"turns".tr() + result += "\r\nin " + turnsToConstruction(currentConstruction) + " {turns}".tr() return result } @@ -96,7 +96,7 @@ class CityConstructions { currentConstruction = "lie" if (!construction.isBuildable(this)) { // We can't build this building anymore! (Wonder has been built / resource is gone / etc.) - cityInfo.civInfo.addNotification("Cannot continue work on $saveCurrentConstruction", cityInfo.location, Color.BROWN) + cityInfo.civInfo.addNotification("{Cannot continue work on} $saveCurrentConstruction".tr(), cityInfo.location, Color.BROWN) Automation().chooseNextConstruction(this) construction = getConstruction(currentConstruction) } else @@ -111,10 +111,10 @@ class CityConstructions { if(construction is Building && construction.isWonder && construction.requiredBuildingInAllCities==null) { val playerCiv = cityInfo.civInfo.gameInfo.getPlayerCivilization() val builtLocation = if(playerCiv.exploredTiles.contains(cityInfo.location)) cityInfo.name else "a faraway land" - playerCiv.addNotification("$currentConstruction has been built in $builtLocation", cityInfo.location, Color.BROWN) + playerCiv.addNotification("$currentConstruction {has been built in} $builtLocation".tr(), cityInfo.location, Color.BROWN) } else - cityInfo.civInfo.addNotification(currentConstruction + " has been built in " + cityInfo.name, cityInfo.location, Color.BROWN) + cityInfo.civInfo.addNotification(currentConstruction + " {has been built in} ".tr() + cityInfo.name, cityInfo.location, Color.BROWN) Automation().chooseNextConstruction(this) } diff --git a/core/src/com/unciv/logic/city/CityExpansionManager.kt b/core/src/com/unciv/logic/city/CityExpansionManager.kt index 5e97f5168f..6f955e6e39 100644 --- a/core/src/com/unciv/logic/city/CityExpansionManager.kt +++ b/core/src/com/unciv/logic/city/CityExpansionManager.kt @@ -3,6 +3,7 @@ package com.unciv.logic.city import com.badlogic.gdx.graphics.Color import com.unciv.logic.automation.Automation import com.unciv.logic.map.TileInfo +import com.unciv.ui.utils.tr class CityExpansionManager { @@ -49,7 +50,7 @@ class CityExpansionManager { cultureStored += culture.toInt() if (cultureStored >= getCultureToNextTile()) { addNewTileWithCulture() - cityInfo.civInfo.addNotification(cityInfo.name + " has expanded its borders!", cityInfo.location, Color.PURPLE) + cityInfo.civInfo.addNotification(cityInfo.name + " {has expanded its borders}!".tr(), cityInfo.location, Color.PURPLE) } } diff --git a/core/src/com/unciv/logic/city/PopulationManager.kt b/core/src/com/unciv/logic/city/PopulationManager.kt index 0d12b0fc37..355eb9b70e 100644 --- a/core/src/com/unciv/logic/city/PopulationManager.kt +++ b/core/src/com/unciv/logic/city/PopulationManager.kt @@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.Color import com.unciv.logic.automation.Automation import com.unciv.logic.map.TileInfo import com.unciv.models.stats.Stats +import com.unciv.ui.utils.tr class PopulationManager { @@ -47,7 +48,7 @@ class PopulationManager { { population-- foodStored = 0 - cityInfo.civInfo.addNotification(cityInfo.name + " is starving!", cityInfo.location, Color.RED) + cityInfo.civInfo.addNotification(cityInfo.name + " {is starving}!".tr(), cityInfo.location, Color.RED) } if (foodStored >= getFoodToNextPopulation()) // growth! @@ -56,7 +57,7 @@ class PopulationManager { if (cityInfo.buildingUniques.contains("40% of food is carried over after a new citizen is born")) foodStored += (0.4f * getFoodToNextPopulation()).toInt() // Aqueduct special population++ autoAssignPopulation() - cityInfo.civInfo.addNotification(cityInfo.name + " has grown!", cityInfo.location, Color.GREEN) + cityInfo.civInfo.addNotification(cityInfo.name + " {has grown}!".tr(), cityInfo.location, Color.GREEN) } } diff --git a/core/src/com/unciv/logic/civilization/TechManager.kt b/core/src/com/unciv/logic/civilization/TechManager.kt index 2c484d1c43..9a0852fac3 100644 --- a/core/src/com/unciv/logic/civilization/TechManager.kt +++ b/core/src/com/unciv/logic/civilization/TechManager.kt @@ -5,6 +5,7 @@ import com.badlogic.gdx.graphics.Color import com.unciv.models.gamebasics.GameBasics import com.unciv.models.gamebasics.Technology import com.unciv.models.gamebasics.unit.Unit +import com.unciv.ui.utils.tr import java.util.* class TechManager { @@ -56,7 +57,7 @@ class TechManager { techsInProgress.remove(currentTechnology) techsToResearch.remove(currentTechnology) techsResearched.add(currentTechnology) - civInfo.addNotification("Research of $currentTechnology has completed!", null, Color.BLUE) + civInfo.addNotification("{Research of} $currentTechnology {has completed}!".tr(), null, Color.BLUE) val revealedResource = GameBasics.TileResources.values.firstOrNull { currentTechnology == it.revealedBy } @@ -68,7 +69,7 @@ class TechManager { .firstOrNull { it.isCityCenter() } if (closestCityTile != null) { civInfo.addNotification( - revealedResource.name + " revealed near " + closestCityTile.getCity()!!.name, tileInfo.position, Color.BLUE) + revealedResource.name.tr() + " {revealed near} ".tr() + closestCityTile.getCity()!!.name, tileInfo.position, Color.BLUE) break } } diff --git a/core/src/com/unciv/models/gamebasics/Technology.kt b/core/src/com/unciv/models/gamebasics/Technology.kt index 384263106f..5dacca8de9 100644 --- a/core/src/com/unciv/models/gamebasics/Technology.kt +++ b/core/src/com/unciv/models/gamebasics/Technology.kt @@ -12,28 +12,27 @@ class Technology : ICivilopedia { val improvedImprovements = GameBasics.TileImprovements.values.filter { it.improvingTech==name }.groupBy { it.improvingTechStats.toString() } improvedImprovements.forEach{ - val impimpString = it.value.joinToString { it.name.tr() } +" provide" + (if(it.value.size==1) "s" else "") +" "+it.key + val impimpString = it.value.joinToString { it.name } +" provide" + (if(it.value.size==1) "s" else "") +" "+it.key SB.appendln(impimpString) } val enabledUnits = GameBasics.Units.values.filter { it.requiredTech==name } - if(enabledUnits.isNotEmpty()) SB.appendln("" + - "Units enabled: "+enabledUnits.map { it.name + " ("+it.getShortDescription()+")" }.joinToString()) + if(enabledUnits.isNotEmpty()) SB.appendln("{Units enabled}: "+enabledUnits.map { it.name + " ("+it.getShortDescription()+")" }.joinToString()) val enabledBuildings = GameBasics.Buildings.values.filter { it.requiredTech==name } val regularBuildings = enabledBuildings.filter { !it.isWonder } if(regularBuildings.isNotEmpty()) - SB.appendln("Buildings enabled: "+regularBuildings.map { "\n * "+it.name + " ("+it.getShortDescription()+")" }.joinToString()) + SB.appendln("{Buildings enabled}: "+regularBuildings.map { "\n * "+it.name + " ("+it.getShortDescription()+")" }.joinToString()) val wonders = enabledBuildings.filter { it.isWonder } - if(wonders.isNotEmpty()) SB.appendln("Wonders enabled: "+wonders.map { "\n * "+it.name+ " ("+it.getShortDescription()+")" }.joinToString()) + if(wonders.isNotEmpty()) SB.appendln("{Wonders enabled}: "+wonders.map { "\n * "+it.name+ " ("+it.getShortDescription()+")" }.joinToString()) - val revealedResource = GameBasics.TileResources.values.filter { it.revealedBy==name }.map { it.name.tr() }.firstOrNull() // can only be one + val revealedResource = GameBasics.TileResources.values.filter { it.revealedBy==name }.map { it.name }.firstOrNull() // can only be one if(revealedResource!=null) SB.appendln("Reveals $revealedResource on map") val tileImprovements = GameBasics.TileImprovements.values.filter { it.techRequired==name } - if(tileImprovements.isNotEmpty()) SB.appendln("Tile improvements enabled: "+tileImprovements.map { it.name.tr() }.joinToString()) + if(tileImprovements.isNotEmpty()) SB.appendln("{Tile improvements enabled}: "+tileImprovements.map { it.name }.joinToString()) - return SB.toString().trim() + return SB.toString().trim().tr() } lateinit var name: String diff --git a/core/src/com/unciv/ui/LoadScreen.kt b/core/src/com/unciv/ui/LoadScreen.kt index fde5a4e181..77ec77354e 100644 --- a/core/src/com/unciv/ui/LoadScreen.kt +++ b/core/src/com/unciv/ui/LoadScreen.kt @@ -21,7 +21,7 @@ class LoadScreen : PickerScreen() { val saveTable = Table() - val deleteSaveButton = TextButton("Delete save", CameraStageBaseScreen.skin) + val deleteSaveButton = TextButton("Delete save".tr(), CameraStageBaseScreen.skin) deleteSaveButton .addClickListener { GameSaver().deleteSave(selectedSave) UnCivGame.Current.screen = LoadScreen() @@ -40,12 +40,12 @@ class LoadScreen : PickerScreen() { var textToSet = it val savedAt = Date(GameSaver().getSave(it).lastModified()) - textToSet+="\nSaved at: "+ SimpleDateFormat("dd-MM-yy HH.mm").format(savedAt) + textToSet+="\n{Saved at}: ".tr()+ SimpleDateFormat("dd-MM-yy HH.mm").format(savedAt) try{ val game = GameSaver().loadGame(it) - textToSet+="\n"+game.getPlayerCivilization()+", ${"Turn".tr()} "+game.turns + textToSet+="\n"+game.getPlayerCivilization()+", {Turn} ".tr()+game.turns }catch (ex:Exception){ - textToSet+="\nCould not load game!" + textToSet+="\n{Could not load game}!".tr() } descriptionLabel.setText(textToSet) rightSideButton.setText("Load\r\n$it") @@ -57,7 +57,7 @@ class LoadScreen : PickerScreen() { } val loadFromClipboardTable = Table() - val loadFromClipboardButton = TextButton("Load copied data",skin) + val loadFromClipboardButton = TextButton("Load copied data".tr(),skin) val errorLabel = Label("",skin).setFontColor(Color.RED) loadFromClipboardButton.addClickListener { try{ diff --git a/core/src/com/unciv/ui/pickerscreens/ConstructionPickerScreen.kt b/core/src/com/unciv/ui/pickerscreens/ConstructionPickerScreen.kt index ecf03c2cce..bf5ceb8ef7 100644 --- a/core/src/com/unciv/ui/pickerscreens/ConstructionPickerScreen.kt +++ b/core/src/com/unciv/ui/pickerscreens/ConstructionPickerScreen.kt @@ -50,9 +50,9 @@ class ConstructionPickerScreen(val city: CityInfo) : PickerScreen() { for (building in GameBasics.Buildings.values) { if (!building.isBuildable(cityConstructions) && building.name!=cityConstructions.currentConstruction) continue val productionTextButton = getProductionButton(building.name, - building.name + "\r\n" + cityConstructions.turnsToConstruction(building.name) + " "+"turns".tr(), + building.name + "\r\n" + cityConstructions.turnsToConstruction(building.name) + " {turns}".tr(), building.getDescription(true, civInfo.policies.getAdoptedPolicies()), - "Build " + building.name) + "{Build} ".tr() + building.name) if (building.isWonder) wonders.addActor(productionTextButton) else @@ -61,8 +61,8 @@ class ConstructionPickerScreen(val city: CityInfo) : PickerScreen() { for (unit in GameBasics.Units.values.filter { it.isBuildable(cityConstructions)}) { units.addActor(getProductionButton(unit.name, - unit.name + "\r\n" + cityConstructions.turnsToConstruction(unit.name) + " "+"turns".tr(), - unit.getDescription(true), "Train " + unit.name)) + unit.name + "\r\n" + cityConstructions.turnsToConstruction(unit.name) + " {turns}".tr(), + unit.getDescription(true), "{Train} ".tr() + unit.name)) } for(specialConstruction in cityConstructions.getSpecialConstructions().filter { it.isBuildable(cityConstructions) }){ diff --git a/core/src/com/unciv/ui/pickerscreens/TechPickerScreen.kt b/core/src/com/unciv/ui/pickerscreens/TechPickerScreen.kt index e5413b8260..2e63603b5b 100644 --- a/core/src/com/unciv/ui/pickerscreens/TechPickerScreen.kt +++ b/core/src/com/unciv/ui/pickerscreens/TechPickerScreen.kt @@ -113,7 +113,7 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen() } if (civTech.isResearched(tech.name)) { - rightSideButton.setText("Research") + rightSideButton.setText("Research".tr()) rightSideButton.disable() setButtonsInfo() return @@ -139,7 +139,7 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen() while (!prerequisites.isEmpty()) techsToResearch.add(prerequisites.pop()) } - pick("Research \r\n" + techsToResearch[0]) + pick("{Research} \r\n".tr() + techsToResearch[0]) setButtonsInfo() }