Git Product home page Git Product logo

Comments (3)

amannn avatar amannn commented on August 30, 2024

Thanks for the question, this works as intended in fact.

/en-GB is really an unknown route if you configure a custom prefix like /uk and is treated the same way as e.g. /unknown. If you want to add additional redirects on top, you can compose the middleware accordingly.

from next-intl.

c-tuck avatar c-tuck commented on August 30, 2024

I understand that's the current behavior and I am currently working around it by checking the request url pathname to see if it begins with any of the locale codes mapping to custom prefixes and redirecting to its associated one if it does. I figured since all of that data is provided to next-intl it could handle that check internally.

It was an unexpected behavior given my use case. Would it make sense for this to be the default behavior if we supply a custom user-facing prefix?

from next-intl.

amannn avatar amannn commented on August 30, 2024

I figured since all of that data is provided to next-intl it could handle that check internally.

It would definitely be possible, that's correct.

I'm a bit hesitant to add it though because:

  1. I'd be worried if there could be false positives (even if not likely). By not including a redirect here, users can optionally add this if relevant.
  2. Including a redirect here would theoretically be a breaking change (also arguably not likely, but still).
  3. I'm unsure how often this would really be accessed by a user. If a redirecting locale prefix is nothing you link to on your website, I can only imagine a user typing in this manually.

Do you have other aspects to this in mind from your perspective?

from next-intl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.