summaryrefslogtreecommitdiff
path: root/src/main/kotlin/tech/thatgravyboat/rewardclaim/RewardLanguage.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/tech/thatgravyboat/rewardclaim/RewardLanguage.kt')
-rw-r--r--src/main/kotlin/tech/thatgravyboat/rewardclaim/RewardLanguage.kt8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/main/kotlin/tech/thatgravyboat/rewardclaim/RewardLanguage.kt b/src/main/kotlin/tech/thatgravyboat/rewardclaim/RewardLanguage.kt
index 6361bc5..8a9ab36 100644
--- a/src/main/kotlin/tech/thatgravyboat/rewardclaim/RewardLanguage.kt
+++ b/src/main/kotlin/tech/thatgravyboat/rewardclaim/RewardLanguage.kt
@@ -1,8 +1,6 @@
package tech.thatgravyboat.rewardclaim
-import java.util.regex.Pattern
-
-private val TRANSLATION_LINE_REGEX = Pattern.compile("\"(?<key>.*)\": ?\"(?<text>.*)\",?")
+private val TRANSLATION_LINE_REGEX = Regex("\"(?<key>.*)\": ?\"(?<text>.*)\",?")
class RewardLanguage(translationDataFromHtml: String) {
@@ -13,8 +11,8 @@ class RewardLanguage(translationDataFromHtml: String) {
//We have to do it this way as this is easier than fixing all the things that isn't
//valid in normal json but is valid in javascript objects. Such as escaped single quotes and trailing commas.
init {
- TRANSLATION_LINE_REGEX.matcher(translationDataFromHtml.replace("\\'", "'")).apply {
- while (find()) translations[group("key")] = group("text")
+ TRANSLATION_LINE_REGEX.findAll(translationDataFromHtml.replace("\\'", "'")).apply {
+ this.forEach { translations[it.groups["key"]!!.value] = it.groups["text"]!!.value }
}
}
} \ No newline at end of file