switchLocalePath() doesn't work in plugins

LionelPaulus
0
LionelPaulus
commented 2 months ago

Version

v5.3.0

Reproduction link

https://codesandbox.io/embed/nuxt-i18n-switchlocalepath-bug-dbi7h

Steps to reproduce

Create a Nuxt plugin and try using switchLocalePath() in it.

What is expected ?

Function working: returning the locale path for the desired locale.

What is actually happening?

Function crashes with error:

Cannot destructure property params of 'undefined' or 'null'.
const { params, …routeCopy } = this.$route

Additional comments?

I'm using nuxt 2.10.0 and nuxt-i18n 6.3.0

bug
0
LionelPaulus
0
LionelPaulus
commented 2 months ago

Hey @rchl, any update on this? :)
If you have a workaround, it would be very helpful 🙏

0
rchl
578
rchl
commented 2 months ago

No workarounds. It needs a proper fix that requires some refactoring. Seems like this was never supported so it's not a trivial bug fix

0
Informations
Bug ReportOpen
#c318 - Created 2 months ago