Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic optional catch-all segments not working #917

Closed
itsberkelium opened this issue Mar 6, 2024 · 2 comments · Fixed by #925
Closed

Dynamic optional catch-all segments not working #917

itsberkelium opened this issue Mar 6, 2024 · 2 comments · Fixed by #925
Labels
bug Something isn't working

Comments

@itsberkelium
Copy link

itsberkelium commented Mar 6, 2024

Description

I have folders such as /items/[[...slug]]/page.tsx.

I also have the route added to navigation.ts as

"/items/[...slug]": {
    tr: "/ilanlar/[...slug]",
    en: "/items/[...slug]",
  },

However, when I visit /tr/ilanlar, the app shows a 404 page while /tr/ilanlar/test, /en/items/test, and /en/items renders perfectly.

I also tried the following with no luck.

"/items/[[...slug]]": {
    tr: "/ilanlar/[[...slug]]",
    en: "/items/[[...slug]]",
  },

Mandatory reproduction URL

https://codesandbox.io/p/github/itsberkelium/next-intl-bug-repro-app-router/main

Reproduction description

Steps to reproduce:

  1. Open reproduction
  2. Go to /en/items url
  3. Should work fine
  4. Go to /tr/ilanlar url
  5. See error: 404

Expected behaviour

It should render without slug for both locales.

@itsberkelium itsberkelium added bug Something isn't working unconfirmed Needs triage. labels Mar 6, 2024
@amannn
Copy link
Owner

amannn commented Mar 6, 2024

True, I think there's a bug.

This:

  "/items/[[...slug]]": {
    tr: "/ilanlar/[[...slug]]",
    en: "/items/[[...slug]]",
  },

… should match when /tr/ilanlar is called.

I need to investigate, thanks for the report!

@amannn amannn removed the unconfirmed Needs triage. label Mar 6, 2024
@michalpuchmertl
Copy link

+1, I can confirm this bug occurs in my project as well. Thank you for investigating the problem.

amannn added a commit that referenced this issue Mar 7, 2024
…g localized pathnames (#925)

Fixes #917

This works correctly now:

```
  "/items/[[...slug]]": {
    tr: "/ilanlar/[[...slug]]",
    en: "/items/[[...slug]]",
  },
```

… should match when `/tr/ilanlar` is called.
juanforlizzi pushed a commit to juanforlizzi/next-intl that referenced this issue Jan 16, 2025
…g localized pathnames (amannn#925)

Fixes amannn#917

This works correctly now:

```
  "/items/[[...slug]]": {
    tr: "/ilanlar/[[...slug]]",
    en: "/items/[[...slug]]",
  },
```

… should match when `/tr/ilanlar` is called.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants