-
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
Page transition broken with nuxt-i18n #150
Comments
@thariddler could you provide a gif of the issue? That is the routing? (from > to) |
Any news on this? I'm suffering the same, and can't understand how to solve it. |
The transition is copy-pasted from the original issue description. @thariddler I guess this is the behaviour you were talking about? For me the following workaround does the job: // utils/page-transition.js
function stripLocale (name) {
const routeNameSeperator = '__' // or whatever you set it to
return name.substring(0, name.indexOf(routeNameSeperator))
}
export default function pageTransition (from, to) {
const pageTransitionName = 'my-page-transition'
if (!from || !to || !from.name || !to.name) return pageTransitionName
return stripLocale(from.name) === stripLocale(to.name) ? '' : pageTransitionName
}
// pages/index.vue
import pageTransition from '~/utils/page-transition'
export default {
transition: pageTransition
} However this disables page transitions when switching the language instead of replacing the translated content smoothly while fading back in. |
@lu40 thanks, but returning transition name should not be empty export default function pageTransition (from, to) {
const pageTransitionName = 'my-page-transition'
if (!from || !to || !from.name || !to.name) return pageTransitionName
return stripLocale(from.name) === stripLocale(to.name) ? '-' : pageTransitionName
} |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
The still occurs in the latest version 6.0.0 |
Also looking for a solution for this! |
Also waiting for a fix! |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Looking 4 solution too! |
Is there already a solution to this? |
Same here, looking for a solution... It's pretty ugly. |
I don't think there is generic solution that could be applied here. No matter when we switch the locales, there is always gonna be a jarring text change if you are using transition that fades out the old page and fades in a new page. No matter if we switch locales at the beginning or end of the transition. |
This issue is really bothering me. Hopefully someone could come up with a complete solution for this. |
Actually, it should be possible to do something here but maybe would need something added in Nuxt. VueRouter knows when the route is about to change after transition so we could hook into that, potentially. |
Actually when page component actually switches is only known at the page component level ( |
Adding localised parts to
|
The problem is that @jorisnoo That's what you are suggesting? Grabbing a clone of the translation on |
Facing the same issue here. |
Same here. The only solution I found was to use a good old |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Please don't close. It's still an issue. |
Hello ! Adding my support on this. I also would like this fixed. Maybe the local change happens to early ? Could it be possible to set the new locale after first page unmounted, and before next page renders ? |
@tiretdusix Not possible at the moment. You'll be able to do it only once my PR fixing this issue gets merged: #963 |
Any update on this? I see there are some conflicts on that PR plus no more comments from the repo's maintainers |
Solution for that released in https://github.com/nuxt-community/i18n-module/releases/tag/v6.20.0. Thanks to @pmrotule . |
* fix: header with no aside prop * fix: handle header key in settings * fix: add content dir to purge * docs: add header key * fix: weird spacing and aligning Co-authored-by: Sébastien Chopin <seb@nuxtjs.com>
my version ^7.2.0 and still not fixed yet... Any solutions? |
I know that this is an ugly fix and you have to do it in every component as well, but at least it removed the page-leave-flicker for me.
...and in my css I removed "leave-active"
|
@Venegrad You need to go over a few extra steps to fix that issue as it cannot be fully fixed by |
Try key in nuxt layouts.
or either
|
Not working |
when I navigate to "/profile" from "/" and then click to change language, route changes to "it/profile" and then when I click on back button: <Button @click="router.back()" :noBg="true">{{ t('back') }} the page doesn't navigate to "/it" it just back to "/profile" I want when in homepage I navigate to "/profile" and then click to change language the route changes to "it/profile" and then when I click on back button it navigate to "/it/" |
Version
v5.3.0
Reproduction link
https://github.com
Steps to reproduce
I have simple fade page transition
The problem is, when I change locale, text content changes instantly while page transition is not complete.
In result I have a blink of content.
Is there'a a way to solve this?
What is expected ?
No blink, smooth transition
What is actually happening?
Transition broken, content blink
The text was updated successfully, but these errors were encountered: