File size: 773 Bytes
a9df3bb |
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 |
'use client'
import i18n from 'i18next'
import { initReactI18next } from 'react-i18next'
import commonEn from './lang/common.en'
import commonZh from './lang/common.zh'
import appEn from './lang/app.en'
import appZh from './lang/app.zh'
import { Locale } from '.'
const resources = {
'en': {
translation: {
common: commonEn,
app: appEn,
},
},
'zh-Hans': {
translation: {
common: commonZh,
app: appZh,
},
},
}
i18n.use(initReactI18next)
// init i18next
// for all options read: https://www.i18next.com/overview/configuration-options
.init({
lng: 'en',
fallbackLng: 'en',
// debug: true,
resources,
})
export const changeLanguage = (lan: Locale) => {
i18n.changeLanguage(lan)
}
export default i18n
|