Skip to content

redirect does not respect as-needed locale prefix #1335

@jorgemoya

Description

@jorgemoya

Description

When using locale prefix as-needed, I would expect redirect to respect this configuration, instead it will append default locale. This is not how using Link behaves, so it is unexpected. For non default locales, I would expect for redirect to append locale prefix.

Verifications

  • I've verified that the problem I'm experiencing isn't covered in the docs.
  • I've searched for similar, existing issues on GitHub and Stack Overflow.
  • I've compared my app to a working example to look for differences.

Mandatory reproduction URL

https://next-intl-redirect-issue-of1rlux37-jorgemoyas-projects.vercel.app/

Reproduction description

Steps to reproduce:

  1. Open reproduction
  2. Click on Click to redirect
  3. Error: Notice how default locale is appended to url. Navigating with header links works as expected.

Expected behaviour

The expected behavior would be to respect the as-needed locale prefix configuration and for navigation within the default locale to ignore appending locale, much like using the Link component. For non default locales it would be fine to append locale prefix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions