aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl/treksoft/kvision/KVManager.kt
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2018-08-21 16:07:28 +0200
committerRobert Jaros <rjaros@finn.pl>2018-08-21 16:07:28 +0200
commit63691ce4536cbff24330e6d268343e343ee806fa (patch)
treecfa9b6e8c3a594a7756034bfd403ceb9311c72d7 /src/main/kotlin/pl/treksoft/kvision/KVManager.kt
parent561a9d5fdc0f8be67703e8d594148cda5d74f754 (diff)
downloadkvision-63691ce4536cbff24330e6d268343e343ee806fa.tar.gz
kvision-63691ce4536cbff24330e6d268343e343ee806fa.tar.bz2
kvision-63691ce4536cbff24330e6d268343e343ee806fa.zip
Internationalization support for built-in components.
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/KVManager.kt')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/KVManager.kt113
1 files changed, 109 insertions, 4 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/KVManager.kt b/src/main/kotlin/pl/treksoft/kvision/KVManager.kt
index b762bc01..b0e9ea6f 100644
--- a/src/main/kotlin/pl/treksoft/kvision/KVManager.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/KVManager.kt
@@ -31,8 +31,11 @@ import com.github.snabbdom.propsModule
import com.github.snabbdom.styleModule
import org.w3c.dom.asList
import pl.treksoft.kvision.core.Component
+import pl.treksoft.kvision.i18n.I18n
import pl.treksoft.kvision.utils.isIE11
+import pl.treksoft.kvision.utils.obj
import kotlin.browser.document
+import kotlin.browser.window
import kotlin.dom.clear
/**
@@ -76,9 +79,6 @@ internal object KVManager {
}
private val bootstrapSelect = try {
require("bootstrap-select/dist/js/bootstrap-select.min.js")
- } catch (e: Throwable) {
- }
- private val bootstrapSelectI18n = try {
require("./js/bootstrap-select-i18n.min.js")
} catch (e: Throwable) {
}
@@ -88,6 +88,17 @@ internal object KVManager {
}
private val bootstrapSelectAjax = try {
require("ajax-bootstrap-select/dist/js/ajax-bootstrap-select.min.js")
+ require("../../js/js/locales/ajax-bootstrap-select/ajax-bootstrap-select.de-DE.min.js")
+ require("../../js/js/locales/ajax-bootstrap-select/ajax-bootstrap-select.es-ES.min.js")
+ require("../../js/js/locales/ajax-bootstrap-select/ajax-bootstrap-select.fr-FR.min.js")
+ require("../../js/js/locales/ajax-bootstrap-select/ajax-bootstrap-select.it-IT.min.js")
+ require("../../js/js/locales/ajax-bootstrap-select/ajax-bootstrap-select.ja-JP.min.js")
+ require("../../js/js/locales/ajax-bootstrap-select/ajax-bootstrap-select.ko-KR.min.js")
+ require("../../js/js/locales/ajax-bootstrap-select/ajax-bootstrap-select.nl-NL.min.js")
+ require("../../js/js/locales/ajax-bootstrap-select/ajax-bootstrap-select.pl-PL.min.js")
+ require("../../js/js/locales/ajax-bootstrap-select/ajax-bootstrap-select.pt-BR.min.js")
+ require("../../js/js/locales/ajax-bootstrap-select/ajax-bootstrap-select.ru-RU.min.js")
+ require("../../js/js/locales/ajax-bootstrap-select/ajax-bootstrap-select.tr-TR.min.js")
} catch (e: Throwable) {
}
private val trixCss = try {
@@ -95,7 +106,26 @@ internal object KVManager {
} catch (e: Throwable) {
}
private val trix = try {
- require("trix")
+ val trix = require("trix")
+ window.asDynamic().Trix = trix
+ trix.config.languages = obj {}
+ trix.config.languages["en"] = obj {}
+ for (key in js("Object").keys(trix.config.lang)) {
+ trix.config.languages["en"][key] = trix.config.lang[key]
+ }
+ val orig = trix.config.toolbar.getDefaultHTML
+ trix.config.toolbar.getDefaultHTML = {
+ val config = if (trix.config.languages[I18n.language] != undefined) {
+ trix.config.languages[I18n.language]
+ } else {
+ trix.config.languages["en"]
+ }
+ for (key in js("Object").keys(trix.config.lang)) {
+ trix.config.lang[key] = config[key]
+ }
+ orig()
+ }
+ require("../../js/js/locales/trix/trix.pl.js")
} catch (e: Throwable) {
}
private val bootstrapDateTimePickerCss = try {
@@ -104,6 +134,45 @@ internal object KVManager {
}
private val bootstrapDateTimePicker = try {
require("bootstrap-datetime-picker/js/bootstrap-datetimepicker.min.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.ar.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.az.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.bg.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.bn.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.ca.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.cs.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.da.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.de.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.ee.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.el.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.es.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.fi.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.fr.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.he.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.hr.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.hu.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.hy.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.id.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.is.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.it.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.ja.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.ko.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.lt.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.lv.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.nl.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.no.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.pl.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.pt.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.ro.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.rs.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.ru.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.sk.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.sl.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.sv.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.th.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.tr.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.ua.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.uk.js")
+ require("../../js/js/locales/bootstrap-datetime-picker/bootstrap-datetimepicker.zh.js")
} catch (e: Throwable) {
}
private val bootstrapTouchspinCss = try {
@@ -128,6 +197,42 @@ internal object KVManager {
}
private val bootstrapFileinput = try {
require("bootstrap-fileinput")
+ require("../../js/js/locales/bootstrap-fileinput/ar.js")
+ require("../../js/js/locales/bootstrap-fileinput/az.js")
+ require("../../js/js/locales/bootstrap-fileinput/bg.js")
+ require("../../js/js/locales/bootstrap-fileinput/ca.js")
+ require("../../js/js/locales/bootstrap-fileinput/cr.js")
+ require("../../js/js/locales/bootstrap-fileinput/cs.js")
+ require("../../js/js/locales/bootstrap-fileinput/da.js")
+ require("../../js/js/locales/bootstrap-fileinput/de.js")
+ require("../../js/js/locales/bootstrap-fileinput/el.js")
+ require("../../js/js/locales/bootstrap-fileinput/es.js")
+ require("../../js/js/locales/bootstrap-fileinput/et.js")
+ require("../../js/js/locales/bootstrap-fileinput/fa.js")
+ require("../../js/js/locales/bootstrap-fileinput/fi.js")
+ require("../../js/js/locales/bootstrap-fileinput/fr.js")
+ require("../../js/js/locales/bootstrap-fileinput/gl.js")
+ require("../../js/js/locales/bootstrap-fileinput/id.js")
+ require("../../js/js/locales/bootstrap-fileinput/it.js")
+ require("../../js/js/locales/bootstrap-fileinput/ja.js")
+ require("../../js/js/locales/bootstrap-fileinput/ka.js")
+ require("../../js/js/locales/bootstrap-fileinput/ko.js")
+ require("../../js/js/locales/bootstrap-fileinput/kz.js")
+ require("../../js/js/locales/bootstrap-fileinput/lt.js")
+ require("../../js/js/locales/bootstrap-fileinput/nl.js")
+ require("../../js/js/locales/bootstrap-fileinput/no.js")
+ require("../../js/js/locales/bootstrap-fileinput/pl.js")
+ require("../../js/js/locales/bootstrap-fileinput/pt.js")
+ require("../../js/js/locales/bootstrap-fileinput/ro.js")
+ require("../../js/js/locales/bootstrap-fileinput/ru.js")
+ require("../../js/js/locales/bootstrap-fileinput/sk.js")
+ require("../../js/js/locales/bootstrap-fileinput/sl.js")
+ require("../../js/js/locales/bootstrap-fileinput/sv.js")
+ require("../../js/js/locales/bootstrap-fileinput/th.js")
+ require("../../js/js/locales/bootstrap-fileinput/tr.js")
+ require("../../js/js/locales/bootstrap-fileinput/uk.js")
+ require("../../js/js/locales/bootstrap-fileinput/vi.js")
+ require("../../js/js/locales/bootstrap-fileinput/zh.js")
} catch (e: Throwable) {
}
private val bootstrapFileinputFa = try {