aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl/treksoft/kvision/html
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/html')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/html/Image.kt2
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/html/List.kt5
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/html/Tag.kt8
3 files changed, 10 insertions, 5 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Image.kt b/src/main/kotlin/pl/treksoft/kvision/html/Image.kt
index 61733fb3..4d373270 100644
--- a/src/main/kotlin/pl/treksoft/kvision/html/Image.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/html/Image.kt
@@ -81,7 +81,7 @@ open class Image(
val pr = super.getSnAttrs().toMutableList()
pr.add("src" to src)
alt?.let {
- pr.add("alt" to it)
+ pr.add("alt" to translate(it))
}
return pr
}
diff --git a/src/main/kotlin/pl/treksoft/kvision/html/List.kt b/src/main/kotlin/pl/treksoft/kvision/html/List.kt
index 377b805f..5fb489da 100644
--- a/src/main/kotlin/pl/treksoft/kvision/html/List.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/html/List.kt
@@ -116,10 +116,11 @@ open class ListTag(
}
private fun element(name: String, value: String, rich: Boolean): VNode {
+ val translatedValue = translate(value)
return if (rich) {
- h(name, arrayOf(KVManager.virtualize("<span>$value</span>")))
+ h(name, arrayOf(KVManager.virtualize("<span>$translatedValue</span>")))
} else {
- h(name, value)
+ h(name, translatedValue)
}
}
diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Tag.kt b/src/main/kotlin/pl/treksoft/kvision/html/Tag.kt
index 75536b88..3a15a4d0 100644
--- a/src/main/kotlin/pl/treksoft/kvision/html/Tag.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/html/Tag.kt
@@ -135,10 +135,14 @@ open class Tag(
override fun render(): VNode {
return if (content != null) {
+ val translatedContent = content?.let { translate(it) }
if (rich) {
- render(type.tagName, arrayOf(KVManager.virtualize("<span>$content</span>")) + childrenVNodes())
+ render(
+ type.tagName,
+ arrayOf(KVManager.virtualize("<span>$translatedContent</span>")) + childrenVNodes()
+ )
} else {
- render(type.tagName, childrenVNodes() + arrayOf(content))
+ render(type.tagName, childrenVNodes() + arrayOf(translatedContent))
}
} else {
render(type.tagName, childrenVNodes())