Use in variable
TheoLecoq opened this issue · 2 comments
TheoLecoq commented
Is is possible to use the translation in a variable? Something like $('#error').text( {{ t('error min max') }} );
?
tobias-grasse commented
If I understand your question correctly: Yes, you can use vue-translate outside the template section, you just have to call this.$translate.text("my text")
instead. In your example:
$('#error').text(this.$translate.text("error min max"));
Make sure that the this
context refers to the Vue instance where you define the locales.
javisperez commented
Hey, sorry for the looong delay 😅 but yeah @tobias-grasse is right! you can use it in your script part of the component. Please let us know if you have more questions, thanks.