-
Notifications
You must be signed in to change notification settings - Fork 26.7k
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
context.locale on getStaticProps returns wrong locale when rewrites are used #18927
Comments
Any news on this one? |
Looks like the behavior is correct based on what you're explaining. You're rewriting |
@timneutkens This will result in a 404 - Page Not Found |
Hi, this has been updated in the latest canary of Next.js |
@ijjk what about custom paths for each locale? How can we achieve that? For example, I have the following page:
|
@delucca with the newly added module.exports = {
async rewrites() {
return [
// /en/key-results already maps to /en/key-results
{
source: '/pt-BR/resultados-chave',
destination: '/pt-BR/key-results',
locale: false
},
]
}
} |
Oh, great. But, that also works with subdomain locales? Also, I would need to solve the URL links in the application? Or NextJS would map to the given locale route? |
@ijjk quick question, what about client-side routing? I was able to make your example work while typing the |
I can confirm. The issue is fixed. Thanks! |
@delucca can you provide a repo with a minimal reproduction for the client-side routing not working as expected, sounds like this might need updating to handle this case there. |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Bug report
Describe the bug
A website with these urls:
All urls are served from the same page and SSG is used. Inspecting the context parameter on
getStaticProps
, gives us these results by url:/hello:
/de/hello and /es/hallo:
/ja/hello:
To Reproduce
Create /pages/[slug]/hello.js:
Activated the new i18n feature:
Add rewrites:
Expected behavior
context.locale should return the correct locale.
System information
Version of Next.js: 10.0.1
Additional context
This issues arrise when deployed to NOW. If I build it locally and run
npm run start
the context parameter has the correct locale.The text was updated successfully, but these errors were encountered: