"vue": "^2.4.2",
"vue-i18n": "^7.2.0",
// signup.js
let signup = {
en: { 'signup': 'Sign up' },
ru: { 'signup': '袪械谐懈褋褌褉邪褑懈褟' },
kz: { 'signup': 'Tirkelw' }
}
export default signup
//component.vue
...
<script>
export default {
props: {
langFileName: String // 'signup'
},
mounted () {
console.log(this.langFile) // 'signup'
},
i18n: {messages: require('@/lang/' + this.langFile).default} // Cannot find module './undefined'
}
</script>
or
//component.vue
...
<script>
export default {
props: {
messages: Object // signup.js object
},
mounted () {
console.log(this.messages) // signup.js object
},
i18n: {messages: this.messages} // typeof this.messages - undefined
}
</script>
Thank you for reporting!
sorry, for my late response.
In about i18n: {messages: require('@/lang/' + this.langFile).default}, I seem langFile prop is not inialized.
In about i18n: {messages: this.messages}, In this case, The context of this.messages is <script> tag, so you need to fix.
please, I hope you will check the code once again.
so, how to send object with messages from parent component to i18n option of child component?
i18n option of child component don't see props, but other options are seen
Most helpful comment
so, how to send object with messages from parent component to i18n option of child component?
i18n option of child component don't see props, but other options are seen