diff --git a/client/web/admin/src/mixins/toast.js b/client/web/admin/src/mixins/toast.js index e8c09cc5d..0ac0bda6d 100644 --- a/client/web/admin/src/mixins/toast.js +++ b/client/web/admin/src/mixins/toast.js @@ -36,7 +36,12 @@ export default { const { prefix, title } = opt return (err = {}) => { - const msg = err.message ? (prefix + ': ' + err.message) : prefix + // only messages starting with 'notification:' or 'notification.' should be translated + if (err.message && err.message.startsWith('notification')) { + err.message = this.$t(`notification:${err.message.substring('notification.'.length)}`) + } + // all other messages should be shown as they are + const msg = err.message ? `${prefix}: ${err.message}` : prefix this.toastDanger(msg, title) } }, diff --git a/client/web/discovery/src/mixins/toast.js b/client/web/discovery/src/mixins/toast.js index 362f81fd9..e29feb615 100644 --- a/client/web/discovery/src/mixins/toast.js +++ b/client/web/discovery/src/mixins/toast.js @@ -36,7 +36,12 @@ export default { const { prefix, title } = opt return (err = {}) => { - const msg = err.message ? (prefix + ': ' + this.$t(err.message)) : prefix + // only messages starting with 'notification:' or 'notification.' should be translated + if (err.message && err.message.startsWith('notification')) { + err.message = this.$t(`notification:${err.message.substring('notification.'.length)}`) + } + // all other messages should be shown as they are + const msg = err.message ? `${prefix}: ${err.message}` : prefix this.toastDanger(msg, title) } }, diff --git a/client/web/reporter/src/mixins/toast.js b/client/web/reporter/src/mixins/toast.js index 362f81fd9..e29feb615 100644 --- a/client/web/reporter/src/mixins/toast.js +++ b/client/web/reporter/src/mixins/toast.js @@ -36,7 +36,12 @@ export default { const { prefix, title } = opt return (err = {}) => { - const msg = err.message ? (prefix + ': ' + this.$t(err.message)) : prefix + // only messages starting with 'notification:' or 'notification.' should be translated + if (err.message && err.message.startsWith('notification')) { + err.message = this.$t(`notification:${err.message.substring('notification.'.length)}`) + } + // all other messages should be shown as they are + const msg = err.message ? `${prefix}: ${err.message}` : prefix this.toastDanger(msg, title) } }, diff --git a/client/web/workflow/src/mixins/toast.js b/client/web/workflow/src/mixins/toast.js index adc407603..7f5304cd3 100644 --- a/client/web/workflow/src/mixins/toast.js +++ b/client/web/workflow/src/mixins/toast.js @@ -28,7 +28,12 @@ export default { const { prefix, title } = opt return (err = {}) => { - const msg = err.message ? (prefix + ': ' + err.message) : prefix + // only messages starting with 'notification:' or 'notification.' should be translated + if (err.message && err.message.startsWith('notification')) { + err.message = this.$t(`notification:${err.message.substring('notification.'.length)}`) + } + // all other messages should be shown as they are + const msg = err.message ? `${prefix}: ${err.message}` : prefix this.toastDanger(msg, title) } },