From e808885e0d07c6927e005b301ed1d534d14bad22 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Thu, 14 Jun 2018 22:19:59 +0300 Subject: [PATCH] Applied translation to many part of the project --- core/src/com/unciv/logic/city/CityConstructions.kt | 5 +++-- core/src/com/unciv/logic/map/TileInfo.kt | 3 ++- core/src/com/unciv/models/gamebasics/Translations.kt | 2 +- core/src/com/unciv/ui/LoadScreen.kt | 2 +- .../com/unciv/ui/pickerscreens/ConstructionPickerScreen.kt | 5 +++-- core/src/com/unciv/ui/pickerscreens/PickerScreen.kt | 3 ++- core/src/com/unciv/ui/pickerscreens/TechPickerScreen.kt | 3 ++- core/src/com/unciv/ui/utils/CameraStageBaseScreen.kt | 2 +- core/src/com/unciv/ui/worldscreen/WorldScreen.kt | 2 +- core/src/com/unciv/ui/worldscreen/WorldScreenTopBar.kt | 2 +- .../optionstable/WorldScreenDisplayOptionsTable.kt | 3 ++- .../ui/worldscreen/optionstable/WorldScreenOptionsTable.kt | 2 +- 12 files changed, 20 insertions(+), 14 deletions(-) diff --git a/core/src/com/unciv/logic/city/CityConstructions.kt b/core/src/com/unciv/logic/city/CityConstructions.kt index 1fb9671c86..51e30a1782 100644 --- a/core/src/com/unciv/logic/city/CityConstructions.kt +++ b/core/src/com/unciv/logic/city/CityConstructions.kt @@ -5,6 +5,7 @@ import com.unciv.logic.automation.Automation import com.unciv.models.gamebasics.Building import com.unciv.models.gamebasics.GameBasics import com.unciv.models.stats.Stats +import com.unciv.ui.utils.tr import java.util.* @@ -44,14 +45,14 @@ class CityConstructions { fun getCityProductionTextForCityButton(): String { var result = currentConstruction if (result != "Science" && result != "Gold") - result += "\r\n" + turnsToConstruction(currentConstruction) + " turns" + 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" + result += "\r\nin " + turnsToConstruction(currentConstruction) + " "+"turns".tr() return result } diff --git a/core/src/com/unciv/logic/map/TileInfo.kt b/core/src/com/unciv/logic/map/TileInfo.kt index 8d3c5f82f4..10af6d3931 100644 --- a/core/src/com/unciv/logic/map/TileInfo.kt +++ b/core/src/com/unciv/logic/map/TileInfo.kt @@ -9,6 +9,7 @@ import com.unciv.models.gamebasics.tile.Terrain import com.unciv.models.gamebasics.tile.TileImprovement import com.unciv.models.gamebasics.tile.TileResource import com.unciv.models.stats.Stats +import com.unciv.ui.utils.tr open class TileInfo { @Transient lateinit var tileMap: TileMap @@ -156,7 +157,7 @@ open class TileInfo { if (hasViewableResource(tileMap.gameInfo.getPlayerCivilization())) SB.appendln(resource!!) if (roadStatus !== RoadStatus.None && !isCityCenter()) SB.appendln(roadStatus) if (improvement != null) SB.appendln(improvement!!) - if (improvementInProgress != null) SB.appendln("$improvementInProgress in ${this.turnsToImprovement} turns") + if (improvementInProgress != null) SB.appendln("$improvementInProgress in ${this.turnsToImprovement} "+"turns".tr()) val isViewableToPlayer = UnCivGame.Current.gameInfo.getPlayerCivilization().getViewableTiles().contains(this) if (civilianUnit != null && isViewableToPlayer) SB.appendln(civilianUnit!!.name) if(militaryUnit!=null && isViewableToPlayer){ diff --git a/core/src/com/unciv/models/gamebasics/Translations.kt b/core/src/com/unciv/models/gamebasics/Translations.kt index 0729669b60..2f68612c23 100644 --- a/core/src/com/unciv/models/gamebasics/Translations.kt +++ b/core/src/com/unciv/models/gamebasics/Translations.kt @@ -34,6 +34,6 @@ class Translations() : HashMap>(){ } fun getLanguages(): List { - return mutableListOf("English").apply { addAll(values.flatMap { it.keys }) } + return mutableListOf("English").apply { addAll(values.flatMap { it.keys }.distinct()) } } } \ No newline at end of file diff --git a/core/src/com/unciv/ui/LoadScreen.kt b/core/src/com/unciv/ui/LoadScreen.kt index aa10845b53..0d1cb579fd 100644 --- a/core/src/com/unciv/ui/LoadScreen.kt +++ b/core/src/com/unciv/ui/LoadScreen.kt @@ -43,7 +43,7 @@ class LoadScreen : PickerScreen() { textToSet+="\nSaved at: "+ SimpleDateFormat("dd-MM-yy HH.mm").format(savedAt) try{ val game = GameSaver().loadGame(it) - textToSet+="\n"+game.getPlayerCivilization()+", turn "+game.turns + textToSet+="\n"+game.getPlayerCivilization()+", ${"Turn".tr()} "+game.turns }catch (ex:Exception){ textToSet+="\nCould not load game!" } diff --git a/core/src/com/unciv/ui/pickerscreens/ConstructionPickerScreen.kt b/core/src/com/unciv/ui/pickerscreens/ConstructionPickerScreen.kt index ac8acf50a0..54404ad0d8 100644 --- a/core/src/com/unciv/ui/pickerscreens/ConstructionPickerScreen.kt +++ b/core/src/com/unciv/ui/pickerscreens/ConstructionPickerScreen.kt @@ -7,6 +7,7 @@ import com.unciv.logic.city.CityInfo import com.unciv.models.gamebasics.GameBasics import com.unciv.ui.cityscreen.CityScreen import com.unciv.ui.utils.addClickListener +import com.unciv.ui.utils.tr class ConstructionPickerScreen(val city: CityInfo) : PickerScreen() { private var selectedProduction: String? = null @@ -49,7 +50,7 @@ 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", + building.name + "\r\n" + cityConstructions.turnsToConstruction(building.name) + " "+"turns".tr(), building.getDescription(true, civInfo.policies.getAdoptedPolicies()), "Build " + building.name) if (building.isWonder) @@ -60,7 +61,7 @@ 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", + unit.name + "\r\n" + cityConstructions.turnsToConstruction(unit.name) + " "+"turns".tr(), unit.getDescription(true), "Train " + unit.name)) } diff --git a/core/src/com/unciv/ui/pickerscreens/PickerScreen.kt b/core/src/com/unciv/ui/pickerscreens/PickerScreen.kt index d67269b0db..888cfe03e8 100644 --- a/core/src/com/unciv/ui/pickerscreens/PickerScreen.kt +++ b/core/src/com/unciv/ui/pickerscreens/PickerScreen.kt @@ -7,10 +7,11 @@ import com.badlogic.gdx.utils.Align import com.unciv.ui.utils.CameraStageBaseScreen import com.unciv.ui.utils.addClickListener import com.unciv.ui.utils.disable +import com.unciv.ui.utils.tr open class PickerScreen : CameraStageBaseScreen() { - internal var closeButton: TextButton = TextButton("Close", CameraStageBaseScreen.skin) + internal var closeButton: TextButton = TextButton("Close".tr(), CameraStageBaseScreen.skin) protected var descriptionLabel: Label protected var rightSideGroup = VerticalGroup() protected var rightSideButton: TextButton diff --git a/core/src/com/unciv/ui/pickerscreens/TechPickerScreen.kt b/core/src/com/unciv/ui/pickerscreens/TechPickerScreen.kt index d94b74930d..a2c84d5c7f 100644 --- a/core/src/com/unciv/ui/pickerscreens/TechPickerScreen.kt +++ b/core/src/com/unciv/ui/pickerscreens/TechPickerScreen.kt @@ -9,6 +9,7 @@ import com.unciv.models.gamebasics.Technology import com.unciv.ui.utils.CameraStageBaseScreen import com.unciv.ui.utils.addClickListener import com.unciv.ui.utils.disable +import com.unciv.ui.utils.tr import java.util.* class TechPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen() { @@ -98,7 +99,7 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen() text += " (" + techsToResearch.indexOf(techName) + ")" } - if (!civTech.isResearched(techName)) text += "\r\n" + turnsToTech[techName] + " turns" + if (!civTech.isResearched(techName)) text += "\r\n" + turnsToTech[techName] + " "+"turns".tr() TB.setText(text) } } diff --git a/core/src/com/unciv/ui/utils/CameraStageBaseScreen.kt b/core/src/com/unciv/ui/utils/CameraStageBaseScreen.kt index 1ea830bac1..5b8b2fae12 100644 --- a/core/src/com/unciv/ui/utils/CameraStageBaseScreen.kt +++ b/core/src/com/unciv/ui/utils/CameraStageBaseScreen.kt @@ -74,7 +74,7 @@ open class CameraStageBaseScreen : Screen { label.setAlignment(Align.center) tutorialTexts.removeAt(0) tutorialTable.add(label).pad(10f).row() - val button = TextButton("Close", skin) + val button = TextButton("Close".tr(), skin) button.addClickListener { tutorialTable.remove() if (!tutorialTexts.isEmpty()) diff --git a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt index fdc9fb6c93..14a9348393 100644 --- a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt +++ b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt @@ -96,7 +96,7 @@ class WorldScreen : CameraStageBaseScreen() { techButton.setText("Choose a tech!") else techButton.setText(civInfo.tech.currentTechnology() + "\r\n" - + civInfo.tech.turnsToTech(civInfo.tech.currentTechnology()!!) + " turns") + + civInfo.tech.turnsToTech(civInfo.tech.currentTechnology()!!) + " "+"turns".tr()) techButton.setSize(techButton.prefWidth, techButton.prefHeight) techButton.setPosition(10f, topBar.y - techButton.height - 5f) diff --git a/core/src/com/unciv/ui/worldscreen/WorldScreenTopBar.kt b/core/src/com/unciv/ui/worldscreen/WorldScreenTopBar.kt index 47cfec75b2..c6fa269586 100644 --- a/core/src/com/unciv/ui/worldscreen/WorldScreenTopBar.kt +++ b/core/src/com/unciv/ui/worldscreen/WorldScreenTopBar.kt @@ -113,7 +113,7 @@ class WorldScreenTopBar(val screen: WorldScreen) : Table() { else -> 2020+(turns-440)/2 } - turnsLabel.setText("Turn " + civInfo.gameInfo.turns + " | "+ abs(year)+(if (year<0) " BCE" else " CE")) + turnsLabel.setText("Turn".tr()+" " + civInfo.gameInfo.turns + " | "+ abs(year)+(if (year<0) " BCE" else " CE")) val nextTurnStats = civInfo.getStatsForNextTurn() val goldPerTurn = "(" + (if (nextTurnStats.gold > 0) "+" else "") + Math.round(nextTurnStats.gold) + ")" diff --git a/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenDisplayOptionsTable.kt b/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenDisplayOptionsTable.kt index ee1be5c805..1330162efc 100644 --- a/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenDisplayOptionsTable.kt +++ b/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenDisplayOptionsTable.kt @@ -8,6 +8,7 @@ import com.unciv.logic.GameSaver import com.unciv.models.gamebasics.GameBasics import com.unciv.ui.utils.CameraStageBaseScreen import com.unciv.ui.utils.center +import com.unciv.ui.utils.tr import com.unciv.ui.worldscreen.WorldScreen class WorldScreenDisplayOptionsTable() : OptionsTable(){ @@ -42,7 +43,7 @@ class WorldScreenDisplayOptionsTable() : OptionsTable(){ }) - addButton("Close"){ remove() } + addButton("Close".tr()){ remove() } pack() // Needed to show the background. center(UnCivGame.Current.worldScreen.stage) diff --git a/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenOptionsTable.kt b/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenOptionsTable.kt index 7fe36e78cf..63db586379 100644 --- a/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenOptionsTable.kt +++ b/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenOptionsTable.kt @@ -28,7 +28,7 @@ class WorldScreenOptionsTable internal constructor() : OptionsTable() { addButton("Victory status".tr()) { UnCivGame.Current.screen = VictoryScreen() } - addButton("Social Policies".tr()){ + addButton("Social policies".tr()){ UnCivGame.Current.screen = PolicyPickerScreen(UnCivGame.Current.gameInfo.getPlayerCivilization()) }