I'm trying to use the experimental i18n feature (#17078) and it seems like next/link does not handle cross-locale links correctly.
Repository: next.js-bug-link-locale
Steps to reproduce the behavior:
Visiting http://localhost:3000/de-de/42 without errors


N/A
We changed the behavior a bit from the RFC as it turned out that linking around using just the path has issues. You can use <Link href="/42" locale="de-de">
Thanks for explaining @timneutkens. This solution doesn't sound good to me because I receive full slugs from a CMS including locale in the path already, like /de-de/hello/world, so the RFC becomes less attractive 馃槖
Will discuss with the team and see what we can do for this use case 馃檹
Would you mind sharing a bit more info on the issues that came up? My solution just prepends the locale automatically, but there are no underlying changes made in Next in my case. Autoprepending has been very convenient though so I'd love to see this.
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.
Yes, one case would be when you have a page that has the same name as a locale.
Another case would be with dynamic routes, say you have a ./pages/index.js and ./pages/[var].js, what should /de link to? Or say you have optional catch all ./pages/[[...path]].js, what will the path parameter be? Will it contain 'de' as the first element?
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?
Yes, that works for me. Thank you. Will the same behavior be performed using { locale: false } in next/router options?
@rokinsky yeah locale is available already in the options object you can pass in router.push and router.replace 馃憤
Most helpful comment
@rokinsky yeah
localeis available already in the options object you can pass inrouter.pushandrouter.replace馃憤