[9.5.6-canary.9][i18n] next/link does not handle cross-locale links correctly
See original GitHub issueBug report
Describe the bug
I’m trying to use the experimental i18n feature (#17078) and it seems like next/link
does not handle cross-locale links correctly.
To Reproduce
Repository: next.js-bug-link-locale Steps to reproduce the behavior:
- Go to http://localhost:3000/nl-nl/42
- Click on ‘TO /de-de/42’ link
- See 404 error and URL http://localhost:3000/nl-nl/de-de/42
Expected behavior
Visiting http://localhost:3000/de-de/42 without errors
Screenshots
System information
- OS: macOS
- Browser (if applies): chrome
- Version of Next.js: 9.5.6-canary.9
- Version of Node.js: 10.22.1
Additional context
N/A
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Nextlink Internet Support Center | 24/7 Access | FAQs
Nextlink Internet Support provides helpful FAQ, real-time network status updates, and access to our customer support teams via chat and web ticket.
Read more ><Link> does not work as expected in NextJS - Stack Overflow
Wrap NextLink around an a tag; Add href property on both; Add passHref property on NextLink to avoid 2 a tags rendering in...
Read more >Dealing with links in Next.js - LogRocket Blog
One of those goodies is that it handles routing for you. ... it won't just replace imports from next/link to gatsby/link .
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@rokinsky yeah
locale
is available already in the options object you can pass inrouter.push
androuter.replace
👍We’re currently discussing adding
<Link locale={false}>
for the case @rokinsky is showing. So you’d have to<Link locale={false} href="/de-de/hello/world">
and we won’t do automatic locale prepending. Would that work for you?@ljosberinn say you have a locale set up like
de
and apages/de.js
, you would not be able to link topages/de.js
given that the locale would be matched. There’s a few more cases @Janpot showed, maybe he can post them here. It’s a similar issue tobasePath
basically.