Skip to content
Discussion options

You must be logged in to vote

Based on their docs, I imagine that something like this could work:

import createIntlMiddleware from 'next-intl/middleware';
import {NextRequest} from 'next/server';
 
export default async function middleware(req: NextRequest) {
  const handleI18nRouting = createIntlMiddleware({
    locales: ['en', 'de'],
    defaultLocale: 'en'
  });
  const res = handleI18nRouting(request);
 
  const supabase = createMiddlewareClient({ req, res })
  await supabase.auth.getSession()
 
  return response;
}
 
export const config = {
  matcher: ['/((?!_next|.*\\..*).*)']
};

I'll convert this to a discussion since this is a usage question.

Replies: 3 comments 7 replies

Comment options

You must be logged in to vote
2 replies
@adrena11n
Comment options

@bronz3beard
Comment options

Answer selected by diffTed
Comment options

You must be logged in to vote
2 replies
@tmountain
Comment options

@onurusluca
Comment options

Comment options

You must be logged in to vote
3 replies
@thereis
Comment options

@davidlintin
Comment options

@Alban-i
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
enhancement New feature or request unconfirmed Needs triage.
9 participants
Converted from issue

This discussion was converted from issue #421 on July 24, 2023 13:21.