Spaces:
Paused
Paused
Download src/hooks/useLanguage.ts from imseldrith/chatgpt-web: direct link, hf CLI and curl.
- Browser
- Download file 586 Bytes
-
https://huggingface.co/spaces/imseldrith/chatgpt-web/resolve/main/src/hooks/useLanguage.ts
- Command line
-
hf download hf://spaces/imseldrith/chatgpt-web/src/hooks/useLanguage.ts
-
curl -L -o useLanguage.ts https://huggingface.co/spaces/imseldrith/chatgpt-web/resolve/main/src/hooks/useLanguage.ts
586 Bytes
| import { computed } from 'vue' | |
| import { enUS, zhCN, zhTW } from 'naive-ui' | |
| import { useAppStore } from '@/store' | |
| import { setLocale } from '@/locales' | |
| export function useLanguage() { | |
| const appStore = useAppStore() | |
| const language = computed(() => { | |
| switch (appStore.language) { | |
| case 'en-US': | |
| setLocale('en-US') | |
| return enUS | |
| case 'zh-CN': | |
| setLocale('zh-CN') | |
| return zhCN | |
| case 'zh-TW': | |
| setLocale('zh-TW') | |
| return zhTW | |
| default: | |
| setLocale('zh-CN') | |
| return enUS | |
| } | |
| }) | |
| return { language } | |
| } | |