From 14719f83fb17866bd14a0b404a11b72b137432a9 Mon Sep 17 00:00:00 2001 From: Nicholas Wallace Date: Fri, 30 Aug 2024 10:55:31 -0700 Subject: [PATCH] Update: notification strings --- client/components/cards/NotificationCard.vue | 30 +++++++++---------- .../notification/NotificationEditModal.vue | 14 ++++----- client/pages/config/notifications.vue | 8 ++--- client/strings/en-us.json | 21 +++++++++++++ 4 files changed, 47 insertions(+), 26 deletions(-) diff --git a/client/components/cards/NotificationCard.vue b/client/components/cards/NotificationCard.vue index 1506cfb58..4b7db2b01 100644 --- a/client/components/cards/NotificationCard.vue +++ b/client/components/cards/NotificationCard.vue @@ -4,11 +4,11 @@

{{ eventName }}

- Fire onTest Event - Fire & Fail + {{ this.$strings.ButtonFireOnTest }} + {{ this.$strings.ButtonFireAndFail }} - Test - Enable + {{ this.$strings.ButtonTest }} + {{ this.$strings.ButtonEnable }} @@ -65,12 +65,12 @@ export default { this.$axios .$get(`/api/notifications/test?fail=${intentionallyFail ? 1 : 0}`) .then(() => { - this.$toast.success('Triggered onTest Event') + this.$toast.success(this.$strings.ToastNotificationTestTriggerSuccess) }) .catch((error) => { console.error('Failed', error) const errorMsg = error.response ? error.response.data : null - this.$toast.error(`Failed: ${errorMsg}` || 'Failed to trigger onTest event') + this.$toast.error(`Failed: ${errorMsg}` || this.$strings.ToastNotificationTestTriggerFailed) }) .finally(() => { this.testing = false @@ -91,7 +91,7 @@ export default { // End testing functions sendTestClick() { const payload = { - message: `Trigger this notification with test data?`, + message: this.$strings.MessageConfirmNotificationTestTrigger, callback: (confirmed) => { if (confirmed) { this.sendTest() @@ -106,12 +106,12 @@ export default { this.$axios .$get(`/api/notifications/${this.notification.id}/test`) .then(() => { - this.$toast.success('Triggered test notification') + this.$toast.success(this.$strings.ToastNotificationTestTriggerSuccess) }) .catch((error) => { console.error('Failed', error) const errorMsg = error.response ? error.response.data : null - this.$toast.error(`Failed: ${errorMsg}` || 'Failed to trigger test notification') + this.$toast.error(`Failed: ${errorMsg}` || this.$strings.ToastNotificationTestTriggerFailed) }) .finally(() => { this.sendingTest = false @@ -127,11 +127,11 @@ export default { .$patch(`/api/notifications/${this.notification.id}`, payload) .then((updatedSettings) => { this.$emit('update', updatedSettings) - this.$toast.success('Notification enabled') + this.$toast.success(this.$strings.ToastNotificationEnabled) }) .catch((error) => { console.error('Failed to update notification', error) - this.$toast.error('Failed to update notification') + this.$toast.error(this.$strings.ToastNotificationUpdateFailed) }) .finally(() => { this.enabling = false @@ -139,7 +139,7 @@ export default { }, deleteNotificationClick() { const payload = { - message: `Are you sure you want to delete this notification?`, + message: this.$strings.MessageConfirmDeleteNotification, callback: (confirmed) => { if (confirmed) { this.deleteNotification() @@ -155,11 +155,11 @@ export default { .$delete(`/api/notifications/${this.notification.id}`) .then((updatedSettings) => { this.$emit('update', updatedSettings) - this.$toast.success('Deleted notification') + this.$toast.success(this.$strings.ToastNotificationDeleteSuccess) }) .catch((error) => { console.error('Failed', error) - this.$toast.error('Failed to delete notification') + this.$toast.error(this.$strings.ToastNotificationDeleteFailed) }) .finally(() => { this.deleting = false @@ -171,4 +171,4 @@ export default { }, mounted() {} } - \ No newline at end of file + diff --git a/client/components/modals/notification/NotificationEditModal.vue b/client/components/modals/notification/NotificationEditModal.vue index 2fc10ce68..96ac754a1 100644 --- a/client/components/modals/notification/NotificationEditModal.vue +++ b/client/components/modals/notification/NotificationEditModal.vue @@ -86,7 +86,7 @@ export default { return this.selectedEventData && this.selectedEventData.requiresLibrary }, title() { - return this.isNew ? 'Create Notification' : 'Update Notification' + return this.isNew ? this.$strings.HeaderNotificationCreate : this.$strings.HeaderNotificationUpdate }, availableVariables() { return this.selectedEventData ? this.selectedEventData.variables || null : null @@ -104,9 +104,9 @@ export default { }, submitForm() { this.$refs.urlsInput?.forceBlur() - + if (!this.newNotification.urls.length) { - this.$toast.error('Must enter an Apprise URL') + this.$toast.error(this.$strings.ToastAppriseUrlRequired) return } @@ -127,12 +127,12 @@ export default { .$patch(`/api/notifications/${payload.id}`, payload) .then((updatedSettings) => { this.$emit('update', updatedSettings) - this.$toast.success('Notification updated') + this.$toast.success(this.$strings.ToastNotificationUpdateSuccess) this.show = false }) .catch((error) => { console.error('Failed to update notification', error) - this.$toast.error('Failed to update notification') + this.$toast.error(this.$strings.ToastNotificationUpdateFailed) }) .finally(() => { this.processing = false @@ -149,12 +149,12 @@ export default { .$post('/api/notifications', payload) .then((updatedSettings) => { this.$emit('update', updatedSettings) - this.$toast.success('Notification created') + this.$toast.success(this.$strings.ToastNotificationCreateSuccess) this.show = false }) .catch((error) => { console.error('Failed to create notification', error) - this.$toast.error('Failed to create notification') + this.$toast.error(this.$strings.ToastNotificationCreateFailed) }) .finally(() => { this.processing = false diff --git a/client/pages/config/notifications.vue b/client/pages/config/notifications.vue index ad346a5d7..24ea6a6cc 100644 --- a/client/pages/config/notifications.vue +++ b/client/pages/config/notifications.vue @@ -105,12 +105,12 @@ export default { } if (isNaN(this.maxNotificationQueue) || this.maxNotificationQueue <= 0) { - this.$toast.error('Max notification queue must be >= 0') + this.$toast.error(this.$strings.ToastNotificationQueueMaximum) return false } if (isNaN(this.maxFailedAttempts) || this.maxFailedAttempts <= 0) { - this.$toast.error('Max failed attempts must be >= 0') + this.$toast.error(this.$strings.ToastNotificationFailedMaximum) return false } @@ -128,11 +128,11 @@ export default { this.$axios .$patch('/api/notifications', updatePayload) .then(() => { - this.$toast.success('Notification settings updated') + this.$toast.success(this.$strings.ToastNotificationSettingsUpdateSuccess) }) .catch((error) => { console.error('Failed to update notification settings', error) - this.$toast.error('Failed to update notification settings') + this.$toast.error(this.$strings.ToastNotificationSettingsUpdateFailed) }) .finally(() => { this.savingSettings = false diff --git a/client/strings/en-us.json b/client/strings/en-us.json index cd8037d69..ad7beb0e7 100644 --- a/client/strings/en-us.json +++ b/client/strings/en-us.json @@ -28,6 +28,9 @@ "ButtonEdit": "Edit", "ButtonEditChapters": "Edit Chapters", "ButtonEditPodcast": "Edit Podcast", + "ButtonEnable": "Enable", + "ButtonFireAndFail": "Fire and Fail", + "ButtonFireOnTest": "Fire onTest event", "ButtonForceReScan": "Force Re-Scan", "ButtonFullPath": "Full Path", "ButtonHide": "Hide", @@ -153,6 +156,8 @@ "HeaderMetadataToEmbed": "Metadata to embed", "HeaderNewAccount": "New Account", "HeaderNewLibrary": "New Library", + "HeaderNotificationCreate": "Create Notification", + "HeaderNotificationUpdate": "Update Notification", "HeaderNotifications": "Notifications", "HeaderOpenIDConnectAuthentication": "OpenID Connect Authentication", "HeaderOpenRSSFeed": "Open RSS Feed", @@ -654,6 +659,7 @@ "MessageConfirmDeleteLibrary": "Are you sure you want to permanently delete library \"{0}\"?", "MessageConfirmDeleteLibraryItem": "This will delete the library item from the database and your file system. Are you sure?", "MessageConfirmDeleteLibraryItems": "This will delete {0} library items from the database and your file system. Are you sure?", + "MessageConfirmDeleteNotification": "Are you sure you want to delete this notification?", "MessageConfirmDeleteSession": "Are you sure you want to delete this session?", "MessageConfirmForceReScan": "Are you sure you want to force re-scan?", "MessageConfirmMarkAllEpisodesFinished": "Are you sure you want to mark all episodes as finished?", @@ -662,6 +668,7 @@ "MessageConfirmMarkItemNotFinished": "Are you sure you want to mark \"{0}\" as not finished?", "MessageConfirmMarkSeriesFinished": "Are you sure you want to mark all books in this series as finished?", "MessageConfirmMarkSeriesNotFinished": "Are you sure you want to mark all books in this series as not finished?", + "MessageConfirmNotificationTestTrigger": "Trigger this notification with test data?", "MessageConfirmPurgeCache": "Purge cache will delete the entire directory at /metadata/cache.

Are you sure you want to remove the cache directory?", "MessageConfirmPurgeItemsCache": "Purge items cache will delete the entire directory at /metadata/cache/items.
Are you sure?", "MessageConfirmQuickEmbed": "Warning! Quick embed will not backup your audio files. Make sure that you have a backup of your audio files.

Would you like to continue?", @@ -806,6 +813,7 @@ "ToastAccountUpdateFailed": "Failed to update account", "ToastAccountUpdateSuccess": "Account updated", "ToastApiCallFailed": "API call failed", + "ToastAppriseUrlRequired": "Must enter an Apprise URL", "ToastAuthorImageRemoveSuccess": "Author image removed", "ToastAuthorNotFound": "Author \"{0}\" not found", "ToastAuthorRemoveSuccess": "Author removed", @@ -892,6 +900,19 @@ "ToastNewUserTagError": "Must select at least one tag", "ToastNewUserUsernameError": "Enter a username", "ToastNoUpdatesNecessary": "No updates necessary", + "ToastNotificationCreateFailed": "Failed to create notification", + "ToastNotificationCreateSuccess": "Notification created", + "ToastNotificationDeleteFailed": "Failed to delete notification", + "ToastNotificationDeleteSuccess": "Notification deleted", + "ToastNotificationEnabled": "Notification enabled", + "ToastNotificationFailedMaximum": "Max failed attempts must be >= 0", + "ToastNotificationQueueMaximum": "Max notification queue must be >= 0", + "ToastNotificationSettingsUpdateFailed": "Failed to update notification settings", + "ToastNotificationSettingsUpdateSuccess": "Notification settings updated", + "ToastNotificationTestTriggerFailed": "Failed to trigger test notification", + "ToastNotificationTestTriggerSuccess": "Triggered test notification", + "ToastNotificationUpdateFailed": "Failed to update notification", + "ToastNotificationUpdateSuccess": "Notification updated", "ToastPlaylistCreateFailed": "Failed to create playlist", "ToastPlaylistCreateSuccess": "Playlist created", "ToastPlaylistRemoveSuccess": "Playlist removed",