all repos — caroster @ 10a07970b5248d04d0fd9b35ef06d24997a0c928

[Octree] Group carpool to your event https://caroster.io

fix: :bug: Fix auto-detection for lang

#559
Tim Izzo tim@octree.ch
Tue, 17 Dec 2024 11:23:48 +0100
commit

10a07970b5248d04d0fd9b35ef06d24997a0c928

parent

e5ab2b72830ceac154edfa35c7106a508edebebc

3 files changed, 7 insertions(+), 6 deletions(-)

jump to
M backend/.env.examplebackend/.env.example

@@ -37,4 +37,5 @@ STRIPE_ENDPOINT_SECRET=

# Other configs -SENTRY_DSN=+SENTRY_DSN= +MAGICLINK_SECRET=
M frontend/middleware.tsfrontend/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.jsfrontend/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`,