mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-12 02:45:49 +02:00
refactor(wip): translation module #135
This commit is contained in:
parent
6ede443bbe
commit
8cc71942c8
11 changed files with 439 additions and 232 deletions
|
@ -5,6 +5,7 @@ import {ref, watch} from 'vue'
|
|||
|
||||
import {useSettingsStore} from '@/pinia'
|
||||
import {useRoute} from 'vue-router'
|
||||
import http from '@/lib/http'
|
||||
|
||||
const settings = useSettingsStore()
|
||||
|
||||
|
@ -13,7 +14,19 @@ const route = useRoute()
|
|||
const current = ref(gettext.current)
|
||||
|
||||
const languageAvailable = gettext.available
|
||||
|
||||
function init() {
|
||||
if (current.value !== 'en') {
|
||||
http.get('/translation/' + current.value).then(r => {
|
||||
gettext.translations[current.value] = r
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
init()
|
||||
|
||||
watch(current, (v) => {
|
||||
init()
|
||||
settings.set_language(v)
|
||||
gettext.current = v
|
||||
// @ts-ignored
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue