mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 02:15:48 +02:00
refactor: project directory structure
This commit is contained in:
parent
c1193a5b8c
commit
e5a5889931
367 changed files with 710 additions and 756 deletions
50
app/src/components/SetLanguage/SetLanguage.vue
Normal file
50
app/src/components/SetLanguage/SetLanguage.vue
Normal file
|
@ -0,0 +1,50 @@
|
|||
<script setup lang="ts">
|
||||
import gettext from '@/gettext'
|
||||
|
||||
import {ref, watch} from 'vue'
|
||||
|
||||
import {useSettingsStore} from '@/pinia'
|
||||
import {useRoute} from 'vue-router'
|
||||
import http from '@/lib/http'
|
||||
|
||||
const settings = useSettingsStore()
|
||||
|
||||
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
|
||||
document.title = route.name() + ' | Nginx UI'
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<a-select v-model:value="current" size="small" style="width: 60px">
|
||||
<a-select-option v-for="(language, key) in languageAvailable" :value="key" :key="key">
|
||||
{{ language }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
</style>
|
Loading…
Add table
Add a link
Reference in a new issue