Does Ionic Vue support chenging params in router.beforeEach?

Hi I want to change parameters dynamically. Everything works in vue3 but in Ionic it does not work.

import { createRouter, createWebHistory } from '@ionic/vue-router';
import {IonRouterOutlet} from '@ionic/vue';


const routes  = [
        {
            path: '',
            redirect: '/:lang?/splash'
        },
        {
            path: '/:lang?/',
            component: IonRouterOutlet,
            props:true,
            children: [
                // main routes
                // start
                {
                    path: 'splash',
                    name: 'Splash',
                    component: () => import('../views/pages/starting/Splash.vue')
                }]
        }
]

const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes,
})

router.beforeEach(async (to, from, next)=>{
    const lang = to.params.lang
    const LANGUAGES_ARRAY = ['ru','fr', 'en']
    if(!lang) {
        to.params.lang = 'en'
        return next()
    }
    if (!LANGUAGES_ARRAY.includes(lang)){
        to.params.lang = 'en'
        return next()
    }
    return next()
})

export default router

How can I set params in router.beforeEach?