commit d239655f04aa1e9a005ceebe88625c65c81fa902 parent f9f7042c1e20d8eacbe7733cd1181c86b7d38c25 Author: rhunk <101876869+rhunk@users.noreply.github.com> Date: Thu, 9 May 2024 21:13:09 +0200 fix(core): material resources hook Diffstat:
M | core/src/main/kotlin/me/rhunk/snapenhance/core/SnapEnhance.kt | | | 9 | ++------- |
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/SnapEnhance.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/SnapEnhance.kt @@ -326,13 +326,8 @@ class SnapEnhance { Resources::class.java.getMethod("getString", Int::class.javaPrimitiveType).hook(HookStage.BEFORE) { param -> val key = param.arg<Int>(0) - val name = stringResources[key] ?: return@hook - // FIXME: prevent blank string in translations - if (name == "date_range_input_title") { - param.setResult("") - return@hook - } - param.setResult(appContext.translation.getOrNull("material3_strings.$name") ?: return@hook) + val name = stringResources[key]?.replaceFirst("m3c_", "") ?: return@hook + param.setResult(appContext.translation.getOrNull("material3_strings.${name}") ?: "") } } } \ No newline at end of file