From bbe74854b4a8cdf4dafc91b39253931eab0c2597 Mon Sep 17 00:00:00 2001 From: SomeTroglodyte <63000004+SomeTroglodyte@users.noreply.github.com> Date: Mon, 6 Jun 2022 06:43:28 +0200 Subject: [PATCH] Fix current list of un-translatables (#7057) * Fix current list of un-translatables * Fix current list of un-translatables - revert tr() change and tweak map editor map parameter display --- .../jsons/translations/German.properties | 2 +- .../jsons/translations/template.properties | 1 + core/src/com/unciv/logic/map/MapParameters.kt | 18 ++++++++++-------- core/src/com/unciv/logic/map/TileInfo.kt | 4 ++-- .../unciv/models/translations/Translations.kt | 1 - .../com/unciv/ui/mapeditor/MapEditorViewTab.kt | 4 ++-- .../unciv/ui/multiplayer/MultiplayerHelpers.kt | 4 ++-- .../unciv/ui/multiplayer/MultiplayerScreen.kt | 2 +- .../unciv/ui/newgamescreen/MapOptionsTable.kt | 2 +- .../src/com/unciv/ui/saves/LoadOrSaveScreen.kt | 2 +- 10 files changed, 21 insertions(+), 19 deletions(-) diff --git a/android/assets/jsons/translations/German.properties b/android/assets/jsons/translations/German.properties index b93e339fe8..42a6634c74 100644 --- a/android/assets/jsons/translations/German.properties +++ b/android/assets/jsons/translations/German.properties @@ -4583,7 +4583,7 @@ Desert Folklore = Wüsten-Folklore Faith Healers = Glaubensheiler [mapUnitFilter] Units adjacent to this city heal [amount] HP per turn when healing = Während Heilen, erhalten [mapUnitFilter] Einheiten, die benachbart zu dieser Stadt sind, [amount] LP pro Runde -Fertility Rites = Fruchtbarkeitsraten +Fertility Rites = Fruchtbarkeitsriten God of Craftsman = Gott der Handwerker in cities with at least [amount] [populationFilter] = in Städten mit mindestens [amount] [populationFilter] diff --git a/android/assets/jsons/translations/template.properties b/android/assets/jsons/translations/template.properties index 618e8acfe1..0d24756f3e 100644 --- a/android/assets/jsons/translations/template.properties +++ b/android/assets/jsons/translations/template.properties @@ -572,6 +572,7 @@ You have to write a name for your friend! = You have to write an ID for your friend! = You cannot add your own player ID in your friend list! = To add a friend, ask him to send you his player ID.\nClick the 'Add friend' button.\nInsert his player ID and a name for him.\nThen click the 'Add friend' button again.\n\nAfter that you will see him in your friends list.\n\nA new button will appear when creating a new\nmultiplayer game, which allows you to select your friend. = +Please input Player ID! = Set current user = Player ID from clipboard = Player ID from friends list = diff --git a/core/src/com/unciv/logic/map/MapParameters.kt b/core/src/com/unciv/logic/map/MapParameters.kt index e3012318c5..e3a568f870 100644 --- a/core/src/com/unciv/logic/map/MapParameters.kt +++ b/core/src/com/unciv/logic/map/MapParameters.kt @@ -70,7 +70,7 @@ class MapSizeNew { this.radius = getEquivalentHexagonalRadius(width, height) } - fun clone() = MapSizeNew().also { + fun clone() = MapSizeNew().also { it.name = name it.radius = radius it.width = width @@ -236,14 +236,16 @@ class MapParameters { override fun toString() = sequence { if (name.isNotEmpty()) yield("\"$name\" ") yield("(") - if (mapSize.name != MapSize.custom) yield(mapSize.name + " ") - if (worldWrap) yield("{wrapped} ") - yield(shape) + if (mapSize.name != MapSize.custom) yield("{${mapSize.name}} ") + if (worldWrap) yield("{World Wrap} ") + yield("{$shape}") yield(" " + displayMapDimensions() + ")") - yield(mapResources) + if(mapResources != MapResources.default) yield(" {Resource Setting}: {$mapResources}") if (name.isEmpty()) return@sequence - yield("\n$type, {Seed} $seed") - yield(", {Map Height}=" + elevationExponent.niceToString(2)) + yield("\n") + if (type != MapType.custom && type != MapType.empty) yield("{Map Generation Type}: {$type}, ") + yield("{RNG Seed} $seed") + yield(", {Map Elevation}=" + elevationExponent.niceToString(2)) yield(", {Temperature extremeness}=" + temperatureExtremeness.niceToString(2)) yield(", {Resource richness}=" + resourceRichness.niceToString(3)) yield(", {Vegetation richness}=" + vegetationRichness.niceToString(2)) @@ -252,7 +254,7 @@ class MapParameters { yield(", {Biome areas extension}=$tilesPerBiomeArea") yield(", {Water level}=" + waterThreshold.niceToString(2)) }.joinToString("") - + fun numberOfTiles() = if (shape == MapShape.hexagonal) { 1 + 3 * mapSize.radius * (mapSize.radius - 1) diff --git a/core/src/com/unciv/logic/map/TileInfo.kt b/core/src/com/unciv/logic/map/TileInfo.kt index 249b6e859b..a2dcd585fd 100644 --- a/core/src/com/unciv/logic/map/TileInfo.kt +++ b/core/src/com/unciv/logic/map/TileInfo.kt @@ -578,8 +578,8 @@ open class TileInfo { /** Generates a sequence of reasons that prevent building given [improvement]. * If the sequence is empty, improvement can be built immediately. */ - fun getImprovementBuildingProblems(improvement: TileImprovement, civInfo: CivilizationInfo, failFast: Boolean = false): Sequence = sequence { - val stateForConditionals = StateForConditionals(civInfo, tile=this@TileInfo) + fun getImprovementBuildingProblems(improvement: TileImprovement, civInfo: CivilizationInfo): Sequence = sequence { + val stateForConditionals = StateForConditionals(civInfo, tile = this@TileInfo) if (improvement.uniqueTo != null && improvement.uniqueTo != civInfo.civName) yield(ImprovementBuildingProblem.WrongCiv) diff --git a/core/src/com/unciv/models/translations/Translations.kt b/core/src/com/unciv/models/translations/Translations.kt index 633cd0c5df..c22253dd19 100644 --- a/core/src/com/unciv/models/translations/Translations.kt +++ b/core/src/com/unciv/models/translations/Translations.kt @@ -485,4 +485,3 @@ fun String.removeConditionals(): String { .replace(" ", " ") .trim() } - diff --git a/core/src/com/unciv/ui/mapeditor/MapEditorViewTab.kt b/core/src/com/unciv/ui/mapeditor/MapEditorViewTab.kt index e7e2999e1b..116a7d56f8 100644 --- a/core/src/com/unciv/ui/mapeditor/MapEditorViewTab.kt +++ b/core/src/com/unciv/ui/mapeditor/MapEditorViewTab.kt @@ -79,7 +79,7 @@ class MapEditorViewTab( val area = tileMap.values.size val waterPercent = (tileMap.values.count { it.isWater } * 100f / area).toInt() val continents = tileMap.continentSizes.size - val statsText = "Area: [$area] tiles, $waterPercent% water, [$continents] continents/islands" + val statsText = "Area: [$area] tiles, [$waterPercent]% water, [$continents] continents/islands" val statsLabel = WrappableLabel(statsText, labelWidth) add(statsLabel.apply { wrap = true }).row() @@ -135,7 +135,7 @@ class MapEditorViewTab( addSeparator() add("Exit map editor".toTextButton().apply { onClick(editorScreen::closeEditor) }).row() - invalidateHierarchy() //todo - unsure this helps + invalidateHierarchy() //todo - unsure this helps validate() } diff --git a/core/src/com/unciv/ui/multiplayer/MultiplayerHelpers.kt b/core/src/com/unciv/ui/multiplayer/MultiplayerHelpers.kt index 24e07d8dba..68a53d111e 100644 --- a/core/src/com/unciv/ui/multiplayer/MultiplayerHelpers.kt +++ b/core/src/com/unciv/ui/multiplayer/MultiplayerHelpers.kt @@ -20,8 +20,8 @@ object MultiplayerHelpers { fun getLoadExceptionMessage(ex: Throwable) = when (ex) { is FileStorageRateLimitReached -> "Server limit reached! Please wait for [${ex.limitRemainingSeconds}] seconds" is FileNotFoundException -> "File could not be found on the multiplayer server" - is UncivShowableException -> ex.message!! // some of these seem to be translated already, but not all - else -> "Unhandled problem, [${ex::class.simpleName}] ${ex.message}" + is UncivShowableException -> ex.message // If this is already translated, it's an error on the throwing side! + else -> "Unhandled problem, [${ex::class.simpleName} ${ex.localizedMessage}]" } fun loadMultiplayerGame(screen: BaseScreen, selectedGame: OnlineMultiplayerGame) { diff --git a/core/src/com/unciv/ui/multiplayer/MultiplayerScreen.kt b/core/src/com/unciv/ui/multiplayer/MultiplayerScreen.kt index b909028f7f..c6c2743af9 100644 --- a/core/src/com/unciv/ui/multiplayer/MultiplayerScreen.kt +++ b/core/src/com/unciv/ui/multiplayer/MultiplayerScreen.kt @@ -34,7 +34,7 @@ class MultiplayerScreen(previousScreen: BaseScreen) : PickerScreen() { private val copyUserIdText = "Copy user ID" private val copyUserIdButton = createCopyUserIdButton() - private val friendsListText = "Friends List" + private val friendsListText = "Friends list" private val friendsListButton = createFriendsListButton() private val refreshText = "Refresh list" diff --git a/core/src/com/unciv/ui/newgamescreen/MapOptionsTable.kt b/core/src/com/unciv/ui/newgamescreen/MapOptionsTable.kt index 9b1a130d7c..6771ae2a05 100644 --- a/core/src/com/unciv/ui/newgamescreen/MapOptionsTable.kt +++ b/core/src/com/unciv/ui/newgamescreen/MapOptionsTable.kt @@ -97,7 +97,7 @@ class MapOptionsTable(private val newGameScreen: NewGameScreen): Table() { Popup(newGameScreen).apply { addGoodSizedLabel("Could not load map!").row() if (ex is UncivShowableException) - addGoodSizedLabel(ex.message!!).row() + addGoodSizedLabel(ex.message).row() addCloseButton() open() } diff --git a/core/src/com/unciv/ui/saves/LoadOrSaveScreen.kt b/core/src/com/unciv/ui/saves/LoadOrSaveScreen.kt index 5bf22a986f..96fe97cfc8 100644 --- a/core/src/com/unciv/ui/saves/LoadOrSaveScreen.kt +++ b/core/src/com/unciv/ui/saves/LoadOrSaveScreen.kt @@ -83,7 +83,7 @@ abstract class LoadOrSaveScreen( } catch (ex: Throwable) { "Failed to delete [$selectedSave]." } - descriptionLabel.setText(result) + descriptionLabel.setText(result.tr()) } private fun updateShownSaves(showAutosaves: Boolean) {