From dcf03794965cc29029e7783ee95cc56540c76ab5 Mon Sep 17 00:00:00 2001 From: arkon Date: Fri, 22 Dec 2023 09:22:30 -0500 Subject: [PATCH] Janky workaround for Moko escaped quotes issue Related: https://github.com/icerockdev/moko-resources/issues/337 --- core/src/main/java/tachiyomi/core/i18n/Localize.kt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/tachiyomi/core/i18n/Localize.kt b/core/src/main/java/tachiyomi/core/i18n/Localize.kt index 3c0c7e2169..d6f8f3c168 100644 --- a/core/src/main/java/tachiyomi/core/i18n/Localize.kt +++ b/core/src/main/java/tachiyomi/core/i18n/Localize.kt @@ -10,17 +10,21 @@ import dev.icerock.moko.resources.desc.ResourceFormatted import dev.icerock.moko.resources.desc.StringDesc fun Context.stringResource(resource: StringResource): String { - return StringDesc.Resource(resource).toString(this) + return StringDesc.Resource(resource).toString(this).fixed() } fun Context.stringResource(resource: StringResource, vararg args: Any): String { - return StringDesc.ResourceFormatted(resource, *args).toString(this) + return StringDesc.ResourceFormatted(resource, *args).toString(this).fixed() } fun Context.pluralStringResource(resource: PluralsResource, count: Int): String { - return StringDesc.Plural(resource, count).toString(this) + return StringDesc.Plural(resource, count).toString(this).fixed() } fun Context.pluralStringResource(resource: PluralsResource, count: Int, vararg args: Any): String { - return StringDesc.PluralFormatted(resource, count, *args).toString(this) + return StringDesc.PluralFormatted(resource, count, *args).toString(this).fixed() } + +// TODO: janky workaround for https://github.com/icerockdev/moko-resources/issues/337 +private fun String.fixed() = + this.replace("""\""", """"""")