Skip to content

i18n for not-found page #50518

Answered by devjiwonchoi
simpel asked this question in App Router
May 30, 2023 · 9 comments · 23 replies
Discussion options

You must be logged in to vote

When you set your [locale] folder, it means that the route catches only /something.
If you want to set the route as /en_GB/some/dir/that/does/not/exist,
you need to change your locale folder name as Catch-all Segments, which is [...locale].

Since the notFound() function renders within a route segment, your /en_GB/some/dir/that/does/not/exist is technically out of range of your [locale] folder, which is why the root not-found.tsx is being rendered.

In conclusion, change your [locale] folder name to [...locale].

UPDATE

@simpel @nikkizol Apologies for providing an inefficient answer.

I have to update the answer since setting the locale to catch all segments is not the best practice & experie…

Replies: 9 comments 23 replies

Comment options

You must be logged in to vote
10 replies
@simpel
Comment options

@devjiwonchoi
Comment options

Answer selected by simpel
@simpel
Comment options

@nikkizol
Comment options

@devjiwonchoi
Comment options

@nikkizol
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@foadtkf
Comment options

@MasteringBOX
Comment options

@foadtkf
Comment options

@PxlSyl
Comment options

Comment options

You must be logged in to vote
4 replies
@MasteringBOX
Comment options

@vrushank
Comment options

@GuillaumeCode17
Comment options

@Minf97
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@foadtkf
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@foadtkf
Comment options

@krckyboy
Comment options

@jbukuts
Comment options

@jbukuts
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment