Replies: 1 comment 1 reply
-
Yep, that's correct! Maybe you could dynamically configure the middleware to pick up the user locale while hiding it from the pathname that is displayed to the user: import createIntlMiddleware from 'next-intl/middleware';
import {NextRequest} from 'next/server';
import {getUserLocale} from './utils';
export default async function middleware(request: NextRequest) {
const userLocale = getUserLocale(request) || 'en';
const handleI18nRouting = createIntlMiddleware({
locales: ['en', 'de'],
defaultLocale: userLocale,
localeDetection: false,
localePrefix: 'never'
});
return handleI18nRouting(request);
}
// ...
(cross-posted this answer to #778 (comment)) |
Beta Was this translation helpful? Give feedback.
1 reply
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.
-
From what I understand, this library heavily relies on routing to handle locale, by using the
[locale]
directory. Instead, I'd like to set my locale based on my user settings, which are fetched on app load in my root layoutIt is possible to do so ? I tried several things, including passing down directly the locale value to both the
NextIntlClientProvider
and the html tag, but it doesn't workBeta Was this translation helpful? Give feedback.
All reactions