dify/web/i18n/i18next-config.ts

161 lines
5.5 KiB
TypeScript
Raw Normal View History

2023-05-15 08:51:32 +08:00
'use client'
import i18n from 'i18next'
import { initReactI18next } from 'react-i18next'
import commonEn from './lang/common.en'
import commonZh from './lang/common.zh'
2024-01-23 21:14:53 +08:00
import commonPt from './lang/common.pt' // Portuguese import
2023-05-15 08:51:32 +08:00
import loginEn from './lang/login.en'
import loginZh from './lang/login.zh'
2024-01-23 21:14:53 +08:00
import loginPt from './lang/login.pt' // Portuguese import
2023-05-15 08:51:32 +08:00
import registerEn from './lang/register.en'
import registerZh from './lang/register.zh'
2024-01-23 21:14:53 +08:00
import registerPt from './lang/register.pt' // Portuguese import
2023-05-15 08:51:32 +08:00
import layoutEn from './lang/layout.en'
import layoutZh from './lang/layout.zh'
2024-01-23 21:14:53 +08:00
import layoutPt from './lang/layout.pt' // Portuguese import
2023-05-15 08:51:32 +08:00
import appEn from './lang/app.en'
import appZh from './lang/app.zh'
2024-01-23 21:14:53 +08:00
import appPt from './lang/app.pt' // Portuguese import
2023-05-15 08:51:32 +08:00
import appOverviewEn from './lang/app-overview.en'
import appOverviewZh from './lang/app-overview.zh'
2024-01-23 21:14:53 +08:00
import appOverviewPt from './lang/app-overview.pt' // Portuguese import
2023-05-15 08:51:32 +08:00
import appDebugEn from './lang/app-debug.en'
import appDebugZh from './lang/app-debug.zh'
2024-01-23 21:14:53 +08:00
import appDebugPt from './lang/app-debug.pt' // Portuguese import
2023-05-15 08:51:32 +08:00
import appApiEn from './lang/app-api.en'
import appApiZh from './lang/app-api.zh'
2024-01-23 21:14:53 +08:00
import appApiPt from './lang/app-api.pt' // Portuguese import
2023-05-15 08:51:32 +08:00
import appLogEn from './lang/app-log.en'
import appLogZh from './lang/app-log.zh'
2024-01-23 21:14:53 +08:00
import appLogPt from './lang/app-log.pt' // Portuguese import
import appAnnotationEn from './lang/app-annotation.en'
import appAnnotationZh from './lang/app-annotation.zh'
2024-01-23 21:14:53 +08:00
import appAnnotationPt from './lang/app-annotation.pt' // Portuguese import
2023-05-15 08:51:32 +08:00
import shareEn from './lang/share-app.en'
import shareZh from './lang/share-app.zh'
2024-01-23 21:14:53 +08:00
import sharePt from './lang/share-app.pt' // Portuguese import
2023-05-15 08:51:32 +08:00
import datasetEn from './lang/dataset.en'
import datasetZh from './lang/dataset.zh'
2024-01-23 21:14:53 +08:00
import datasetPt from './lang/dataset.pt' // Portuguese import
2023-05-15 08:51:32 +08:00
import datasetDocumentsEn from './lang/dataset-documents.en'
import datasetDocumentsZh from './lang/dataset-documents.zh'
2024-01-23 21:14:53 +08:00
import datasetDocumentsPt from './lang/dataset-documents.pt' // Portuguese import
2023-05-15 08:51:32 +08:00
import datasetHitTestingEn from './lang/dataset-hit-testing.en'
import datasetHitTestingZh from './lang/dataset-hit-testing.zh'
2024-01-23 21:14:53 +08:00
import datasetHitTestingPt from './lang/dataset-hit-testing.pt' // Portuguese import
2023-05-15 08:51:32 +08:00
import datasetSettingsEn from './lang/dataset-settings.en'
import datasetSettingsZh from './lang/dataset-settings.zh'
2024-01-23 21:14:53 +08:00
import datasetSettingsPt from './lang/dataset-settings.pt' // Portuguese import
2023-05-15 08:51:32 +08:00
import datasetCreationEn from './lang/dataset-creation.en'
import datasetCreationZh from './lang/dataset-creation.zh'
2024-01-23 21:14:53 +08:00
import datasetCreationPt from './lang/dataset-creation.pt' // Portuguese import
2023-05-25 16:59:47 +08:00
import exploreEn from './lang/explore.en'
import exploreZh from './lang/explore.zh'
2024-01-23 21:14:53 +08:00
import explorePt from './lang/explore.pt' // Portuguese import
import billingEn from './lang/billing.en'
import billingZh from './lang/billing.zh'
2024-01-23 21:14:53 +08:00
import billingPt from './lang/billing.pt' // Portuguese import
2023-12-18 16:25:37 +08:00
import customEn from './lang/custom.en'
import customZh from './lang/custom.zh'
2024-01-23 21:14:53 +08:00
import customPt from './lang/custom.pt' // Portuguese import
import toolsEn from './lang/tools.en'
import toolsZh from './lang/tools.zh'
2024-01-23 21:14:53 +08:00
import toolsPt from './lang/tools.pt' // Portuguese import
2023-05-15 08:51:32 +08:00
const resources = {
2024-01-23 21:14:53 +08:00
'en-US': {
2023-05-15 08:51:32 +08:00
translation: {
common: commonEn,
layout: layoutEn, // page layout
login: loginEn,
register: registerEn,
// app
app: appEn,
appOverview: appOverviewEn,
appDebug: appDebugEn,
appApi: appApiEn,
appLog: appLogEn,
appAnnotation: appAnnotationEn,
2023-05-15 08:51:32 +08:00
// share
share: shareEn,
dataset: datasetEn,
datasetDocuments: datasetDocumentsEn,
datasetHitTesting: datasetHitTestingEn,
datasetSettings: datasetSettingsEn,
datasetCreation: datasetCreationEn,
2023-05-25 16:59:47 +08:00
explore: exploreEn,
// billing
billing: billingEn,
2023-12-18 16:25:37 +08:00
custom: customEn,
// tools
tools: toolsEn,
2023-05-15 08:51:32 +08:00
},
},
'zh-Hans': {
translation: {
common: commonZh,
layout: layoutZh,
login: loginZh,
register: registerZh,
// app
app: appZh,
appOverview: appOverviewZh,
appDebug: appDebugZh,
appApi: appApiZh,
appLog: appLogZh,
appAnnotation: appAnnotationZh,
2023-05-15 08:51:32 +08:00
// share
share: shareZh,
dataset: datasetZh,
datasetDocuments: datasetDocumentsZh,
datasetHitTesting: datasetHitTestingZh,
datasetSettings: datasetSettingsZh,
datasetCreation: datasetCreationZh,
2023-05-25 16:59:47 +08:00
explore: exploreZh,
billing: billingZh,
2023-12-18 16:25:37 +08:00
custom: customZh,
// tools
tools: toolsZh,
2023-05-15 08:51:32 +08:00
},
},
2024-01-23 21:14:53 +08:00
'pt-BR': {
translation: {
common: commonPt,
layout: layoutPt,
login: loginPt,
register: registerPt,
// app
app: appPt,
appOverview: appOverviewPt,
appDebug: appDebugPt,
appApi: appApiPt,
appLog: appLogPt,
appAnnotation: appAnnotationPt,
// share
share: sharePt,
dataset: datasetPt,
datasetDocuments: datasetDocumentsPt,
datasetHitTesting: datasetHitTestingPt,
datasetSettings: datasetSettingsPt,
datasetCreation: datasetCreationPt,
explore: explorePt,
billing: billingPt,
custom: customPt,
tools: toolsPt,
},
},
2023-05-15 08:51:32 +08:00
}
i18n.use(initReactI18next)
// init i18next
// for all options read: https://www.i18next.com/overview/configuration-options
.init({
2023-10-18 16:00:56 +08:00
lng: undefined,
2024-01-23 21:14:53 +08:00
fallbackLng: 'en-US',
2023-05-15 08:51:32 +08:00
// debug: true,
resources,
})
export const changeLanguage = i18n.changeLanguage
export default i18n