-
Note Some solution with route group below in the section (see EDIT) Hello, I have some routes using localization patterns while some other doesn't.
Currently in
How can I proceed to set my default html lang in the root layout Currently my // Since we have a root `not-found.tsx` page, a layout file
// is required, even if it's just passing children through.
export default function RootLayout({ children }: { children: React.ReactNode }) {
return children;
} and my not found is "use client";
import Error from "next/error";
export default function NotFound() {
return (
<html lang="en">
<body>
<Error statusCode={404} />
</body>
</html>
);
} Do I need to add like this on all my pages? not part of the lang layout? Thanks EDITI've managed to better organize, which seems to be solving my problem. I've created a route group ![]() Also updated my import { AvailableLocales } from "i18n/locales";
import createMiddleware from "next-intl/middleware";
export default createMiddleware({
locales: AvailableLocales,
defaultLocale: AvailableLocales[0], // As `localeDetection` is it will try guess the locale from the incoming request, this is the last fallback
localeDetection: true,
});
export const config = {
// Match only internationalized pathnames, this cannot be used with code so anytime a locale is used, the locale must be hardcoded here
- matcher: ["/", `/(en|fr)/:path*`],
+ matcher: [`/(en|fr)/:path*`],
}; |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
That's an interesting solution with the route group, thanks for sharing it here! |
Beta Was this translation helpful? Give feedback.
That's an interesting solution with the route group, thanks for sharing it here!