I have a functions.js file containing multiple user functions. I am trying to incorporate i18n within one of these functions, but using this.$t is not yielding the expected results. How can I properly implement i18n in this scenario?
functions.js
import Vue from 'vue'
import moment from 'moment'
export default {
delete() {
return new Promise((resolve) => {
Vue.swal({
title: this.$t('delete'),
type: 'warning',
showCancelButton: true,
//confirmButtonColor: '#3085d6',
//cancelButtonColor: '#d33',
confirmButtonText: 'Eliminar',
cancelButtonText: 'Cancelar'
}).then((result) => {
if (result.value) resolve();
});
});
}
{{ $t('back') }}
is functional within <template>
, and this.$t('back')
also works within a vue component.