diff options
author | Robert Jaros <rjaros@finn.pl> | 2018-08-19 23:10:23 +0200 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2018-08-19 23:10:23 +0200 |
commit | 561a9d5fdc0f8be67703e8d594148cda5d74f754 (patch) | |
tree | 2976ae179a14487943c68102ceeebd7cbb73f7ae /src/main/kotlin/pl/treksoft/kvision/html | |
parent | e5a97e0d4eb4edd0767dc568b688454c8a090c70 (diff) | |
download | kvision-561a9d5fdc0f8be67703e8d594148cda5d74f754.tar.gz kvision-561a9d5fdc0f8be67703e8d594148cda5d74f754.tar.bz2 kvision-561a9d5fdc0f8be67703e8d594148cda5d74f754.zip |
Internationalization support.
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/html')
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/html/Image.kt | 2 | ||||
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/html/List.kt | 5 | ||||
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/html/Tag.kt | 8 |
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()) |