Replies: 1 comment 2 replies
-
Hey! Yep, it's absolutely possible to use next-intl 4 without locale-based routing by following the App Router setup. No
Do you have any idea where that message comes from? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there,
I'm using Next.js 15 with next-intl 4.3.4 and Next-Auth, where I store user locales in the database and retrieve them via a custom getUserLocale() function instead of using URL-based locale routing.
My current setup:
next.config.js: Uses createNextIntlPlugin('./src/i18n/request.ts')
src/i18n/request.ts: Custom getRequestConfig() that calls getUserLocale() from the database/cookies
No middleware.ts: Since I don't use locale-based routing (no /en/ or /de/ in URLs)
No src/i18n/routing.ts: Missing this file entirely
This works perfectly in my local development environment, but in production I'm getting this error for some users:
The error appears to be related to regex patterns that next-intl generates internally, possibly due to missing routing configuration that next-intl 4.x expects.
Questions:
Is it possible to use next-intl 4.x without locale-based routing (no /en/, /de/ URL segments) and without middleware?
Do I need to create src/i18n/routing.ts even if I'm not using URL-based locale routing?
Could the missing middleware be causing next-intl to generate invalid regex patterns in production environments?
Is there a recommended way to handle database-stored user locales with next-intl 4.x without URL-based routing?
I suspect the issue might be that next-intl 4.x expects the new routing configuration even when not using URL-based locales, but I'd like to confirm the correct approach.
Beta Was this translation helpful? Give feedback.
All reactions