fix: :bug: Fix auto-detection for lang #559
Tim Izzo tim@octree.ch
Tue, 17 Dec 2024 11:23:48 +0100
3 files changed,
7 insertions(+),
6 deletions(-)
M
backend/.env.example
→
backend/.env.example
@@ -37,4 +37,5 @@ STRIPE_ENDPOINT_SECRET=
# Other configs -SENTRY_DSN=+SENTRY_DSN= +MAGICLINK_SECRET=
M
frontend/middleware.ts
→
frontend/middleware.ts
@@ -26,12 +26,11 @@ getBrowserPreferredSupportedLanguage(req) ||
FALLBACK_LANGUAGE; if (req.nextUrl.locale !== locale) { - return NextResponse.redirect( - new URL( - `/${locale}${req.nextUrl.pathname}${req.nextUrl.search || ''}`, - req.url - ) + const url = new URL( + `/${locale}${req.nextUrl.pathname}${req.nextUrl.search || ''}`, + req.url ); + return NextResponse.redirect(url); } }
M
frontend/next-i18next.config.js
→
frontend/next-i18next.config.js
@@ -6,6 +6,7 @@ module.exports = {
i18n: { defaultLocale: FALLBACK_LANGUAGE, locales: [...new Set([FALLBACK_LANGUAGE, 'en', 'fr', 'de', 'nl', 'it'])], + localeDetection: false, }, // Load same lang file for every namespaces localePath: (locale, _namespace) => `./locales/${locale}.json`,