From cc206494df1b4d3f058843fda7d204a01b82f89a Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Thu, 30 Apr 2020 15:57:08 +0300 Subject: [PATCH] 3.8.4-patch1 Fixed regexes broken for Android by #2538 --- build.gradle | 4 ++-- .../unciv/models/translations/Translations.kt | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/build.gradle b/build.gradle index 6e95660cc9..3f3def7696 100644 --- a/build.gradle +++ b/build.gradle @@ -33,8 +33,8 @@ allprojects { version = '1.0.1' ext { appName = "Unciv" - appCodeNumber = 421 - appVersion = "3.8.4" + appCodeNumber = 422 + appVersion = "3.8.4-patch1" gdxVersion = '1.9.10' roboVMVersion = '2.3.1' diff --git a/core/src/com/unciv/models/translations/Translations.kt b/core/src/com/unciv/models/translations/Translations.kt index 25031e24a5..92c2dbb640 100644 --- a/core/src/com/unciv/models/translations/Translations.kt +++ b/core/src/com/unciv/models/translations/Translations.kt @@ -143,17 +143,19 @@ class Translations : LinkedHashMap(){ } -// we don't need to allocate different memory for these every time we .tr() - or recompile them. +// We don't need to allocate different memory for these every time we .tr() - or recompile them. +// Please note: The extra \] and \} are NOT removable, despite what Android Studio might recommend - +// they are necessary for Android Java 6 phones to parse the regex properly! - // Expect a literal [ followed by a captured () group and a literal ]. - // The group may contain any number of any character except ] - pattern [^]] -val squareBraceRegex = Regex("""\[([^]]*)]""") +// Expect a literal [ followed by a captured () group and a literal ]. +// The group may contain any number of any character except ] - pattern [^]] +val squareBraceRegex = Regex("""\[([^]]*)\]""") - // Just look for either [ or ] -val eitherSquareBraceRegex = Regex("""\[|]""") +// Just look for either [ or ] +val eitherSquareBraceRegex = Regex("""\[|\]""") - // Analogous as above: Expect a {} pair with any chars but } in between and capture that -val curlyBraceRegex = Regex("""\{([^}]*)}""") +// Analogous as above: Expect a {} pair with any chars but } in between and capture that +val curlyBraceRegex = Regex("""\{([^}]*)\}""") fun String.tr(): String {