-
Notifications
You must be signed in to change notification settings - Fork 469
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
feat: API for handling locale change during page transitions #963
feat: API for handling locale change during page transitions #963
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not the prettiest solution but I don't know better (better would probably require some changes in Nuxt).
So I'm fine with it for now.
Very interesting solution. @pmrotule Is there a way to let i18n-module call the |
@MartinMa
The problem is, By the way, sorry about the delay, I should find time in the next few days to wrap up this PR. |
@rchl I finally addressed your feedback and updated the documentation. I tried to add e2e tests, but it wasn't working for me locally. Let me know how you think we should move on with this fix. |
Looking forward to this PR |
@pmrotule Thank you very much. Looks well thought out and well documented. |
81b768b
to
cc45e66
Compare
Useful if you want to wait for the page transition to enter before setting the locale
cc45e66
to
3f12610
Compare
@rchl Any feedback? I just rebased again. Should be good to go. |
I will have a look as soon as possible (hopefully this evening). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some small changes and comments.
Great work! Thanks. |
7.3 not working |
Closes #150
The issue is happening since
nuxt-i18n
is setting the locale fromonNavigate
being called in a middleware which won't wait for the page transition to fade out. Unfortunately, this cannot be fully solved from this module since it is not possible to set a globalpageTransition.beforeEnter
while making sure it won't be overwritten from atransition.beforeEnter
defined in a page component.That being said, the new option
skipSettingLocaleOnNavigate
would allow us to workaround the issue. If it istrue
, the locale will not be set on navigate which would let us setting it ourselves from abeforeEnter
transition hook:I'll wait for your feedback before adding test and documentation. I hope it makes sense.