-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
index.ts
41 lines (35 loc) · 1.05 KB
/
index.ts
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
29
30
31
32
33
34
35
36
37
38
39
40
41
import { createHuntersofbook, loadDateFNSLocale } from 'huntersofbook'
import type { App } from 'vue'
import { createI18n } from 'vue-i18n'
import en from '../locales/en.json'
import tr from '../locales/tr.json'
import { useLocaleStoreWithOut } from '../stores/modules/locale'
import { localeMap } from './config'
async function createI18nOptions() {
const localeStore = useLocaleStoreWithOut()
const locale = localeStore.getLocale
return {
locale,
// legacy: false,
fallbackLocale: localeMap.tr, // set fallback locale
messages: {
tr,
en
},
globalInjection: true,
silentTranslationWarn: true, // true - warning off
missingWarn: false,
silentFallbackWarn: true
}
}
const options = await createI18nOptions()
const defaultLocal = await loadDateFNSLocale(options.locale)
export const i18n = createI18n(options)
// setup i18n instance with global
export function setupI18n(app: App) {
const huntersofbook = createHuntersofbook({
dateFnsLanguage: defaultLocal
})
app.use(i18n)
app.use(huntersofbook)
}