mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 13:55:54 -04:00
Nation translations are go!
This commit is contained in:
parent
0cf4b2e82d
commit
b73077baa4
@ -1,6 +1,7 @@
|
||||
[
|
||||
{
|
||||
name:"Babilonia",
|
||||
name:"Babylon",
|
||||
translatedName:"Babilonia",
|
||||
leaderName:"Nabucodonosor II",
|
||||
|
||||
declaringWar:"Il demone vuole il sangue dei soldati!"
|
||||
@ -29,7 +30,8 @@
|
||||
"Arrapkha","Tutub","Shaduppum","Rapiqum","Mashkan Shapir","Tuttul","Ramad","Ana","Haradum","Agrab"]
|
||||
},
|
||||
{
|
||||
name:"Grecia",
|
||||
name:"Greece",
|
||||
translatedName:"Grecia",
|
||||
leaderName:"Alessandro",
|
||||
|
||||
declaringWar:"Sei sulla mia strada, e pertanto devo distruggerti."
|
||||
@ -86,13 +88,14 @@
|
||||
"Taiyuan","Tainan","Dalian","Lijiang","Wuxi","Suzhou","Maoming","Shaoguan","Yangjiang","Heyuan"]
|
||||
},
|
||||
{
|
||||
name:"Egitto",
|
||||
name:"Egypt",
|
||||
translatedName:"Egitto",
|
||||
leaderName:"Ramesse II",
|
||||
|
||||
declaringWar:"Sei solo una peste sulla Terra! Preparati a essere eliminato!",
|
||||
attacked:"Sei uno sciocco che incute pietà. Hai portato la mia ostilità su di te e la tua ripugnante civiltà!"
|
||||
defeated:"Non hai vinto niente. Colpiscimi e la mia anima ti perseguiterà in eterno."
|
||||
introduction:" Greetings, I am Ramesses the god. I am the living embodiment of Egypt, mother and father of all civilizations."
|
||||
introduction:"Greetings, I am Ramesses the god. I am the living embodiment of Egypt, mother and father of all civilizations."
|
||||
|
||||
neutralHello:"Buongiorno."
|
||||
neutralLetsHearIt:["Avanti.","Parla.","Sono tutto orecchi."]
|
||||
@ -115,7 +118,8 @@
|
||||
"Mendes","Elashmunein","Tanis","Bubasti","Oryx","Sebennytus","Akhmin","Karnak","Luxor","El Kab"]
|
||||
},
|
||||
{
|
||||
name:"Inghilterra",
|
||||
name:"England",
|
||||
translatedName:"Inghilterra",
|
||||
leaderName:"Elisabetta",
|
||||
|
||||
declaringWar:"Per grazia di Dio, i tuoi giorni sono contati."
|
||||
@ -144,7 +148,8 @@
|
||||
"Manchester","Bristol","Leicester","Carlisle","Ipswich","Portsmouth","Berwick","Bath","Mumbles","Southampton"]
|
||||
},
|
||||
{
|
||||
name:"Francia",
|
||||
name:"France",
|
||||
translatedName:"Francia",
|
||||
leaderName:"Napoleone",
|
||||
|
||||
declaringWar:"Come osi disturbare la tranquillità del mio impero? Preparati a morire!",
|
||||
@ -202,7 +207,8 @@
|
||||
"Arkhangelsk","Chelyabinsk","Tobolsk","Vologda","Omsk","Astrakhan","Kursk","Saratov","Tula","Vladimir"]
|
||||
},
|
||||
{
|
||||
name:"Roma",
|
||||
name:"Rome",
|
||||
translatedName:"Roma",
|
||||
leaderName:"Augusto Cesare",
|
||||
|
||||
declaringWar:"Il mio tesoro va scarseggiando e i miei soldati si stanno spazientendo... <sigh> ...pertanto, dovrò muoverti guerra."
|
||||
@ -260,7 +266,8 @@
|
||||
"Aydab","Bayt","Suhar","Taif","Hama","Tabuk","Sana'a","Shihr","Tripoli","Tunis"]
|
||||
},
|
||||
{
|
||||
name:"Stati Uniti",
|
||||
name:"America",
|
||||
translatedName:"Stati Uniti",
|
||||
leaderName:"Washington",
|
||||
|
||||
declaringWar:"La tua sfrenata aggressività non ci lascia altra scelta. Preparati alla guerra!"
|
@ -4145,6 +4145,9 @@
|
||||
German:"[civName] hat uns den Krieg erklärt!"
|
||||
}
|
||||
|
||||
"[leaderName] of [nation]":{ // e.g. Ramasses of Egypt, Napoleon of France
|
||||
}
|
||||
|
||||
"You'll pay for this!":{
|
||||
Italian:"Pagherai caro questo affronto!"
|
||||
}
|
||||
@ -4154,6 +4157,7 @@
|
||||
"Farewell.":{
|
||||
Italian:"Addio."
|
||||
}
|
||||
"A pleasure to meet you.":{}
|
||||
|
||||
// Overview screen
|
||||
"Overview":{
|
||||
|
@ -1,7 +1,9 @@
|
||||
package com.unciv.logic.civilization
|
||||
|
||||
import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.math.Vector2
|
||||
import com.unciv.UnCivGame
|
||||
import com.unciv.logic.GameInfo
|
||||
import com.unciv.logic.city.CityInfo
|
||||
import com.unciv.logic.civilization.diplomacy.DiplomacyManager
|
||||
@ -15,6 +17,7 @@ import com.unciv.logic.map.TileInfo
|
||||
import com.unciv.models.Counter
|
||||
import com.unciv.models.gamebasics.Difficulty
|
||||
import com.unciv.models.gamebasics.GameBasics
|
||||
import com.unciv.models.gamebasics.Nation
|
||||
import com.unciv.models.gamebasics.tech.TechEra
|
||||
import com.unciv.models.gamebasics.tile.ResourceType
|
||||
import com.unciv.models.gamebasics.tile.TileResource
|
||||
@ -98,6 +101,16 @@ class CivilizationInfo {
|
||||
}
|
||||
|
||||
fun getNation() = GameBasics.Nations[civName]!!
|
||||
fun getTranslatedNation(): Nation {
|
||||
val language = UnCivGame.Current.settings.language.replace(" ","_")
|
||||
if(!Gdx.files.internal("jsons/Nations_$language.json").exists()) return getNation()
|
||||
val translatedNation = GameBasics.getFromJson(Array<Nation>::class.java, "Nations_$language")
|
||||
.firstOrNull { it.name==civName}
|
||||
if(translatedNation==null) // this language's trnslation doesn't contain this nation yet,
|
||||
return getNation() // default to english
|
||||
return translatedNation
|
||||
}
|
||||
|
||||
fun getCapital()=cities.first { it.isCapital() }
|
||||
fun isPlayerCivilization() = playerType==PlayerType.Human
|
||||
fun isBarbarianCivilization() = gameInfo.getBarbarianCivilization()==this
|
||||
|
@ -6,6 +6,12 @@ import com.unciv.ui.utils.colorFromRGB
|
||||
|
||||
class Nation : INamed {
|
||||
override lateinit var name: String
|
||||
var translatedName=""
|
||||
fun getNameTranslation(): String {
|
||||
if(translatedName!="") return translatedName
|
||||
else return name
|
||||
}
|
||||
|
||||
lateinit var leaderName: String
|
||||
|
||||
lateinit var declaringWar:String
|
||||
|
@ -9,12 +9,6 @@ class Translations() : HashMap<String, HashMap<String, String>>(){
|
||||
constructor(json:String):this(){
|
||||
val jsonValue = JsonReader().parse(json)!!
|
||||
|
||||
// """
|
||||
// {
|
||||
// "a": {"k1":"v1",k2:"v2"},
|
||||
// b:{k3:"v3"}
|
||||
// }"""
|
||||
|
||||
var currentEntry = jsonValue.child
|
||||
while(currentEntry!=null){
|
||||
val entryMap = HashMap<String,String>()
|
||||
@ -27,13 +21,6 @@ class Translations() : HashMap<String, HashMap<String, String>>(){
|
||||
}
|
||||
currentEntry = currentEntry.next
|
||||
}
|
||||
//
|
||||
// val squareBraceRegex = Regex("\\[(.*?)\\]")
|
||||
// for (word in values)
|
||||
// for(translationLanguage in word.keys)
|
||||
// if(word[translationLanguage]!!.contains(squareBraceRegex))
|
||||
// word[translationLanguage] = word[translationLanguage]!!.replace(squareBraceRegex,"[]")
|
||||
|
||||
}
|
||||
|
||||
fun get(text:String,language:String): String {
|
||||
|
@ -38,7 +38,7 @@ class CivilopediaScreen : CameraStageBaseScreen() {
|
||||
|
||||
val map = LinkedHashMap<String, Collection<ICivilopedia>>()
|
||||
|
||||
val language = UnCivGame.Current.settings.language
|
||||
val language = UnCivGame.Current.settings.language.replace(" ","_")
|
||||
val basicHelpFileName = if(Gdx.files.internal("jsons/BasicHelp_$language.json").exists())"BasicHelp_$language"
|
||||
else "BasicHelp"
|
||||
|
||||
|
@ -15,7 +15,7 @@ class TradeTable(val otherCivilization: CivilizationInfo, stage: Stage, onTradeC
|
||||
var tradeLogic = TradeLogic(currentPlayerCiv,otherCivilization)
|
||||
var offerColumnsTable = OfferColumnsTable(tradeLogic, stage) { onChange() }
|
||||
var offerColumnsTableWrapper = Table() // This is so that after a trade has been traded, we can switch out the offers to start anew - this is the easiest way
|
||||
val tradeText = Label(otherCivilization.getNation().neutralLetsHearIt.random().tr(), CameraStageBaseScreen.skin)
|
||||
val tradeText = Label(otherCivilization.getTranslatedNation().neutralLetsHearIt.random().tr(), CameraStageBaseScreen.skin)
|
||||
val offerButton = TextButton("Offer trade".tr(), CameraStageBaseScreen.skin)
|
||||
|
||||
|
||||
@ -30,14 +30,14 @@ class TradeTable(val otherCivilization: CivilizationInfo, stage: Stage, onTradeC
|
||||
offerButton.onClick {
|
||||
if(offerButton.text.toString() == "Offer trade".tr()) {
|
||||
if(tradeLogic.currentTrade.theirOffers.size==0 && tradeLogic.currentTrade.ourOffers.size==0){
|
||||
tradeText.setText(otherCivilization.getNation().neutralLetsHearIt.random().tr())
|
||||
tradeText.setText(otherCivilization.getTranslatedNation().neutralLetsHearIt.random().tr())
|
||||
}
|
||||
else if (tradeLogic.isTradeAcceptable()){
|
||||
tradeText.setText(otherCivilization.getNation().neutralYes.random().tr())
|
||||
tradeText.setText(otherCivilization.getTranslatedNation().neutralYes.random().tr())
|
||||
offerButton.setText("Accept".tr())
|
||||
}
|
||||
else{
|
||||
tradeText.setText(otherCivilization.getNation().neutralNo.random().tr())
|
||||
tradeText.setText(otherCivilization.getTranslatedNation().neutralNo.random().tr())
|
||||
}
|
||||
}
|
||||
else if(offerButton.text.toString() == "Accept".tr()){
|
||||
@ -63,7 +63,7 @@ class TradeTable(val otherCivilization: CivilizationInfo, stage: Stage, onTradeC
|
||||
private fun onChange(){
|
||||
offerColumnsTable.update()
|
||||
offerButton.setText("Offer trade".tr())
|
||||
tradeText.setText(otherCivilization.getNation().neutralLetsHearIt.random().tr())
|
||||
tradeText.setText(otherCivilization.getTranslatedNation().neutralLetsHearIt.random().tr())
|
||||
}
|
||||
|
||||
}
|
@ -98,7 +98,7 @@ class WorldScreen : CameraStageBaseScreen() {
|
||||
}
|
||||
|
||||
// This is private so that we will set the shouldUpdate to true instead.
|
||||
// That way, not only do we save a lot of unneccesary updates, we also ensure that all updates are called from the main GL thread
|
||||
// That way, not only do we save a lot of unnecessary updates, we also ensure that all updates are called from the main GL thread
|
||||
// and we don't get any silly concurrency problems!
|
||||
private fun update() {
|
||||
// many of the display functions will be called with the game clone and not the actual game,
|
||||
@ -330,24 +330,25 @@ class DiplomaticIncidentPopup(val worldScreen: WorldScreen, val diplomaticIncide
|
||||
|
||||
init {
|
||||
val otherCiv = worldScreen.gameInfo.getCivilization(diplomaticIncident.civName)
|
||||
val otherCivLeaderName = otherCiv.getNation().leaderName+" of "+otherCiv.civName
|
||||
val translatedNation = otherCiv.getTranslatedNation()
|
||||
val otherCivLeaderName = "[${translatedNation.leaderName}] of [${translatedNation.getNameTranslation()}]".tr()
|
||||
add(otherCivLeaderName.toLabel())
|
||||
addSeparator()
|
||||
|
||||
when(diplomaticIncident.type){
|
||||
DiplomaticIncidentType.WarDeclaration -> {
|
||||
addGoodSizedLabel(otherCiv.getNation().declaringWar).row()
|
||||
addGoodSizedLabel(translatedNation.declaringWar).row()
|
||||
val responseTable = Table()
|
||||
responseTable.add(getCloseButton("You'll pay for this!"))
|
||||
responseTable.add(getCloseButton("Very well."))
|
||||
add(responseTable)
|
||||
}
|
||||
DiplomaticIncidentType.Defeated -> {
|
||||
addGoodSizedLabel(otherCiv.getNation().defeated).row()
|
||||
addGoodSizedLabel(translatedNation.defeated).row()
|
||||
add(getCloseButton("Farewell."))
|
||||
}
|
||||
DiplomaticIncidentType.FirstContact -> {
|
||||
addGoodSizedLabel(otherCiv.getNation().introduction).row()
|
||||
addGoodSizedLabel(translatedNation.introduction).row()
|
||||
add(getCloseButton("A pleasure to meet you."))
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user