Locale Sub-routing doesn't work
See original GitHub issueHi,
I’ve got this configuration on my next js with next-translate:
Inside next.config.js
const nextTranslate = require('next-translate');
module.exports = nextTranslate({
webpack: (config, { isServer, webpack }) => {
return config;
},
target: 'serverless'
});
And inside i18n.json
{
"locales": [
"en",
"gr"
],
"defaultLocale": "gr",
"pages": {
"*": [
"common"
],
"/": [
"home"
],
"/about": [
"about"
]
}
}
The problem I’m facing is when switching the locale to en
all blog posts are broken e.g
http://localhost:3000/blog/test <- Works
http://localhost:3000/en/blog/test <- 404 not found
Any ideas what I should do to make the sub-routing work correctly?
Thanks
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Locale Sub-routing doesn't work · Issue #627 - GitHub
Hi, I've got this configuration on my next js with next-translate: Inside next.config.js const nextTranslate = require('next-translate'); ...
Read more >Next.js router locale issue - Stack Overflow
When routing using localized routes, you need to specify the locale by including additional options in the router.push call.
Read more >Advanced Features: Internationalized Routing - Next.js
Next.js has built-in support for internationalized routing and language ... There are two locale handling strategies: Sub-path Routing and Domain Routing.
Read more >RouterOutlet - Angular
A router outlet emits an activate event when a new component is instantiated, deactivate event when a component is destroyed. An attached event...
Read more >Routing (Symfony Docs)
Sub -Domain Routing; Localized Routes (i18n); Stateless Routes ... The routing configuration defines which action to run for each incoming URL.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@ykyp You need to add the locales to the getStaticPaths:
and your function:
This is not handled by next-translate and is a Next.js requirement.
Thanks a lot @aralroca confirming this has now fixed my issue 🙏