More things will be translated!

This commit is contained in:
Yair Morgenstern 2018-06-18 13:20:37 +03:00
parent 7d7a2e5ce1
commit e0cfbea5a2
10 changed files with 35 additions and 32 deletions

View File

@ -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)
}
}

View File

@ -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

View File

@ -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)
}

View File

@ -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)
}
}

View File

@ -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)
}
}

View File

@ -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
}
}

View File

@ -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

View File

@ -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{

View File

@ -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) }){

View File

@ -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()
}