diff --git a/src/i18n.ts b/src/i18n.ts index 3e79a38..140d92c 100644 --- a/src/i18n.ts +++ b/src/i18n.ts @@ -1,14 +1,24 @@ -import { notFound } from 'next/navigation'; -// @ts-ignore -import { getRequestConfig } from 'next-intl'; +import i18n from 'i18next'; +// @ts-expect-error +import Backend from 'i18next-http-backend'; +import LanguageDetector from 'i18next-browser-languagedetector'; +import { initReactI18next } from 'react-i18next'; -// Can be imported from a shared config -const locales = ['en', 'de']; +i18n + .use(Backend) + .use(LanguageDetector) + .use(initReactI18next) + .init({ + fallbackLng: 'en', + debug: false, + interpolation: { + escapeValue: false, + }, + backend: { + loadPath: '/locales/{{lng}}/{{ns}}.json', + }, + ns: ['common', 'home'], + defaultNS: 'common', + }); -export default getRequestConfig(async ({ locale }) => { - if (!locales.includes(locale as any)) notFound(); - - return { - messages: (await import(`../messages/${locale}.json`)).default, - }; -}); \ No newline at end of file +export default i18n; \ No newline at end of file