mirror of
https://github.com/Suwayomi/TachideskJUI.git
synced 2025-12-21 03:52:32 +01:00
Handle newlines better in the strings.xml
This commit is contained in:
@@ -49,15 +49,17 @@ class XmlResourceBundle internal constructor(internal val lookup: ConcurrentHash
|
|||||||
return XmlResourceBundle(ConcurrentHashMap(lookup + other.lookup))
|
return XmlResourceBundle(ConcurrentHashMap(lookup + other.lookup))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun String.replaceAndroid() = replace("\\n", "%n")
|
||||||
|
|
||||||
fun getStringA(key: String): String {
|
fun getStringA(key: String): String {
|
||||||
return Formatter().format(getString(key))
|
return Formatter().format(getString(key).replaceAndroid())
|
||||||
.let { formatter ->
|
.let { formatter ->
|
||||||
formatter.toString().also { formatter.close() }
|
formatter.toString().also { formatter.close() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getString(key: String, vararg replacements: Any?): String {
|
fun getString(key: String, vararg replacements: Any?): String {
|
||||||
return Formatter().format(getString(key), *replacements)
|
return Formatter().format(getString(key).replaceAndroid(), *replacements)
|
||||||
.let { formatter ->
|
.let { formatter ->
|
||||||
formatter.toString().also { formatter.close() }
|
formatter.toString().also { formatter.close() }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user