Skip to content

Commit

Permalink
ZH added
Browse files Browse the repository at this point in the history
  • Loading branch information
quatrochan committed Aug 4, 2023
1 parent cd4e515 commit 3740c5a
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 27 deletions.
38 changes: 19 additions & 19 deletions docs/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,25 @@ const isDev = process.env.NODE_ENV === 'development'
const { locale, t } = useI18n()
const notification = useNotification()
watch(locale, () => {
if (!['en'].includes(locale.value)) {
const myNotification = notification({
title: t('improve_translation_title'),
text: t('improve_translation_text'),
placement: 'bottom-right',
duration: 10000,
variants: {
$: {
root: 'max-w-lg',
},
},
variant: ['default', '$'],
})
// setTimeout(() => {
// myNotification()
// }, 3000)
}
})
// watch(locale, () => {
// if (!['en'].includes(locale.value)) {
// const myNotification = notification({
// title: t('improve_translation_title'),
// text: t('improve_translation_text'),
// placement: 'bottom-right',
// duration: 10000,
// variants: {
// $: {
// root: 'max-w-lg',
// },
// },
// variant: ['default', '$'],
// })
// // setTimeout(() => {
// // myNotification()
// // }, 3000)
// }
// })
const fps = isDev ? useFps() : 0
Expand Down
18 changes: 15 additions & 3 deletions docs/components/ItHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,11 @@
</template>
</it-toggle>
</div>
<it-select v-model="$i18n.locale" :options="availableLocales">
<it-select
:model-value="valueWithFallback"
@update:modelValue="$i18n.locale = $event"
:options="availableLocales"
>
<template #icon>
<svg
xmlns="http://www.w3.org/2000/svg"
Expand Down Expand Up @@ -193,12 +197,12 @@

<script setup lang="ts">
import { Emitter } from 'mitt'
import { inject, ref, watch } from 'vue'
import { computed, inject, ref, watch } from 'vue'
import { TEvents, TTheme } from '../types/Events'
import { useI18n } from 'vue-i18n'
const isDev = process.env.NODE_ENV === 'development'
const { availableLocales } = useI18n()
const { availableLocales, locale, fallbackLocale, fal } = useI18n()
const toggleThemeValue = ref<TTheme>('light')
const emitter = inject<Emitter<TEvents>>('emitter')
Expand All @@ -207,6 +211,14 @@ watch(toggleThemeValue, (value) => {
emitter?.emit('theme', value)
})
const valueWithFallback = computed(() => {
if (availableLocales.includes(locale.value)) {
return locale.value
}
console.log('1111!!!!!!!!!', fallbackLocale)
return fallbackLocale.value
})
const openSidebar = () => {
emitter?.emit('sidebar', true)
}
Expand Down
4 changes: 1 addition & 3 deletions docs/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,5 @@
"full": "contains classes for light and dark themes",
"light": "contains classes for light theme",
"dark": "contains classes for dark theme"
},
"improve_translation_title": "Help us improve translation",
"improve_translation_text": "Translation to this language was automatically translated from English to your language. \n You can help to improve it. Please follow to github to help with translation."
}
}
4 changes: 2 additions & 2 deletions docs/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"placeholder7": "按钮"
},
"introduction": "介绍",
"gettingstarted": "入门",
"getting_started": "入门",
"theming": "主题",
"contribution": "贡献",
"support": "支持",
Expand Down Expand Up @@ -145,4 +145,4 @@
},
"improvetranslationtitle": "帮助我们改进翻译",
"improvetranslation_text": "该语言的翻译是从英语自动翻译成您的语言的。\n 您可以帮助改进它。请转到GitHub帮助进行翻译。"
}
}

0 comments on commit 3740c5a

Please sign in to comment.