next-right-now
next-right-now copied to clipboard
Migrate NRN I18n routing implementation to native Next.js I18n
Goal
Update the current NRN implementation of I18n routing to the new official Next.js 10 I18n routing.
The update will provide more ways of configuring the i18n routing. Currently, NRN only handles the sub-path
routing strategy. See https://nextjs.org/docs/advanced-features/i18n-routing#sub-path-routing
Status
Awaiting below issues to be fixed before starting working on this.
Issues
Currently, the Next.js i18n routing implementation doesn't generate a prefix url for the default locale.
- e.g: if
en
is the default locale then the path will be/
instead of/en
See https://nextjs.org/docs/advanced-features/i18n-routing#sub-path-routing
This is a breaking changes for apps created through NRN. I'll await a fix for this before starting working on it.
To do
- Remove or adapt our
I18nLink
component, because it's now handled by theLink
component - Remove
href
- See https://nextjs.org/blog/next-10#automatic-resolving-of-href - Handle
hreflang
- See https://support.google.com/webmasters/answer/189077
Reference
- https://nextjs.org/docs/advanced-features/i18n-routing
Hi @Vadorequest
After upgrade to next 10x I get wrong lang attribute on html tag without any advanced changes in codebase.
This is because now next automatically resolve html lang attribute
So your code https://github.com/UnlyEd/next-right-now/blob/e6f625820726d24967b4b14a5f32c93266fac3c9/src/pages/_document.tsx#L90
now not working at all.
I open page in locale 'ru' but get <html lang="en">
Why next turn on this feature without the user including himself i18n config?
I'm shocked.
Hm..
Seems 10.0.1-canary.7
fixes this.
will need to test
Thanks for letting me know, I hadn't noticed this!
And yes, Next shouldn't enable this when you haven't opt-in for their i18n routing feature. I'm glad you found a workaround. There are other bugs in the 10.0.0 release and the canary branch is a fine workaround for now. It'll probably be patched in the 10.0.1 like many other things.
FYI I won't change the current implementation until Next adds support for proper redirection to default locale prefix.
The default locale does not have a prefix.
The current behavior is a breaking change and cannot be configured at this time. Many people are asking for it but so far nothing.
This issue hasn't been addressed by Next.js yet, despite having more than 70 upvotes.
https://github.com/vercel/next.js/discussions/18419
I suggest you upvote the official Next.js discussion if you wish to see this happen.
Any new updates on this one?
Still not fixed on nextjs
On Tue, Mar 2, 2021, 20:45 Samuel Castro [email protected] wrote:
Any new updates on this one?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/UnlyEd/next-right-now/issues/194#issuecomment-789166382, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA5BRYR7VD5PRFZYESIZVI3TBU54VANCNFSM4TGM2UOQ .