File size: 578 Bytes
c742717
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a594adb
 
 
c742717
a594adb
 
c742717
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { computed } from 'vue'
import { viVN, enUS } from 'naive-ui'
import { useAppStore } from '@/store'
import { setLocale } from '@/locales'

export function useLanguage() {
  const appStore = useAppStore()

  const language = computed(() => {
    switch (appStore.language) {
    case 'vi-VN':
        setLocale('vi-VN')
        return viVN
      case 'en-US':
        setLocale('en-US')
        return enUS
      case 'ru-RU':
        setLocale('ru-RU')
        return ruRu
      default:
        setLocale('ru-RU')
        return ruRu
    }
  })

  return { language }
}