Expanded translation for new game screen and overview screen

This commit is contained in:
Yair Morgenstern
2018-08-04 21:36:08 +03:00
parent 5b26974752
commit ec0ebc73f0
14 changed files with 86 additions and 49 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

View File

@ -2545,6 +2545,35 @@
Romanian:"Mare"
}
// New game screen
"Civilization":{}
"World size":{}
"Number of enemies":{}
"Difficulty":{}
"Diplomacy":{}
// Overview screen
"Overview":{}
"Cities":{}
"Total":{}
"Stats":{}
"Policies":{}
"Base happiness":{}
"Buildings":{}
"Population":{}
"Luxury resources":{}
"Tile yields":{}
"Trade routes":{}
"Maintenance":[}
"Transportation upkeep":{}
"Unit upkeep":{}
"Trades":{}
"Units":{}
"Name":{}
"Closest city":{}
}

View File

@ -6,6 +6,7 @@ import com.badlogic.gdx.utils.Json
import com.unciv.logic.GameInfo
import com.unciv.logic.GameSaver
import com.unciv.models.gamebasics.GameBasics
import com.unciv.ui.LanguagePickerScreen
import com.unciv.ui.worldscreen.WorldScreen
class UnCivGame : Game() {
@ -33,7 +34,7 @@ class UnCivGame : Game() {
startNewGame()
}
}
else startNewGame()
else screen=LanguagePickerScreen() //startNewGame()
}
fun loadGame(gameInfo:GameInfo){

View File

@ -216,7 +216,7 @@ class CityStats {
.add(Stat.Production, cityInfo.population.getFreePopulation().toFloat())
baseStatList["Tile yields"] = getStatsFromTiles()
baseStatList["Specialists"] = getStatsFromSpecialists(cityInfo.population.getSpecialists(), civInfo.policies.adoptedPolicies)
baseStatList["Trade route"] = getStatsFromTradeRoute()
baseStatList["Trade routes"] = getStatsFromTradeRoute()
baseStatList["Buildings"] = cityInfo.cityConstructions.getStats()
baseStatList["Policies"] = getStatsFromPolicies(civInfo.policies.adoptedPolicies)

View File

@ -24,7 +24,7 @@ class EmpireOverviewScreen : CameraStageBaseScreen(){
closeButton.y = stage.height - closeButton.height - 5
topTable.add(closeButton)
val setCityInfoButton = TextButton("Cities",skin)
val setCityInfoButton = TextButton("Cities".tr(),skin)
val setCities = {
centerTable.clear()
centerTable.add(getCityInfoTable())
@ -35,7 +35,7 @@ class EmpireOverviewScreen : CameraStageBaseScreen(){
setCityInfoButton.addClickListener(setCities)
topTable.add(setCityInfoButton)
val setStatsInfoButton = TextButton("Stats",skin)
val setStatsInfoButton = TextButton("Stats".tr(),skin)
setStatsInfoButton.addClickListener {
centerTable.clear()
centerTable.add(getHappinessTable())
@ -45,7 +45,7 @@ class EmpireOverviewScreen : CameraStageBaseScreen(){
}
topTable.add(setStatsInfoButton)
val setCurrentTradesButton = TextButton("Trades",skin)
val setCurrentTradesButton = TextButton("Trades".tr(),skin)
setCurrentTradesButton.addClickListener {
centerTable.clear()
centerTable.add(getTradesTable())
@ -54,7 +54,7 @@ class EmpireOverviewScreen : CameraStageBaseScreen(){
}
topTable.add(setCurrentTradesButton)
val setUnitsButton = TextButton("Units",skin)
val setUnitsButton = TextButton("Units".tr(),skin)
setUnitsButton .addClickListener {
centerTable.clear()
centerTable.add(getUnitTable())
@ -86,10 +86,10 @@ class EmpireOverviewScreen : CameraStageBaseScreen(){
table.defaults().pad(10f)
table.add(civInfo.civName)
table.add(civName).row()
val ourOffersStrings = trade.ourOffers.map { it.amount.toString()+" "+it.name +
(if (it.duration==0) "" else " ("+it.duration+" turns)") }
val theirOffersStrings = trade.theirOffers.map { it.amount.toString()+" "+it.name +
(if (it.duration==0) "" else " ("+it.duration+" turns)") }
val ourOffersStrings = trade.ourOffers.map { it.amount.toString()+" "+it.name.tr() +
(if (it.duration==0) "" else " ("+it.duration+" {turns})".tr()) }
val theirOffersStrings = trade.theirOffers.map { it.amount.toString()+" "+it.name.tr() +
(if (it.duration==0) "" else " ("+it.duration+" {turns})".tr()) }
for(i in 0 until max(trade.ourOffers.size,trade.theirOffers.size)){
if(ourOffersStrings.size>i) table.add(ourOffersStrings[i])
else table.add()
@ -103,12 +103,12 @@ class EmpireOverviewScreen : CameraStageBaseScreen(){
private fun getHappinessTable(): Table {
val happinessTable = Table(skin)
happinessTable.defaults().pad(5f)
happinessTable.add(Label("Happiness", skin).setFont(24)).colspan(2).row()
happinessTable.add(Label("Happiness".tr(), skin).setFont(24)).colspan(2).row()
for (entry in civInfo.getHappinessForNextTurn()) {
happinessTable.add(entry.key)
happinessTable.add(entry.key.tr())
happinessTable.add(entry.value.toString()).row()
}
happinessTable.add("Total")
happinessTable.add("Total".tr())
happinessTable.add(civInfo.getHappinessForNextTurn().values.sum().toString())
happinessTable.pack()
return happinessTable
@ -117,15 +117,15 @@ class EmpireOverviewScreen : CameraStageBaseScreen(){
private fun getGoldTable(): Table {
val goldTable = Table(skin)
goldTable.defaults().pad(5f)
goldTable.add(Label("Gold", skin).setFont(24)).colspan(2).row()
goldTable.add(Label("Gold".tr(), skin).setFont(24)).colspan(2).row()
var total=0f
for (entry in civInfo.getStatMapForNextTurn()) {
if(entry.value.gold==0f) continue
goldTable.add(entry.key)
goldTable.add(entry.key.tr())
goldTable.add(entry.value.gold.toString()).row()
total += entry.value.gold
}
goldTable.add("Total")
goldTable.add("Total".tr())
goldTable.add(total.toString())
goldTable.pack()
return goldTable
@ -138,7 +138,7 @@ class EmpireOverviewScreen : CameraStageBaseScreen(){
val cityInfoTableIcons = Table(skin)
cityInfoTableIcons.defaults().pad(padding).align(Align.center)
cityInfoTableIcons.add(Label("Cities", skin).setFont(24)).colspan(8).align(Align.center).row()
cityInfoTableIcons.add(Label("Cities".tr(), skin).setFont(24)).colspan(8).align(Align.center).row()
cityInfoTableIcons.add()
cityInfoTableIcons.add(ImageGetter.getStatIcon("Population")).size(iconSize)
cityInfoTableIcons.add(ImageGetter.getStatIcon("Food")).size(iconSize)
@ -173,7 +173,7 @@ class EmpireOverviewScreen : CameraStageBaseScreen(){
val cityInfoTableTotal = Table(skin)
cityInfoTableTotal.defaults().pad(padding).minWidth(iconSize)//we need the min width so we can align the different tables
cityInfoTableTotal.add("Total")
cityInfoTableTotal.add("Total".tr())
cityInfoTableTotal.add(civInfo.cities.sumBy { it.population.population }.toString()).actor!!.setAlignment(Align.center)
cityInfoTableTotal.add()//an intended empty space
cityInfoTableTotal.add(civInfo.cities.sumBy { it.cityStats.currentCityStats.gold.toInt() }.toString()).actor!!.setAlignment(Align.center)
@ -201,11 +201,11 @@ class EmpireOverviewScreen : CameraStageBaseScreen(){
fun getUnitTable(): Table {
val table=Table(skin).apply { defaults().pad(5f) }
table.add("Name")
table.add("Combat strength")
table.add("Ranged strength")
table.add("Movement")
table.add("Closest city")
table.add("Name".tr())
table.add("Strength".tr())
table.add("Ranged strength".tr())
table.add("Movement".tr())
table.add("Closest city".tr())
table.row()
for(unit in civInfo.getCivUnits()){
val baseUnit = unit.getBaseUnit()

View File

@ -1,10 +1,10 @@
package com.unciv.ui
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.scenes.scene2d.Touchable
import com.badlogic.gdx.scenes.scene2d.ui.Skin
import com.badlogic.gdx.scenes.scene2d.ui.Table
import com.unciv.UnCivGame
import com.unciv.logic.GameSaver
import com.unciv.models.gamebasics.GameBasics
import com.unciv.ui.pickerscreens.PickerScreen
import com.unciv.ui.utils.ImageGetter
@ -20,13 +20,17 @@ class LanguageTable(val language:String,skin: Skin):Table(skin){
init{
pad(10f)
defaults().pad(10f)
add(ImageGetter.getImage("Flags/$language.png"))
add(ImageGetter.getImage("FlagIcons/$language.png")).size(40f)
add(language)
update("")
touchable = Touchable.enabled // so click listener is activated when any part is clicked, not only children
pack()
}
fun update(chosenLanguage:String){
background = ImageGetter.getBackground( if(chosenLanguage==language) blue else darkBlue)
}
}
class LanguagePickerScreen: PickerScreen(){
@ -47,7 +51,7 @@ class LanguagePickerScreen: PickerScreen(){
rightSideButton.enable()
update()
}
topTable.add(languageTable).row()
topTable.add(languageTable).pad(10f).row()
languageTables.add(languageTable)
}

View File

@ -2,6 +2,7 @@ package com.unciv.ui
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox
import com.badlogic.gdx.scenes.scene2d.ui.Skin
import com.badlogic.gdx.scenes.scene2d.ui.Table
import com.badlogic.gdx.utils.Array
import com.unciv.GameStarter
@ -20,28 +21,21 @@ class NewGameScreen: PickerScreen(){
table.skin= skin
table.add("Civilization:".tr())
val civSelectBox = SelectBox<String>(skin)
val civArray = Array<String>()
GameBasics.Civilizations.keys.filterNot { it=="Barbarians" }.forEach{civArray.add(it)}
civSelectBox.setItems(civArray)
civSelectBox.selected = civSelectBox.items.first()
table.add("{Civilization}:".tr())
val civSelectBox = TranslatedSelectBox(GameBasics.Civilizations.keys.filterNot { it=="Barbarians" },
"Babylon",skin)
table.add(civSelectBox).pad(10f).row()
table.add("World size:".tr())
table.add("{World size}:".tr())
val worldSizeToRadius=LinkedHashMap<String,Int>()
worldSizeToRadius["Small"] = 10
worldSizeToRadius["Medium"] = 20
worldSizeToRadius["Large"] = 30
val worldSizeSelectBox = SelectBox<String>(skin)
val worldSizeArray = Array<String>()
worldSizeToRadius.keys.forEach{worldSizeArray.add(it)}
worldSizeSelectBox.items = worldSizeArray
worldSizeSelectBox.selected = "Medium"
val worldSizeSelectBox = TranslatedSelectBox(worldSizeToRadius.keys,"Medium",skin)
table.add(worldSizeSelectBox).pad(10f).row()
table.add("Number of enemies:".tr())
table.add("{Number of enemies}:".tr())
val enemiesSelectBox = SelectBox<Int>(skin)
val enemiesArray=Array<Int>()
(1..5).forEach { enemiesArray.add(it) }
@ -50,12 +44,8 @@ class NewGameScreen: PickerScreen(){
table.add(enemiesSelectBox).pad(10f).row()
table.add("Difficulty:".tr())
val difficultySelectBox = SelectBox<String>(skin)
val difficultyArray = Array<String>()
GameBasics.Difficulties.keys.forEach{difficultyArray.add(it)}
difficultySelectBox.items = difficultyArray
difficultySelectBox.selected = "Chieftain"
table.add("{Difficulty}:".tr())
val difficultySelectBox = TranslatedSelectBox(GameBasics.Difficulties.keys, "Chieftain", skin)
table.add(difficultySelectBox).pad(10f).row()
@ -68,8 +58,8 @@ class NewGameScreen: PickerScreen(){
kotlin.concurrent.thread { // Creating a new game can tke a while and we don't want ANRs
newGame = GameStarter().startNewGame(
worldSizeToRadius[worldSizeSelectBox.selected]!!, enemiesSelectBox.selected,
civSelectBox.selected, difficultySelectBox.selected )
worldSizeToRadius[worldSizeSelectBox.selected.value]!!, enemiesSelectBox.selected,
civSelectBox.selected.value, difficultySelectBox.selected.value )
}
}
@ -88,3 +78,16 @@ class NewGameScreen: PickerScreen(){
super.render(delta)
}
}
class TranslatedSelectBox(values : Collection<String>, default:String, skin: Skin) : SelectBox<TranslatedSelectBox.TranslatedString>(skin){
class TranslatedString(val value: String){
val translation = value.tr()
override fun toString()=translation
}
init {
val array = Array<TranslatedString>()
values.forEach{array.add(TranslatedString(it))}
items = array
selected = array.first { it.value==default }
}
}

View File

@ -114,7 +114,7 @@ class WorldScreen : CameraStageBaseScreen() {
if(civInfo.diplomacy.values.map { it.otherCiv() }
.filterNot { it.isDefeated() || it.isPlayerCivilization() || it.isBarbarianCivilization() }
.any()) {
val btn = TextButton("Diplomacy", skin)
val btn = TextButton("Diplomacy".tr(), skin)
btn.addClickListener { UnCivGame.Current.screen = DiplomacyScreen() }
diplomacyButtonWrapper.add(btn)
}