question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[9.5.6-canary.9][i18n] next/link does not handle cross-locale links correctly

See original GitHub issue

Bug 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:

  1. Go to http://localhost:3000/nl-nl/42
  2. Click on ‘TO /de-de/42’ link
  3. 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

Screenshot 2020-10-21 at 14 44 22 Screenshot 2020-10-21 at 14 47 43

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:closed
  • Created 3 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
timneutkenscommented, Oct 21, 2020

@rokinsky yeah locale is available already in the options object you can pass in router.push and router.replace 👍

2reactions
timneutkenscommented, Oct 21, 2020

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 a pages/de.js, you would not be able to link to pages/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 to basePath basically.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found