diff --git a/src/config.ts b/src/config.ts index e72049f..9a5b424 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,8 +1,2 @@ -// @ts-ignore -import { createSharedPathnamesNavigation } from 'next-intl/navigation'; - -export const locales = ['en', 'de'] as const; -export const localePrefix = 'always'; // Default - -export const { Link, redirect, usePathname, useRouter } = - createSharedPathnamesNavigation({ locales, localePrefix }); \ No newline at end of file +// @ts-expect-error +export const config = {}; \ No newline at end of file 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