Resolved #8968 - stats for notifications string'd without special characters

This commit is contained in:
Yair Morgenstern
2023-03-20 00:41:58 +02:00
parent a37eb28964
commit 2d6a88f3e3
3 changed files with 12 additions and 3 deletions

View File

@ -1,6 +1,5 @@
package com.unciv.models.stats
import com.unciv.Constants
import com.unciv.models.translations.tr
import kotlin.reflect.KMutableProperty0
@ -152,7 +151,7 @@ open class Stats(
/** Since notifications are translated on the fly, when saving stats there we need to do so in English */
fun toStringForNotifications() = this.joinToString {
(if (it.value > 0) "+" else "") + it.value.toInt() + " " + it.key.toString().tr(Constants.english)
(if (it.value > 0) "+" else "") + it.value.toInt() + " " + it.key.toString()
}
// For display in diplomacy window

View File

@ -291,7 +291,8 @@ object TranslationActiveModsCache {
* defaults to the input string if no translation is available,
* but with placeholder or sentence brackets removed.
*/
fun String.tr(language:String = UncivGame.Current.settings.language): String {
fun String.tr(): String {
val language:String = UncivGame.Current.settings.language
if (contains('<') && contains('>')) { // Conditionals!
/**
* So conditionals can contain placeholders, such as <vs [unitFilter] units>, which themselves