-
-
Notifications
You must be signed in to change notification settings - Fork 232
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
localePrefix doesn't support "es-US" prefixed locale #1329
Comments
Thanks for the report! I can confirm the issue and have found that this is caused by the overlapping This is definitely a bug, we need to support matching more specific prefixes in case there's an overlap. I'll look into this, should hopefully have a fix this week! |
Hmm, I had a first shot at this in #1343, but it seems like there's still a piece missing. Having a second look, can't be much … |
Ok, it's fixed now in |
Thanks @amannn 👌🏽 |
Description
While implementing the prefixes for
[locale]
segment, I've found that thees-US
locale (and probably other unsupported ISO 639-1 standard language codes locales, thoes-US
is widely used) can't be prefixed. Therouting
object with supportedlocales
andprefixes
specified aslocalePrefix
will respond with 404 in the middleware setup. Other defined locales in the config will be fine, they will be prefixed and server will respond with 200 HTTP code, except fores-US
. It seems like it is replaced with the nearest ISO standard lang code resolved for the build environment. In this case, the response'sNEXT_LOCALE
cookie header will resolve toes-US
->en-US
, which is wrong, I should be able to prefix all locales specified in mynext-intl
config. I believecreateIntlMiddleware(routing)
needs to be patched.Verifications
Mandatory reproduction URL
https://github.com/karolkarolka/next-intl-es-us-prefix-bug
Reproduction description
Steps to reproduce:
/us/es
GET /us/es 404
Expected behaviour
Expected behaviour:
es-US
locale should be prefixed with/us/es
.locale
ingetRequestConfig(async ({ locale })
should bees-US
. The path/es/us
should resolve to/
home directory.Actual behaviour:
es-US
locale cannot be prefixed properly.locale
ingetRequestConfig(async ({ locale })
isen-US
. The path/es/us
resolves to 404 not found.The text was updated successfully, but these errors were encountered: