From 52dc1931cc6ae53800f6bee39ec3c425bf0c4cfd Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Sun, 28 Oct 2018 15:58:46 +0200 Subject: [PATCH] =?UTF-8?q?Wonder=20uniques=20now=20displayed=20in=20citie?= =?UTF-8?q?s=20(thanks=20Kum=C4=81rik=C4=81=20B=C4=81l=C4=81=20for=20point?= =?UTF-8?q?ing=20out=20the=20problem!)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/unciv/models/gamebasics/Building.kt | 2 +- .../unciv/ui/utils/CameraStageBaseScreen.kt | 5 +++-- .../WorldScreenDisplayOptionsTable.kt | 18 ++++++++++-------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/core/src/com/unciv/models/gamebasics/Building.kt b/core/src/com/unciv/models/gamebasics/Building.kt index b8f355c693..139c5f6996 100644 --- a/core/src/com/unciv/models/gamebasics/Building.kt +++ b/core/src/com/unciv/models/gamebasics/Building.kt @@ -111,7 +111,7 @@ class Building : NamedStats(), IConstruction{ stringBuilder.appendln("Requires a $requiredBuildingInAllCities to be built in all cities") if (providesFreeBuilding != null) stringBuilder.appendln("Provides a free $providesFreeBuilding in this city") - if(uniques.isNotEmpty()) stringBuilder.appendln(uniques.map { it.tr() }.joinToString { "\n" }) + if(uniques.isNotEmpty()) stringBuilder.appendln(uniques.asSequence().map { it.tr() }.joinToString("\n")) if (stats.toString() != "") stringBuilder.appendln(stats) if (this.percentStatBonus != null) { diff --git a/core/src/com/unciv/ui/utils/CameraStageBaseScreen.kt b/core/src/com/unciv/ui/utils/CameraStageBaseScreen.kt index a37ff2ce22..ccedaa7cb9 100644 --- a/core/src/com/unciv/ui/utils/CameraStageBaseScreen.kt +++ b/core/src/com/unciv/ui/utils/CameraStageBaseScreen.kt @@ -146,9 +146,10 @@ fun String.tr(): String { return languageSpecificPlaceholder.tr() } if(contains("{")){ // sentence - return Regex("\\{(.*?)\\}").replace(this,{matchResult -> matchResult.groups[1]!!.value.tr() }) + return Regex("\\{(.*?)\\}").replace(this) { it.groups[1]!!.value.tr() } } - else return GameBasics.Translations.get(this,UnCivGame.Current.settings.language) // single word + val translation = GameBasics.Translations.get(this,UnCivGame.Current.settings.language) // single word + return translation } diff --git a/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenDisplayOptionsTable.kt b/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenDisplayOptionsTable.kt index bb53ac4b49..482c5a090d 100644 --- a/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenDisplayOptionsTable.kt +++ b/core/src/com/unciv/ui/worldscreen/optionstable/WorldScreenDisplayOptionsTable.kt @@ -57,14 +57,16 @@ class WorldScreenDisplayOptionsTable() : PopupTable(){ } }) - add(Label("Missing translations:",CameraStageBaseScreen.skin)).pad(5f).row() - val missingTextSelectBox = SelectBox(CameraStageBaseScreen.skin) - val missingTextArray = com.badlogic.gdx.utils.Array() - val currentLanguage = UnCivGame.Current.settings.language - GameBasics.Translations.filter { !it.value.containsKey(currentLanguage) }.forEach{missingTextArray.add(it.key)} - missingTextSelectBox.items = missingTextArray - missingTextSelectBox.selected="Untranslated texts" - add(missingTextSelectBox).pad(10f).width(UnCivGame.Current.worldScreen.stage.width/2).row() + if(languageSelectBox.selected.percentComplete!=100) { + add(Label("Missing translations:", CameraStageBaseScreen.skin)).pad(5f).row() + val missingTextSelectBox = SelectBox(CameraStageBaseScreen.skin) + val missingTextArray = com.badlogic.gdx.utils.Array() + val currentLanguage = UnCivGame.Current.settings.language + GameBasics.Translations.filter { !it.value.containsKey(currentLanguage) }.forEach { missingTextArray.add(it.key) } + missingTextSelectBox.items = missingTextArray + missingTextSelectBox.selected = "Untranslated texts" + add(missingTextSelectBox).pad(10f).width(UnCivGame.Current.worldScreen.stage.width / 2).row() + } val resolutionSelectBox= SelectBox(CameraStageBaseScreen.skin) val resolutionArray = com.badlogic.gdx.utils.Array()