Comments (3)
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.
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.
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:
- 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.
- Including a redirect here would theoretically be a breaking change (also arguably not likely, but still).
- 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)
- NextJS 15 support HOT 2
- Cannot retrieve Link's props from createLocalizedPathnamesNavigation HOT 1
- Middleware should gracefully handle unsupported but valid locale identifiers HOT 1
- Next.js - Navigation between pages in the pages router loses translations. HOT 2
- [Docs]: Typescript Validation HOT 1
- NextJS 15's `next/font` breaks alternate header injection. HOT 3
- Add Support for Setting HttpOnly and Secure Flags on NEXT_LOCALE Cookie HOT 4
- Localized search/query params HOT 1
- Using Link component with legacyBehavior+passHref producing warnings HOT 3
- getPathname with params HOT 6
- During build process static path are not translated to its reflection from pathnames mapping from config.ts file HOT 1
- Export Href type definition that works for getPathname, redirect & <Link /> params/props HOT 1
- Does not support Pages router with Next.js < 13 HOT 3
- Globally register error handling HOT 1
- return internal server error (500) on root page (work fine internal page) in production next build but work perfectly in development mode HOT 1
- useNow hook will use local time on subsequent renders HOT 1
- Unable to render rich text HOT 1
- Issue with Next.js 15 Canary / withPayload / .mts HOT 2
- Issue with Next.js 15 Canary / withPayload / .mts HOT 1
- formatter.dateTime is not a function HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from next-intl.