From c273626c3d6443a827e381e7346b9531ee0847e2 Mon Sep 17 00:00:00 2001 From: advplyr Date: Fri, 30 Aug 2024 17:41:58 -0500 Subject: [PATCH] Consolidate translations and reduce number of toasts --- client/components/cards/NotificationCard.vue | 2 -- .../components/modals/AudioFileDataModal.vue | 2 +- .../modals/ListeningSessionModal.vue | 1 - client/components/modals/SleepTimerModal.vue | 2 +- client/components/modals/UploadImageModal.vue | 1 - .../modals/emails/EReaderDeviceModal.vue | 2 -- client/components/modals/item/tabs/Cover.vue | 5 ----- .../modals/libraries/LazyFolderChooser.vue | 2 +- .../notification/NotificationEditModal.vue | 1 - client/pages/account.vue | 4 ++-- client/pages/audiobook/_id/chapters.vue | 2 +- client/pages/config/email.vue | 1 - client/pages/config/sessions.vue | 6 ++--- client/pages/config/users/_id/sessions.vue | 5 +++-- client/pages/item/_id/index.vue | 1 - .../_library/podcast/download-queue.vue | 2 +- .../pages/library/_library/podcast/latest.vue | 2 +- client/strings/en-us.json | 22 +------------------ 18 files changed, 15 insertions(+), 48 deletions(-) diff --git a/client/components/cards/NotificationCard.vue b/client/components/cards/NotificationCard.vue index 4b7db2b01..cf959df76 100644 --- a/client/components/cards/NotificationCard.vue +++ b/client/components/cards/NotificationCard.vue @@ -127,7 +127,6 @@ export default { .$patch(`/api/notifications/${this.notification.id}`, payload) .then((updatedSettings) => { this.$emit('update', updatedSettings) - this.$toast.success(this.$strings.ToastNotificationEnabled) }) .catch((error) => { console.error('Failed to update notification', error) @@ -155,7 +154,6 @@ export default { .$delete(`/api/notifications/${this.notification.id}`) .then((updatedSettings) => { this.$emit('update', updatedSettings) - this.$toast.success(this.$strings.ToastNotificationDeleteSuccess) }) .catch((error) => { console.error('Failed', error) diff --git a/client/components/modals/AudioFileDataModal.vue b/client/components/modals/AudioFileDataModal.vue index a37e8cba1..7e33a9805 100644 --- a/client/components/modals/AudioFileDataModal.vue +++ b/client/components/modals/AudioFileDataModal.vue @@ -159,7 +159,7 @@ export default { }) .catch((error) => { console.error('Failed to get ffprobe data', error) - this.$toast.error(this.$strings.ToastFfprobeFailed) + this.$toast.error(this.$strings.ToastFailedToLoadData) }) .finally(() => { this.probingFile = false diff --git a/client/components/modals/ListeningSessionModal.vue b/client/components/modals/ListeningSessionModal.vue index 9d26ede22..df029e565 100644 --- a/client/components/modals/ListeningSessionModal.vue +++ b/client/components/modals/ListeningSessionModal.vue @@ -206,7 +206,6 @@ export default { this.$axios .$post(`/api/session/${this._session.id}/close`) .then(() => { - this.$toast.success(this.$strings.ToastSessionCloseSuccess) this.show = false this.$emit('closedSession') }) diff --git a/client/components/modals/SleepTimerModal.vue b/client/components/modals/SleepTimerModal.vue index af3ad6982..48210582e 100644 --- a/client/components/modals/SleepTimerModal.vue +++ b/client/components/modals/SleepTimerModal.vue @@ -15,7 +15,7 @@
- {{ $strings.ButtonSet }} + {{ $strings.ButtonSubmit }}
diff --git a/client/components/modals/UploadImageModal.vue b/client/components/modals/UploadImageModal.vue index 381bf4a27..9a55ae51c 100644 --- a/client/components/modals/UploadImageModal.vue +++ b/client/components/modals/UploadImageModal.vue @@ -78,7 +78,6 @@ export default { if (data.error) { this.$toast.error(data.error) } else { - this.$toast.success(this.$strings.ToastCoverUploaded) this.resetCoverPreview() } this.processingUpload = false diff --git a/client/components/modals/emails/EReaderDeviceModal.vue b/client/components/modals/emails/EReaderDeviceModal.vue index 962c05dc0..7476dd4b7 100644 --- a/client/components/modals/emails/EReaderDeviceModal.vue +++ b/client/components/modals/emails/EReaderDeviceModal.vue @@ -174,7 +174,6 @@ export default { .$post(`/api/emails/ereader-devices`, payload) .then((data) => { this.$emit('update', data.ereaderDevices) - this.$toast.success(this.$strings.ToastDeviceUpdateSuccess) this.show = false }) .catch((error) => { @@ -201,7 +200,6 @@ export default { .$post('/api/emails/ereader-devices', payload) .then((data) => { this.$emit('update', data.ereaderDevices || []) - this.$toast.success(this.$strings.ToastDeviceAddSuccess) this.show = false }) .catch((error) => { diff --git a/client/components/modals/item/tabs/Cover.vue b/client/components/modals/item/tabs/Cover.vue index 604fb9385..69c111197 100644 --- a/client/components/modals/item/tabs/Cover.vue +++ b/client/components/modals/item/tabs/Cover.vue @@ -194,7 +194,6 @@ export default { if (data.error) { this.$toast.error(data.error) } else { - this.$toast.success(this.$strings.ToastCoverUploaded) this.resetCoverPreview() } this.processingUpload = false @@ -264,7 +263,6 @@ export default { .$post(`/api/items/${this.libraryItemId}/cover`, { url: cover }) .then(() => { this.imageUrl = '' - this.$toast.success(this.$strings.ToastCoverUpdateSuccess) }) .catch((error) => { console.error('Failed to update cover', error) @@ -308,9 +306,6 @@ export default { this.isProcessing = true this.$axios .$patch(`/api/items/${this.libraryItemId}/cover`, { cover: coverFile.metadata.path }) - .then(() => { - this.$toast.success(this.$strings.ToastCoverUpdateSuccess) - }) .catch((error) => { console.error('Failed to set local cover', error) this.$toast.error(error.response?.data || this.$strings.ToastCoverUpdateFailed) diff --git a/client/components/modals/libraries/LazyFolderChooser.vue b/client/components/modals/libraries/LazyFolderChooser.vue index ae867d443..eb152c286 100644 --- a/client/components/modals/libraries/LazyFolderChooser.vue +++ b/client/components/modals/libraries/LazyFolderChooser.vue @@ -162,7 +162,7 @@ export default { }) .catch((error) => { console.error('Failed to get filesystem paths', error) - this.$toast.error(this.$strings.ToastGetFilesystemPathsFailed) + this.$toast.error(this.$strings.ToastFailedToLoadData) return [] }) .finally(() => { diff --git a/client/components/modals/notification/NotificationEditModal.vue b/client/components/modals/notification/NotificationEditModal.vue index 96ac754a1..afd4d1f9f 100644 --- a/client/components/modals/notification/NotificationEditModal.vue +++ b/client/components/modals/notification/NotificationEditModal.vue @@ -149,7 +149,6 @@ export default { .$post('/api/notifications', payload) .then((updatedSettings) => { this.$emit('update', updatedSettings) - this.$toast.success(this.$strings.ToastNotificationCreateSuccess) this.show = false }) .catch((error) => { diff --git a/client/pages/account.vue b/client/pages/account.vue index 0e8a11162..b6c932a0f 100644 --- a/client/pages/account.vue +++ b/client/pages/account.vue @@ -133,13 +133,13 @@ export default { this.$toast.success(this.$strings.ToastUserPasswordChangeSuccess) this.resetForm() } else { - this.$toast.error(res.error || 'Unknown Error') + this.$toast.error(res.error || this.$strings.ToastUnknownError) } this.changingPassword = false }) .catch((error) => { console.error(error) - this.$toast.error(this.$strings.ToastApiCallFailed) + this.$toast.error(this.$strings.ToastUnknownError) this.changingPassword = false }) } diff --git a/client/pages/audiobook/_id/chapters.vue b/client/pages/audiobook/_id/chapters.vue index 23c7fb179..9dabb59d5 100644 --- a/client/pages/audiobook/_id/chapters.vue +++ b/client/pages/audiobook/_id/chapters.vue @@ -560,7 +560,7 @@ export default { .catch((error) => { this.findingChapters = false console.error('Failed to get chapter data', error) - this.$toast.error(this.$strings.ToastGetChaptersFailed) + this.$toast.error(this.$strings.ToastFailedToLoadData) this.showFindChaptersModal = false }) }, diff --git a/client/pages/config/email.vue b/client/pages/config/email.vue index 1e6c0557b..212c51f31 100644 --- a/client/pages/config/email.vue +++ b/client/pages/config/email.vue @@ -218,7 +218,6 @@ export default { .$post(`/api/emails/ereader-devices`, payload) .then((data) => { this.ereaderDevicesUpdated(data.ereaderDevices) - this.$toast.success(this.$strings.ToastDeviceDeleteSuccess) }) .catch((error) => { console.error('Failed to delete device', error) diff --git a/client/pages/config/sessions.vue b/client/pages/config/sessions.vue index c77aede50..59ff75587 100644 --- a/client/pages/config/sessions.vue +++ b/client/pages/config/sessions.vue @@ -290,7 +290,6 @@ export default { this.$axios .$post(`/api/sessions/batch/delete`, payload) .then(() => { - this.$toast.success(this.$strings.ToastSessionsRemoved) if (isAllSessions) { // If all sessions were removed from the current page then go to the previous page if (this.currentPage > 0) { @@ -358,12 +357,13 @@ export default { }) if (!libraryItem) { - this.$toast.error(this.$strings.ToastGetLibraryItemFailed) + this.$toast.error(this.$strings.ToastFailedToLoadData) this.processingGoToTimestamp = false return } if (session.episodeId && !libraryItem.media.episodes.some((ep) => ep.id === session.episodeId)) { - this.$toast.error(this.$strings.ToastGetPodcastEpisodeFailed) + console.error('Episode not found in library item', session.episodeId, libraryItem.media.episodes) + this.$toast.error(this.$strings.ToastFailedToLoadData) this.processingGoToTimestamp = false return } diff --git a/client/pages/config/users/_id/sessions.vue b/client/pages/config/users/_id/sessions.vue index e37f5c7d4..6b4756776 100644 --- a/client/pages/config/users/_id/sessions.vue +++ b/client/pages/config/users/_id/sessions.vue @@ -127,12 +127,13 @@ export default { }) if (!libraryItem) { - this.$toast.error(this.$strings.ToastGetLibraryItemFailed) + this.$toast.error(this.$strings.ToastFailedToLoadData) this.processingGoToTimestamp = false return } if (session.episodeId && !libraryItem.media.episodes.some((ep) => ep.id === session.episodeId)) { - this.$toast.error(this.$strings.ToastGetPodcastEpisodeFailed) + console.error('Episode not found in library item', session.episodeId, libraryItem.media.episodes) + this.$toast.error(this.$strings.ToastFailedToLoadData) this.processingGoToTimestamp = false return } diff --git a/client/pages/item/_id/index.vue b/client/pages/item/_id/index.vue index 8b9274164..efc3a4624 100644 --- a/client/pages/item/_id/index.vue +++ b/client/pages/item/_id/index.vue @@ -628,7 +628,6 @@ export default { .$delete(`/api/me/progress/${this.userMediaProgress.id}`) .then(() => { console.log('Progress reset complete') - this.$toast.success(this.$strings.ToastProgressReset) this.resettingProgress = false }) .catch((error) => { diff --git a/client/pages/library/_library/podcast/download-queue.vue b/client/pages/library/_library/podcast/download-queue.vue index 65306cec2..777ddfc16 100644 --- a/client/pages/library/_library/podcast/download-queue.vue +++ b/client/pages/library/_library/podcast/download-queue.vue @@ -111,7 +111,7 @@ export default { this.processing = true const queuePayload = await this.$axios.$get(`/api/libraries/${this.libraryId}/episode-downloads`).catch((error) => { console.error('Failed to get download queue', error) - this.$toast.error(this.$strings.ToastGetDownloadQueueFailed) + this.$toast.error(this.$strings.ToastFailedToLoadData) return null }) this.processing = false diff --git a/client/pages/library/_library/podcast/latest.vue b/client/pages/library/_library/podcast/latest.vue index b9f6f912a..3e6ca773c 100644 --- a/client/pages/library/_library/podcast/latest.vue +++ b/client/pages/library/_library/podcast/latest.vue @@ -211,7 +211,7 @@ export default { this.processing = true const episodePayload = await this.$axios.$get(`/api/libraries/${this.libraryId}/recent-episodes?limit=25&page=${page}`).catch((error) => { console.error('Failed to get recent episodes', error) - this.$toast.error(this.$strings.ToastGetRecentEpisodesFailed) + this.$toast.error(this.$strings.ToastFailedToLoadData) return null }) this.processing = false diff --git a/client/strings/en-us.json b/client/strings/en-us.json index f4d727669..3dc294090 100644 --- a/client/strings/en-us.json +++ b/client/strings/en-us.json @@ -89,7 +89,6 @@ "ButtonSearch": "Search", "ButtonSelectFolderPath": "Select Folder Path", "ButtonSeries": "Series", - "ButtonSet": "Set", "ButtonSetChaptersFromTracks": "Set chapters from tracks", "ButtonShare": "Share", "ButtonShiftTimes": "Shift Times", @@ -693,6 +692,7 @@ "MessageConfirmRenameTag": "Are you sure you want to rename tag \"{0}\" to \"{1}\" for all items?", "MessageConfirmRenameTagMergeNote": "Note: This tag already exists so they will be merged.", "MessageConfirmRenameTagWarning": "Warning! A similar tag with a different casing already exists \"{0}\".", + "MessageConfirmResetProgress": "Are you sure you want to reset your progress?", "MessageConfirmSendEbookToDevice": "Are you sure you want to send {0} ebook \"{1}\" to device \"{2}\"?", "MessageConfirmUnlinkOpenId": "Are you sure you want to unlink this user from OpenID?", "MessageDownloadingEpisode": "Downloading episode", @@ -766,7 +766,6 @@ "MessageRemoveUserWarning": "Are you sure you want to permanently delete user \"{0}\"?", "MessageReportBugsAndContribute": "Report bugs, request features, and contribute on", "MessageResetChaptersConfirm": "Are you sure you want to reset chapters and undo the changes you made?", - "MessageResetProgressConfirm": "Are you sure you want to reset your progress?", "MessageRestoreBackupConfirm": "Are you sure you want to restore the backup created on", "MessageRestoreBackupWarning": "Restoring a backup will overwrite the entire database located at /config and cover images in /metadata/items & /metadata/authors.

Backups do not modify any files in your library folders. If you have enabled server settings to store cover art and metadata in your library folders then those are not backed up or overwritten.

All clients using your server will be automatically refreshed.", "MessageSearchResultsFor": "Search results for", @@ -819,7 +818,6 @@ "StatsYearInReview": "YEAR IN REVIEW", "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", @@ -861,18 +859,13 @@ "ToastCollectionUpdateFailed": "Failed to update collection", "ToastCollectionUpdateSuccess": "Collection updated", "ToastCoverUpdateFailed": "Cover update failed", - "ToastCoverUpdateSuccess": "Cover updated", - "ToastCoverUploaded": "Cover uploaded", "ToastDeleteFileFailed": "Failed to delete file", "ToastDeleteFileSuccess": "File deleted", "ToastDeviceAddFailed": "Failed to add device", - "ToastDeviceAddSuccess": "Device added", - "ToastDeviceDeleteSuccess": "Device deleted", "ToastDeviceNameAlreadyExists": "Ereader device with that name already exists", "ToastDeviceTestEmailFailed": "Failed to send test email", "ToastDeviceTestEmailSuccess": "Test email sent", "ToastDeviceUpdateFailed": "Failed to update device", - "ToastDeviceUpdateSuccess": "Device updated", "ToastEmailSettingsUpdateFailed": "Failed to update email settings", "ToastEmailSettingsUpdateSuccess": "Email settings updated", "ToastEncodeCancelFailed": "Failed to cancel encode", @@ -884,13 +877,6 @@ "ToastFailedToShare": "Failed to share", "ToastFailedToUpdateAccount": "Failed to update account", "ToastFailedToUpdateUser": "Failed to update user", - "ToastFfprobeFailed": "FFprobe failed", - "ToastGetChaptersFailed": "Failed to get chapters", - "ToastGetDownloadQueueFailed": "Failed to get download queue", - "ToastGetFilesystemPathsFailed": "Failed to get filesystem paths", - "ToastGetLibraryItemFailed": "Failed to get library item", - "ToastGetPodcastEpisodeFailed": "Failed to get podcast episode", - "ToastGetRecentEpisodesFailed": "Failed to get recent episodes", "ToastInvalidImageUrl": "Invalid image URL", "ToastInvalidUrl": "Invalid URL", "ToastItemCoverUpdateFailed": "Failed to update item cover", @@ -923,10 +909,7 @@ "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", @@ -945,7 +928,6 @@ "ToastPodcastGetFeedFailed": "Failed to get podcast feed", "ToastPodcastNoEpisodesInFeed": "No episodes found in RSS feed", "ToastPodcastNoRssFeed": "Podcast does not have an RSS feed", - "ToastProgressReset": "Your progress was reset", "ToastProviderCreatedFailed": "Failed to add provider", "ToastProviderCreatedSuccess": "New provider added", "ToastProviderNameAndUrlRequired": "Name and Url required", @@ -971,10 +953,8 @@ "ToastServerSettingsUpdateFailed": "Failed to update server settings", "ToastServerSettingsUpdateSuccess": "Server settings updated", "ToastSessionCloseFailed": "Failed to close session", - "ToastSessionCloseSuccess": "Session closed", "ToastSessionDeleteFailed": "Failed to delete session", "ToastSessionDeleteSuccess": "Session deleted", - "ToastSessionsRemoved": "Sessions removed", "ToastSlugMustChange": "Slug contains invalid characters", "ToastSlugRequired": "Slug is required", "ToastSocketConnected": "Socket connected",