add i18n to frontend, still incomplete, but a start
This commit is contained in:
@@ -1,6 +1,14 @@
|
||||
/* globals crypto, moment, Vue, axios, Quasar, _ */
|
||||
|
||||
Vue.use(VueI18n)
|
||||
|
||||
window.LOCALE = 'en'
|
||||
window.i18n = new VueI18n({
|
||||
locale: window.LOCALE,
|
||||
fallbackLocale: window.LOCALE,
|
||||
messages: window.localisation
|
||||
})
|
||||
|
||||
window.EventHub = new Vue()
|
||||
window.LNbits = {
|
||||
api: {
|
||||
@@ -320,6 +328,7 @@ window.LNbits = {
|
||||
}
|
||||
|
||||
window.windowMixin = {
|
||||
i18n: window.i18n,
|
||||
data: function () {
|
||||
return {
|
||||
g: {
|
||||
@@ -335,6 +344,10 @@ window.windowMixin = {
|
||||
},
|
||||
|
||||
methods: {
|
||||
changeLanguage: function (newValue) {
|
||||
window.i18n.locale = newValue
|
||||
this.$q.localStorage.set('lnbits.lang', newValue)
|
||||
},
|
||||
changeColor: function (newValue) {
|
||||
document.body.setAttribute('data-theme', newValue)
|
||||
this.$q.localStorage.set('lnbits.theme', newValue)
|
||||
@@ -364,6 +377,12 @@ window.windowMixin = {
|
||||
}
|
||||
this.g.allowedThemes = window.allowedThemes ?? ['bitcoin']
|
||||
|
||||
let locale = this.$q.localStorage.getItem('lnbits.lang')
|
||||
if (locale) {
|
||||
window.LOCALE = locale
|
||||
window.i18n.locale = locale
|
||||
}
|
||||
|
||||
addEventListener('offline', event => {
|
||||
this.g.offline = true
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user