import { createI18n } from 'vue-i18n'
import { useAppStore } from '@/store/useAppStore.js'

import enUS from './lang/en-US.js'
import zhCN from './lang/zh-CN.js'
import jaJP from './lang/ja-JP.js'
import indIND from "./lang/ind-IND/"

const messages = {
	'en': enUS,
	'zh': zhCN,
	'ja': jaJP,
	'ind': indIND
}

const i18n = createI18n({
	locale: uni.getStorageSync('LANGUAGE_STORE_KEY') || process.env.APP_LOCALE || 'en',
	legacy: false,
	globalInjection: true,
	messages: messages
})

export const setupLocales = (app) => {
	app.use(i18n)
}

export default i18n
