i want to use vue-i18n with /:lang in routes ... but i want ignore default lang, for example : www.domain.com/somwhere use my default lang and www.domain.com/fr/somwhere use french version .... is any way to do this ?
now it is like this:
www.domain.com/en default
www.domain.com/fr french
www.domain.com/du dutch
it has to be like this :
www.domain.com/ default
www.domain.com/fr french
www.domain.com/du dutch
my route.js file is like :
{
path: "/",
redirect: `/${i18n.locale}`
},
{
path: "/:lang",
async beforeEnter(to, from, next) {
console.log(i18n.locale);
if (!i18n.availableLocales.includes(to.params.lang)) {
window.location.replace(`${i18n.fallbackLocale}${to.path}`);
} else {
next();
}
},
component: {
render(c) {
return c("router-view");
}
},
children: [
{
path: "/",
name: "LandingPage",
component: () =>
import(
/* webpackChunkName: "LandingPage" */ "@/views/LandingPage/index"
)
},
}