From 30e1dcbcddf1a069ec50194d4f327b5b6f6e5ffd Mon Sep 17 00:00:00 2001 From: OptimizedForDensity <105244635+OptimizedForDensity@users.noreply.github.com> Date: Tue, 2 Aug 2022 11:23:37 -0400 Subject: [PATCH] Fix broken translation (#7580) --- core/src/com/unciv/models/translations/Translations.kt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/core/src/com/unciv/models/translations/Translations.kt b/core/src/com/unciv/models/translations/Translations.kt index 86348cdf3a..2f2a2ad7d0 100644 --- a/core/src/com/unciv/models/translations/Translations.kt +++ b/core/src/com/unciv/models/translations/Translations.kt @@ -8,7 +8,6 @@ import com.unciv.models.stats.Stat import com.unciv.models.stats.Stats import com.unciv.utils.Log import com.unciv.utils.debug -import java.time.temporal.ChronoUnit import java.util.* /** @@ -391,15 +390,14 @@ fun String.tr(): String { // Take the terms in the message, WITHOUT square brackets val termsInMessage = this.getPlaceholderParametersIgnoringLowerLevelBraces() - // Take the term from the placeholder, INCLUDING the square brackets - val termsInTranslationPlaceholder = - squareBraceRegex.findAll(originalEntry).map { it.value }.toList() + // Take the terms from the placeholder + val termsInTranslationPlaceholder = originalEntry.getPlaceholderParametersIgnoringLowerLevelBraces() if (termsInMessage.size != termsInTranslationPlaceholder.size) throw Exception("Message $this has a different number of terms than the placeholder $translationEntry!") for (i in termsInMessage.indices) { languageSpecificPlaceholder = languageSpecificPlaceholder.replace( - termsInTranslationPlaceholder[i], + "[${termsInTranslationPlaceholder[i]}]", // re-add square brackets to placeholder terms termsInMessage[i].tr() ) }