I am trying to access an object from vi18n
Vue: 3.2.0
Vite: 4.2.0
vue-18n: 9.2.2
i18n.js
import { createI18n } from 'vue-i18n'
import en from "./locales/en.js"
// Create VueI18n instance with options
const i18n = createI18n({
locale: 'en', // set locale
legacy: false,
messages: { en } // set locale messages
})
export default i18n
en.js
export const en = {
parent: {
child1: 'a',
child2: 'b'
}
}
In the component i am access this.$t('parent')
to access all childs but it actually returning the parent
as a string itself. And it shows a warning [intlify] Not found 'parent' key in 'en' locale messages
But if i am accessing like this this.$t('parent.child1')
it is able to get the value of child1.
In older version vue 2 and vue-18n. it used to return the complete object.