Merge version_4 into main

Merge version_4 into main
This commit was merged in pull request #10.
This commit is contained in:
2026-06-03 21:48:13 +00:00
2 changed files with 24 additions and 20 deletions

View File

@@ -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 });
// @ts-expect-error
export const config = {};

View File

@@ -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,
};
});
export default i18n;