Search code examples
vue.jsinternationalizationvue-i18n

vue, i18n translation: $t in alert()


I'm using Vue 2.6.14 and vue-i18n 8.25 I can't figure it out how to put i18n translation in alert()...

 async ChangePassword() {               
       await axios.post('/api/reset-password', 
       this.form).then((response) => {                            
                 alert( {{ $t('Password changed') }} );  
                        })}

This doesn't seems to work.


Solution

  • Try out with this

     alert( this.$t('Password changed') );