Spaces:
Build error
Build error
File size: 1,772 Bytes
a8b3f00 |
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 42 43 44 45 46 47 48 49 |
'use client'
import i18n from 'i18next'
import { initReactI18next } from 'react-i18next'
import { LanguagesSupported } from '@/i18n/language'
const loadLangResources = (lang: string) => ({
translation: {
common: require(`./${lang}/common`).default,
layout: require(`./${lang}/layout`).default,
login: require(`./${lang}/login`).default,
register: require(`./${lang}/register`).default,
app: require(`./${lang}/app`).default,
appOverview: require(`./${lang}/app-overview`).default,
appDebug: require(`./${lang}/app-debug`).default,
appApi: require(`./${lang}/app-api`).default,
appLog: require(`./${lang}/app-log`).default,
appAnnotation: require(`./${lang}/app-annotation`).default,
share: require(`./${lang}/share-app`).default,
dataset: require(`./${lang}/dataset`).default,
datasetDocuments: require(`./${lang}/dataset-documents`).default,
datasetHitTesting: require(`./${lang}/dataset-hit-testing`).default,
datasetSettings: require(`./${lang}/dataset-settings`).default,
datasetCreation: require(`./${lang}/dataset-creation`).default,
explore: require(`./${lang}/explore`).default,
billing: require(`./${lang}/billing`).default,
custom: require(`./${lang}/custom`).default,
tools: require(`./${lang}/tools`).default,
workflow: require(`./${lang}/workflow`).default,
runLog: require(`./${lang}/run-log`).default,
},
})
// Automatically generate the resources object
const resources = LanguagesSupported.reduce((acc: any, lang: string) => {
acc[lang] = loadLangResources(lang)
return acc
}, {})
i18n.use(initReactI18next)
.init({
lng: undefined,
fallbackLng: 'en-US',
resources,
})
export const changeLanguage = i18n.changeLanguage
export default i18n
|