router push a locale route in nuxt with nuxt-i18n


I use nuxt-i18n to get internationalisation in my application. I have a list of news which gives me routes like that : (default language english)

when i click on a news i want to reach th _id page to get only only the news i clicked on. so i did this in a method (onclick) :

onLoadNews(id) {this.$router.push("/news/" + id);}

But this way i always return to english default language. How to push a locale route (in a methods function) this way ?


this.$router.push(this.localePath({ name: “news-id”, params: { id } }));

that worked for me because i have a folder “news” and inside two vue pages the index.vue and the _id.vue.

Leave a Reply

Your email address will not be published. Required fields are marked *