Added Civilopedia texts to translation file
This commit is contained in:
parent
1048489ff2
commit
efe677d27c
4 changed files with 44 additions and 28 deletions
|
@ -7674,4 +7674,19 @@
|
||||||
"Wolfpack III":{
|
"Wolfpack III":{
|
||||||
Italian:"Attacco in massa III"
|
Italian:"Attacco in massa III"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Civilopedia texts
|
||||||
|
"Basics":{}
|
||||||
|
"Resources":{}
|
||||||
|
"Terrains":{}
|
||||||
|
"Tile improvements":{}
|
||||||
|
|
||||||
|
"Unique to [civName], replaces [unitName]":{}
|
||||||
|
"Requires [buildingName] to be built in the city":{}
|
||||||
|
"Requires [buildingName] to be built in all cities":{}
|
||||||
|
"Provides a free [buildingName] in the city":{}
|
||||||
|
"Requires worked [resource] near city":{}
|
||||||
|
"Required tech: [requiredTech]":{}
|
||||||
|
"Upgrades to [upgradedUnit]":{}
|
||||||
|
"Obsolete with [obsoleteTech]":{}
|
||||||
}
|
}
|
|
@ -61,7 +61,7 @@ class Building : NamedStats(), IConstruction{
|
||||||
infoList += improvedResources.joinToString()+ " {provide} ".tr()+ resourceBonusStats.toString()
|
infoList += improvedResources.joinToString()+ " {provide} ".tr()+ resourceBonusStats.toString()
|
||||||
}
|
}
|
||||||
if(requiredNearbyImprovedResources!=null)
|
if(requiredNearbyImprovedResources!=null)
|
||||||
infoList += "requires worked "+requiredNearbyImprovedResources!!.joinToString("/")+" near city"
|
infoList += ("Requires worked ["+requiredNearbyImprovedResources!!.joinToString("/"){it.tr()}+"] near city").tr()
|
||||||
if(uniques.isNotEmpty()) infoList += uniques.joinToString { it.tr() }
|
if(uniques.isNotEmpty()) infoList += uniques.joinToString { it.tr() }
|
||||||
if(cityStrength!=0) infoList+="{City strength} +".tr()+cityStrength
|
if(cityStrength!=0) infoList+="{City strength} +".tr()+cityStrength
|
||||||
if(cityHealth!=0) infoList+="{City health} +".tr()+cityHealth
|
if(cityHealth!=0) infoList+="{City health} +".tr()+cityHealth
|
||||||
|
@ -72,17 +72,17 @@ class Building : NamedStats(), IConstruction{
|
||||||
fun getDescription(forBuildingPickerScreen: Boolean, adoptedPolicies: HashSet<String>): String {
|
fun getDescription(forBuildingPickerScreen: Boolean, adoptedPolicies: HashSet<String>): String {
|
||||||
val stats = getStats(adoptedPolicies)
|
val stats = getStats(adoptedPolicies)
|
||||||
val stringBuilder = StringBuilder()
|
val stringBuilder = StringBuilder()
|
||||||
if(uniqueTo!=null) stringBuilder.appendln("Unique to $uniqueTo, replaces $replaces")
|
if(uniqueTo!=null) stringBuilder.appendln("Unique to [$uniqueTo], replaces [$replaces]".tr())
|
||||||
if (!forBuildingPickerScreen) stringBuilder.appendln("{Cost}: $cost".tr())
|
if (!forBuildingPickerScreen) stringBuilder.appendln("{Cost}: $cost".tr())
|
||||||
if (isWonder) stringBuilder.appendln("Wonder".tr())
|
if (isWonder) stringBuilder.appendln("Wonder".tr())
|
||||||
if (!forBuildingPickerScreen && requiredTech != null)
|
if (!forBuildingPickerScreen && requiredTech != null)
|
||||||
stringBuilder.appendln("Requires {$requiredTech} to be researched".tr())
|
stringBuilder.appendln("Required tech: [$requiredTech]".tr())
|
||||||
if (!forBuildingPickerScreen && requiredBuilding != null)
|
if (!forBuildingPickerScreen && requiredBuilding != null)
|
||||||
stringBuilder.appendln("Requires a $requiredBuilding to be built in this city")
|
stringBuilder.appendln("Requires [$requiredBuilding] to be built in the city".tr())
|
||||||
if (!forBuildingPickerScreen && requiredBuildingInAllCities != null)
|
if (!forBuildingPickerScreen && requiredBuildingInAllCities != null)
|
||||||
stringBuilder.appendln("Requires a $requiredBuildingInAllCities to be built in all cities")
|
stringBuilder.appendln("Requires [$requiredBuildingInAllCities] to be built in all cities".tr())
|
||||||
if (providesFreeBuilding != null)
|
if (providesFreeBuilding != null)
|
||||||
stringBuilder.appendln("Provides a free $providesFreeBuilding in this city")
|
stringBuilder.appendln("Provides a free [$providesFreeBuilding] in the city".tr())
|
||||||
if(uniques.isNotEmpty()) stringBuilder.appendln(uniques.asSequence().map { it.tr() }.joinToString("\n"))
|
if(uniques.isNotEmpty()) stringBuilder.appendln(uniques.asSequence().map { it.tr() }.joinToString("\n"))
|
||||||
if (stats.toString() != "")
|
if (stats.toString() != "")
|
||||||
stringBuilder.appendln(stats)
|
stringBuilder.appendln(stats)
|
||||||
|
@ -95,10 +95,10 @@ class Building : NamedStats(), IConstruction{
|
||||||
}
|
}
|
||||||
if (this.greatPersonPoints != null) {
|
if (this.greatPersonPoints != null) {
|
||||||
val gpp = this.greatPersonPoints!!
|
val gpp = this.greatPersonPoints!!
|
||||||
if (gpp.production != 0f) stringBuilder.appendln("+" + gpp.production.toInt() + " Great Engineer points")
|
if (gpp.production != 0f) stringBuilder.appendln("+" + gpp.production.toInt()+" " + "[Great Engineer] points".tr())
|
||||||
if (gpp.gold != 0f) stringBuilder.appendln("+" + gpp.gold.toInt() + " Great Merchant points")
|
if (gpp.gold != 0f) stringBuilder.appendln("+" + gpp.gold.toInt() + " "+"[Great Merchant] points".tr())
|
||||||
if (gpp.science != 0f) stringBuilder.appendln("+" + gpp.science.toInt() + " Great Scientist points")
|
if (gpp.science != 0f) stringBuilder.appendln("+" + gpp.science.toInt() + " "+"[Great Scientist] points".tr())
|
||||||
if (gpp.culture != 0f) stringBuilder.appendln("+" + gpp.culture.toInt() + " Great Artist points")
|
if (gpp.culture != 0f) stringBuilder.appendln("+" + gpp.culture.toInt() + " "+"[Great Artist] points".tr())
|
||||||
}
|
}
|
||||||
if (resourceBonusStats != null) {
|
if (resourceBonusStats != null) {
|
||||||
val resources = GameBasics.TileResources.values.filter { name == it.building }.joinToString { it.name.tr() }
|
val resources = GameBasics.TileResources.values.filter { name == it.building }.joinToString { it.name.tr() }
|
||||||
|
@ -106,7 +106,7 @@ class Building : NamedStats(), IConstruction{
|
||||||
}
|
}
|
||||||
|
|
||||||
if(requiredNearbyImprovedResources!=null)
|
if(requiredNearbyImprovedResources!=null)
|
||||||
stringBuilder.appendln("Requires worked "+requiredNearbyImprovedResources!!.joinToString("/")+" near city")
|
stringBuilder.appendln(("Requires worked ["+requiredNearbyImprovedResources!!.joinToString("/"){it.tr()}+"] near city").tr())
|
||||||
|
|
||||||
if(cityStrength!=0) stringBuilder.appendln("{City strength} +".tr() + cityStrength)
|
if(cityStrength!=0) stringBuilder.appendln("{City strength} +".tr() + cityStrength)
|
||||||
if(cityHealth!=0) stringBuilder.appendln("{City health} +".tr() + cityHealth)
|
if(cityHealth!=0) stringBuilder.appendln("{City health} +".tr() + cityHealth)
|
||||||
|
|
|
@ -56,14 +56,14 @@ class BaseUnit : INamed, IConstruction, ICivilopedia {
|
||||||
|
|
||||||
fun getDescription(forPickerScreen:Boolean): String {
|
fun getDescription(forPickerScreen:Boolean): String {
|
||||||
val sb = StringBuilder()
|
val sb = StringBuilder()
|
||||||
if(requiredResource!=null) sb.appendln("Requires {$requiredResource}".tr())
|
if(requiredResource!=null) sb.appendln("{Requires} {$requiredResource}".tr())
|
||||||
if(!forPickerScreen) {
|
if(!forPickerScreen) {
|
||||||
if(uniqueTo!=null) sb.appendln("Unique to $uniqueTo, replaces $replaces")
|
if(uniqueTo!=null) sb.appendln("Unique to $uniqueTo, replaces $replaces")
|
||||||
if (unbuildable) sb.appendln("Unbuildable".tr())
|
if (unbuildable) sb.appendln("Unbuildable".tr())
|
||||||
else sb.appendln("Cost: $cost")
|
else sb.appendln("Cost: $cost")
|
||||||
if(requiredTech!=null) sb.appendln("Required tech: {$requiredTech}".tr())
|
if(requiredTech!=null) sb.appendln("Required tech: [$requiredTech]".tr())
|
||||||
if(upgradesTo!=null) sb.appendln("Upgrades to $upgradesTo")
|
if(upgradesTo!=null) sb.appendln("Upgrades to [$upgradesTo]".tr())
|
||||||
if(obsoleteTech!=null) sb.appendln("Obsolete with $obsoleteTech")
|
if(obsoleteTech!=null) sb.appendln("Obsolete with [$obsoleteTech]".tr())
|
||||||
}
|
}
|
||||||
if(strength!=0){
|
if(strength!=0){
|
||||||
sb.append("{Strength} $strength".tr())
|
sb.append("{Strength} $strength".tr())
|
||||||
|
|
|
@ -9,6 +9,7 @@ import com.unciv.UnCivGame
|
||||||
import com.unciv.models.gamebasics.BasicHelp
|
import com.unciv.models.gamebasics.BasicHelp
|
||||||
import com.unciv.models.gamebasics.GameBasics
|
import com.unciv.models.gamebasics.GameBasics
|
||||||
import com.unciv.models.gamebasics.ICivilopedia
|
import com.unciv.models.gamebasics.ICivilopedia
|
||||||
|
import com.unciv.models.gamebasics.tr
|
||||||
import com.unciv.ui.utils.CameraStageBaseScreen
|
import com.unciv.ui.utils.CameraStageBaseScreen
|
||||||
import com.unciv.ui.utils.onClick
|
import com.unciv.ui.utils.onClick
|
||||||
import com.unciv.ui.utils.toLabel
|
import com.unciv.ui.utils.toLabel
|
||||||
|
@ -29,26 +30,26 @@ class CivilopediaScreen : CameraStageBaseScreen() {
|
||||||
val label = "".toLabel()
|
val label = "".toLabel()
|
||||||
label.setWrap(true)
|
label.setWrap(true)
|
||||||
|
|
||||||
val goToGameButton = TextButton("Return \r\nto game", CameraStageBaseScreen.skin)
|
val goToGameButton = TextButton("Close".tr(), CameraStageBaseScreen.skin)
|
||||||
goToGameButton.onClick {
|
goToGameButton.onClick {
|
||||||
game.setWorldScreen()
|
game.setWorldScreen()
|
||||||
dispose()
|
dispose()
|
||||||
}
|
}
|
||||||
buttonTable.add(goToGameButton)
|
buttonTable.add(goToGameButton)
|
||||||
|
|
||||||
val map = LinkedHashMap<String, Collection<ICivilopedia>>()
|
val categoryToInfos = LinkedHashMap<String, Collection<ICivilopedia>>()
|
||||||
|
|
||||||
val language = UnCivGame.Current.settings.language.replace(" ","_")
|
val language = UnCivGame.Current.settings.language.replace(" ","_")
|
||||||
val basicHelpFileName = if(Gdx.files.internal("jsons/BasicHelp_$language.json").exists())"BasicHelp_$language"
|
val basicHelpFileName = if(Gdx.files.internal("jsons/BasicHelp_$language.json").exists())"BasicHelp_$language"
|
||||||
else "BasicHelp"
|
else "BasicHelp"
|
||||||
|
|
||||||
map["Basics"] = GameBasics.getFromJson(kotlin.Array<BasicHelp>::class.java, basicHelpFileName).toList()
|
categoryToInfos["Basics"] = GameBasics.getFromJson(kotlin.Array<BasicHelp>::class.java, basicHelpFileName).toList()
|
||||||
map["Buildings"] = GameBasics.Buildings.values
|
categoryToInfos["Buildings"] = GameBasics.Buildings.values
|
||||||
map["Resources"] = GameBasics.TileResources.values
|
categoryToInfos["Resources"] = GameBasics.TileResources.values
|
||||||
map["Terrains"] = GameBasics.Terrains.values
|
categoryToInfos["Terrains"] = GameBasics.Terrains.values
|
||||||
map["Tile Improvements"] = GameBasics.TileImprovements.values
|
categoryToInfos["Tile Improvements"] = GameBasics.TileImprovements.values
|
||||||
map["Units"] = GameBasics.Units.values
|
categoryToInfos["Units"] = GameBasics.Units.values
|
||||||
map["Technologies"] = GameBasics.Technologies.values
|
categoryToInfos["Technologies"] = GameBasics.Technologies.values
|
||||||
|
|
||||||
val nameList = List<ICivilopedia>(CameraStageBaseScreen.skin)
|
val nameList = List<ICivilopedia>(CameraStageBaseScreen.skin)
|
||||||
|
|
||||||
|
@ -62,14 +63,14 @@ class CivilopediaScreen : CameraStageBaseScreen() {
|
||||||
|
|
||||||
val buttons = ArrayList<Button>()
|
val buttons = ArrayList<Button>()
|
||||||
var first = true
|
var first = true
|
||||||
for (str in map.keys) {
|
for (str in categoryToInfos.keys) {
|
||||||
val button = TextButton(str, CameraStageBaseScreen.skin)
|
val button = TextButton(str.tr(), CameraStageBaseScreen.skin)
|
||||||
button.style = TextButton.TextButtonStyle(button.style)
|
button.style = TextButton.TextButtonStyle(button.style)
|
||||||
button.style.checkedFontColor = Color.BLACK
|
button.style.checkedFontColor = Color.BLACK
|
||||||
buttons.add(button)
|
buttons.add(button)
|
||||||
val buttonClicked = {
|
val buttonClicked = {
|
||||||
val newArray = Array<ICivilopedia>()
|
val newArray = Array<ICivilopedia>()
|
||||||
for (civilopediaEntry in map[str]!!.sortedBy { it.toString() }) // Alphabetical order
|
for (civilopediaEntry in categoryToInfos[str]!!.sortedBy { it.toString() }) // Alphabetical order
|
||||||
newArray.add(civilopediaEntry)
|
newArray.add(civilopediaEntry)
|
||||||
nameList.setItems(newArray)
|
nameList.setItems(newArray)
|
||||||
nameList.selected = nameList.items.get(0)
|
nameList.selected = nameList.items.get(0)
|
||||||
|
|
Loading…
Reference in a new issue