Consolidate translations and reduce number of toasts

This commit is contained in:
advplyr 2024-08-30 17:41:58 -05:00
parent 3dfbddda33
commit c273626c3d
18 changed files with 15 additions and 48 deletions

View file

@ -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)

View file

@ -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

View file

@ -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')
})

View file

@ -15,7 +15,7 @@
</template>
<form class="flex items-center justify-center px-6 py-3" @submit.prevent="submitCustomTime">
<ui-text-input v-model="customTime" type="number" step="any" min="0.1" :placeholder="$strings.LabelTimeInMinutes" class="w-48" />
<ui-btn color="success" type="submit" :padding-x="0" class="h-9 w-12 flex items-center justify-center ml-1">{{ $strings.ButtonSet }}</ui-btn>
<ui-btn color="success" type="submit" :padding-x="0" class="h-9 w-18 flex items-center justify-center ml-1">{{ $strings.ButtonSubmit }}</ui-btn>
</form>
</div>
<div v-if="timerSet" class="w-full p-4">

View file

@ -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

View file

@ -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) => {

View file

@ -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)

View file

@ -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(() => {

View file

@ -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) => {

View file

@ -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
})
}

View file

@ -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
})
},

View file

@ -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)

View file

@ -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
}

View file

@ -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
}

View file

@ -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) => {

View file

@ -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

View file

@ -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

View file

@ -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.<br /><br />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.<br /><br />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",