mirror of
https://github.com/langgenius/webapp-conversation.git
synced 2025-12-26 18:26:38 +08:00
feat: init
This commit is contained in:
38
i18n/i18next-config.ts
Normal file
38
i18n/i18next-config.ts
Normal file
@ -0,0 +1,38 @@
|
||||
'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
|
||||
Reference in New Issue
Block a user