Applied translation to many part of the project

This commit is contained in:
Yair Morgenstern 2018-06-14 22:19:59 +03:00
parent c815863124
commit e808885e0d
12 changed files with 20 additions and 14 deletions

View File

@ -5,6 +5,7 @@ import com.unciv.logic.automation.Automation
import com.unciv.models.gamebasics.Building import com.unciv.models.gamebasics.Building
import com.unciv.models.gamebasics.GameBasics import com.unciv.models.gamebasics.GameBasics
import com.unciv.models.stats.Stats import com.unciv.models.stats.Stats
import com.unciv.ui.utils.tr
import java.util.* import java.util.*
@ -44,14 +45,14 @@ class CityConstructions {
fun getCityProductionTextForCityButton(): String { fun getCityProductionTextForCityButton(): String {
var result = currentConstruction var result = currentConstruction
if (result != "Science" && result != "Gold") if (result != "Science" && result != "Gold")
result += "\r\n" + turnsToConstruction(currentConstruction) + " turns" result += "\r\n" + turnsToConstruction(currentConstruction) + " "+"turns".tr()
return result return result
} }
fun getProductionForTileInfo(): String { fun getProductionForTileInfo(): String {
var result = currentConstruction var result = currentConstruction
if (result != "Science" && result != "Gold") if (result != "Science" && result != "Gold")
result += "\r\nin " + turnsToConstruction(currentConstruction) + " turns" result += "\r\nin " + turnsToConstruction(currentConstruction) + " "+"turns".tr()
return result return result
} }

View File

@ -9,6 +9,7 @@ import com.unciv.models.gamebasics.tile.Terrain
import com.unciv.models.gamebasics.tile.TileImprovement import com.unciv.models.gamebasics.tile.TileImprovement
import com.unciv.models.gamebasics.tile.TileResource import com.unciv.models.gamebasics.tile.TileResource
import com.unciv.models.stats.Stats import com.unciv.models.stats.Stats
import com.unciv.ui.utils.tr
open class TileInfo { open class TileInfo {
@Transient lateinit var tileMap: TileMap @Transient lateinit var tileMap: TileMap
@ -156,7 +157,7 @@ open class TileInfo {
if (hasViewableResource(tileMap.gameInfo.getPlayerCivilization())) SB.appendln(resource!!) if (hasViewableResource(tileMap.gameInfo.getPlayerCivilization())) SB.appendln(resource!!)
if (roadStatus !== RoadStatus.None && !isCityCenter()) SB.appendln(roadStatus) if (roadStatus !== RoadStatus.None && !isCityCenter()) SB.appendln(roadStatus)
if (improvement != null) SB.appendln(improvement!!) 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) val isViewableToPlayer = UnCivGame.Current.gameInfo.getPlayerCivilization().getViewableTiles().contains(this)
if (civilianUnit != null && isViewableToPlayer) SB.appendln(civilianUnit!!.name) if (civilianUnit != null && isViewableToPlayer) SB.appendln(civilianUnit!!.name)
if(militaryUnit!=null && isViewableToPlayer){ if(militaryUnit!=null && isViewableToPlayer){

View File

@ -34,6 +34,6 @@ class Translations() : HashMap<String, HashMap<String, String>>(){
} }
fun getLanguages(): List<String> { fun getLanguages(): List<String> {
return mutableListOf("English").apply { addAll(values.flatMap { it.keys }) } return mutableListOf("English").apply { addAll(values.flatMap { it.keys }.distinct()) }
} }
} }

View File

@ -43,7 +43,7 @@ class LoadScreen : PickerScreen() {
textToSet+="\nSaved at: "+ SimpleDateFormat("dd-MM-yy HH.mm").format(savedAt) textToSet+="\nSaved at: "+ SimpleDateFormat("dd-MM-yy HH.mm").format(savedAt)
try{ try{
val game = GameSaver().loadGame(it) val game = GameSaver().loadGame(it)
textToSet+="\n"+game.getPlayerCivilization()+", turn "+game.turns textToSet+="\n"+game.getPlayerCivilization()+", ${"Turn".tr()} "+game.turns
}catch (ex:Exception){ }catch (ex:Exception){
textToSet+="\nCould not load game!" textToSet+="\nCould not load game!"
} }

View File

@ -7,6 +7,7 @@ import com.unciv.logic.city.CityInfo
import com.unciv.models.gamebasics.GameBasics import com.unciv.models.gamebasics.GameBasics
import com.unciv.ui.cityscreen.CityScreen import com.unciv.ui.cityscreen.CityScreen
import com.unciv.ui.utils.addClickListener import com.unciv.ui.utils.addClickListener
import com.unciv.ui.utils.tr
class ConstructionPickerScreen(val city: CityInfo) : PickerScreen() { class ConstructionPickerScreen(val city: CityInfo) : PickerScreen() {
private var selectedProduction: String? = null private var selectedProduction: String? = null
@ -49,7 +50,7 @@ class ConstructionPickerScreen(val city: CityInfo) : PickerScreen() {
for (building in GameBasics.Buildings.values) { for (building in GameBasics.Buildings.values) {
if (!building.isBuildable(cityConstructions) && building.name!=cityConstructions.currentConstruction) continue if (!building.isBuildable(cityConstructions) && building.name!=cityConstructions.currentConstruction) continue
val productionTextButton = getProductionButton(building.name, 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()), building.getDescription(true, civInfo.policies.getAdoptedPolicies()),
"Build " + building.name) "Build " + building.name)
if (building.isWonder) if (building.isWonder)
@ -60,7 +61,7 @@ class ConstructionPickerScreen(val city: CityInfo) : PickerScreen() {
for (unit in GameBasics.Units.values.filter { it.isBuildable(cityConstructions)}) { for (unit in GameBasics.Units.values.filter { it.isBuildable(cityConstructions)}) {
units.addActor(getProductionButton(unit.name, 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)) unit.getDescription(true), "Train " + unit.name))
} }

View File

@ -7,10 +7,11 @@ import com.badlogic.gdx.utils.Align
import com.unciv.ui.utils.CameraStageBaseScreen import com.unciv.ui.utils.CameraStageBaseScreen
import com.unciv.ui.utils.addClickListener import com.unciv.ui.utils.addClickListener
import com.unciv.ui.utils.disable import com.unciv.ui.utils.disable
import com.unciv.ui.utils.tr
open class PickerScreen : CameraStageBaseScreen() { 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 descriptionLabel: Label
protected var rightSideGroup = VerticalGroup() protected var rightSideGroup = VerticalGroup()
protected var rightSideButton: TextButton protected var rightSideButton: TextButton

View File

@ -9,6 +9,7 @@ import com.unciv.models.gamebasics.Technology
import com.unciv.ui.utils.CameraStageBaseScreen import com.unciv.ui.utils.CameraStageBaseScreen
import com.unciv.ui.utils.addClickListener import com.unciv.ui.utils.addClickListener
import com.unciv.ui.utils.disable import com.unciv.ui.utils.disable
import com.unciv.ui.utils.tr
import java.util.* import java.util.*
class TechPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen() { class TechPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen() {
@ -98,7 +99,7 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen()
text += " (" + techsToResearch.indexOf(techName) + ")" 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) TB.setText(text)
} }
} }

View File

@ -74,7 +74,7 @@ open class CameraStageBaseScreen : Screen {
label.setAlignment(Align.center) label.setAlignment(Align.center)
tutorialTexts.removeAt(0) tutorialTexts.removeAt(0)
tutorialTable.add(label).pad(10f).row() tutorialTable.add(label).pad(10f).row()
val button = TextButton("Close", skin) val button = TextButton("Close".tr(), skin)
button.addClickListener { button.addClickListener {
tutorialTable.remove() tutorialTable.remove()
if (!tutorialTexts.isEmpty()) if (!tutorialTexts.isEmpty())

View File

@ -96,7 +96,7 @@ class WorldScreen : CameraStageBaseScreen() {
techButton.setText("Choose a tech!") techButton.setText("Choose a tech!")
else else
techButton.setText(civInfo.tech.currentTechnology() + "\r\n" 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.setSize(techButton.prefWidth, techButton.prefHeight)
techButton.setPosition(10f, topBar.y - techButton.height - 5f) techButton.setPosition(10f, topBar.y - techButton.height - 5f)

View File

@ -113,7 +113,7 @@ class WorldScreenTopBar(val screen: WorldScreen) : Table() {
else -> 2020+(turns-440)/2 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 nextTurnStats = civInfo.getStatsForNextTurn()
val goldPerTurn = "(" + (if (nextTurnStats.gold > 0) "+" else "") + Math.round(nextTurnStats.gold) + ")" val goldPerTurn = "(" + (if (nextTurnStats.gold > 0) "+" else "") + Math.round(nextTurnStats.gold) + ")"

View File

@ -8,6 +8,7 @@ import com.unciv.logic.GameSaver
import com.unciv.models.gamebasics.GameBasics import com.unciv.models.gamebasics.GameBasics
import com.unciv.ui.utils.CameraStageBaseScreen import com.unciv.ui.utils.CameraStageBaseScreen
import com.unciv.ui.utils.center import com.unciv.ui.utils.center
import com.unciv.ui.utils.tr
import com.unciv.ui.worldscreen.WorldScreen import com.unciv.ui.worldscreen.WorldScreen
class WorldScreenDisplayOptionsTable() : OptionsTable(){ class WorldScreenDisplayOptionsTable() : OptionsTable(){
@ -42,7 +43,7 @@ class WorldScreenDisplayOptionsTable() : OptionsTable(){
}) })
addButton("Close"){ remove() } addButton("Close".tr()){ remove() }
pack() // Needed to show the background. pack() // Needed to show the background.
center(UnCivGame.Current.worldScreen.stage) center(UnCivGame.Current.worldScreen.stage)

View File

@ -28,7 +28,7 @@ class WorldScreenOptionsTable internal constructor() : OptionsTable() {
addButton("Victory status".tr()) { UnCivGame.Current.screen = VictoryScreen() } addButton("Victory status".tr()) { UnCivGame.Current.screen = VictoryScreen() }
addButton("Social Policies".tr()){ addButton("Social policies".tr()){
UnCivGame.Current.screen = PolicyPickerScreen(UnCivGame.Current.gameInfo.getPlayerCivilization()) UnCivGame.Current.screen = PolicyPickerScreen(UnCivGame.Current.gameInfo.getPlayerCivilization())
} }