Answer the question
In order to leave comments, you need to log in
How to use vue-i18n inside a script?
There is a small codeandbox
project I
use the vue-i18n translator.
Hello World template: <h1>{{msg}}</h1>
And script:
data() {
return {
msg: `{{ $t("welcomeMsg") }}`
}
}
const messages = {
en: {
welcomeMsg: "Welcome to Your Vue.js App",
},
es: {
welcomeMsg: "Bienvenido a tu aplicación Vue.js",
}
};
msg:{{ $t("welcomeMsg") }}
? Answer the question
In order to leave comments, you need to log in
export default {
name: "HelloWorld",
data() {
return {
msg: this.$t("welcomeMsg")
}
}
};
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question