When using redirectToDefaultLang and getting redirected from logging in on Auth0 back to my page I get the following error:
Error: No router instance found. you should only use "next/router" inside the client side of your app. https://err.sh/zeit/next.js/no-router-instance
on this line: router.replace(/es/${router.query.path.join('/')}) in [...path.js]
Maybe it would work when using getInitialProps here with something like:
if (isServer) {
appContext.ctx.res.writeHead(302, {
Location: `/es/${router.query.path.join('/')}`,
})
appContext.ctx.res.end()
} else {
appContext.router.push(`/es/${router.query.path.join('/')}`)
}
I guess that is the same issue reported on https://github.com/vinissimus/next-translate/issues/150. This will be fixed on 0.16.0. Can you confirm that in0.16.0-canary.5 is working fine?
By the way, redirectToDefaultLang in >0.16.0 will be deprecated (but with backwards compatibility) https://github.com/vinissimus/next-translate/pull/162. Is recommended to change to defaultLangRedirect (after 0.16.0).
redirectToDefaultLang=true -> Same as defaultLangRedirect='lang-path'redirectToDefaultLang=false -> Same as defaultLangRedirect=undefined (default one)defaultLangRedirect='root' -> /en/example redirects to /exampleI'll try to release 0.16.0 this week. If you can confirm that it is working fine what you reported here would be very useful! Thanks.
@aralroca okay, I used "defaultLangRedirect":"lang-path" and this fixed the problem.
Good job :)
Cool! I'm going to release 0.16.0 soon! I need time to update the docs. I hope tomorrow! I'm going to close this issue then!
No, worries I am just going to use the canary version for now
@aralroca I just noticed, that on the canary some of my translations do not get included. I think there is a problem with the regex pattern.
mmmm... Is it not loading the full namespace, or only some translations of this namespace?
We have tests covering the part of loading the correct namespace from regex...
Can you tell more details? I would like to reproduce it in order to fix it before 0.16.0 lands.