Răsfoiți Sursa

fix: document.tile is not translated

0xJacky 1 an în urmă
părinte
comite
002d9c22ab

+ 2 - 0
app/src/components/CodeEditor/CodeEditor.vue

@@ -7,6 +7,7 @@ import { computed } from 'vue'
 const props = defineProps<{
   content?: string
   defaultHeight?: string
+  readonly?: boolean
 }>()
 
 const emit = defineEmits(['update:content'])
@@ -30,6 +31,7 @@ const value = computed({
       minHeight: defaultHeight || '100vh',
       borderRadius: '5px',
     }"
+    :readonly="readonly"
   />
 </template>
 

+ 5 - 2
app/src/components/SetLanguage/SetLanguage.vue

@@ -13,11 +13,14 @@ const current = ref(gettext.current)
 
 const languageAvailable = gettext.available
 
-function init() {
+async function init() {
   if (current.value !== 'en') {
-    http.get(`/translation/${current.value}`).then(r => {
+    await http.get(`/translation/${current.value}`).then(r => {
       gettext.translations[current.value] = r
     })
+
+    // @ts-expect-error name type
+    document.title = `${route.name?.()} | Nginx UI`
   }
 }
 

+ 1 - 2
app/src/gettext.ts

@@ -8,5 +8,4 @@ export default createGettext({
   silent: true,
 })
 
-export class useGettext {
-}
+export class useGettext {}

+ 1 - 1
app/src/routes/index.ts

@@ -15,7 +15,7 @@ import {
 } from '@ant-design/icons-vue'
 import NProgress from 'nprogress'
 
-import gettext from '../gettext'
+import gettext from '@/gettext'
 import { useUserStore } from '@/pinia'
 
 import 'nprogress/nprogress.css'