Hello All,
I am new to this community and thank you for your support and time.
I am working on a bilingual site (English and Japanese). I am using next-intl package to set the locale. I am trying to implement the following use cases
- Set the default language to user browser language
- Set the default language from EN -> JPA
Tech Stack : Next Js 14, Typescript
I tried changing the language, but its not setting the default languge.
Reference Link - https://next-intl-docs.vercel.app/examples
Thank You
Udhya
Top comments (2)
This should already work out of the box.
Next.js will usually automatically detect the locale using the
Accept-Language
header which is sent by the client. If you're using a browser, this is usually identical to thenavigator.languages
values.Can you show us what your i18n middleware looks like?
export default async function middleware(request: any) {
const [, locale, ...segments] = request.nextUrl.pathname.split("/")
const handleI18nRouting = createIntlMiddleware({
defaultLocale: 'ja',
locales,
localePrefix
// localeDetection: false,
})