This is how I used it! It successfully solved this error!
const i18n = createI18n({
locale: local,
legacy: false,
globalInjection: true,
messages: messages
})
//Use it i18n.global.locale instead of useI18n().locale
const locale = i18n.global.locale
locale.value = language.lang