feat(localization): enhance toast messages for context menu actions, model tags, and download management with improved error handling and user feedback

This commit is contained in:
Will Miao
2025-08-31 14:27:33 +08:00
parent 987b8c8742
commit 8303196b57
14 changed files with 142 additions and 64 deletions

View File

@@ -343,7 +343,7 @@ export class DownloadManager {
this.updateTargetPath();
} catch (error) {
showToast(error.message, 'error');
showToast('downloads.loadError', { message: error.message }, 'error');
}
}
@@ -507,7 +507,7 @@ export class DownloadManager {
await resetAndReload(true);
} catch (error) {
showToast(error.message, 'error');
showToast('downloads.downloadError', { message: error.message }, 'error');
} finally {
this.loadingManager.hide();
}

View File

@@ -285,7 +285,7 @@ class ExampleImagesManager {
// Close settings modal
modalManager.closeModal('settingsModal');
} else {
showToast(data.error || 'Failed to start download', 'error');
showToast('exampleImages.downloadStartFailed', { error: data.error }, 'error');
}
} catch (error) {
console.error('Failed to start download:', error);
@@ -321,7 +321,7 @@ class ExampleImagesManager {
this.updateDownloadButtonText();
showToast('toast.exampleImages.downloadPaused', {}, 'info');
} else {
showToast(data.error || 'Failed to pause download', 'error');
showToast('exampleImages.pauseFailed', { error: data.error }, 'error');
}
} catch (error) {
console.error('Failed to pause download:', error);
@@ -357,7 +357,7 @@ class ExampleImagesManager {
this.updateDownloadButtonText();
showToast('toast.exampleImages.downloadResumed', {}, 'success');
} else {
showToast(data.error || 'Failed to resume download', 'error');
showToast('exampleImages.resumeFailed', { error: data.error }, 'error');
}
} catch (error) {
console.error('Failed to resume download:', error);

View File

@@ -282,7 +282,7 @@ export class FilterManager {
message = `Filtering by ${tagsCount} tag${tagsCount > 1 ? 's' : ''}`;
}
showToast(message, 'success');
showToast('filters.applied', { message }, 'success');
}
} else {
this.filterButton.classList.remove('active');

View File

@@ -77,7 +77,7 @@ export class DownloadManager {
if (!result.success) {
// Handle save error
console.error("Failed to save recipe:", result.error);
showToast(result.error, 'error');
showToast('import.recipeSaveFailed', { error: result.error }, 'error');
// Close modal
modalManager.closeModal('importModal');
return;
@@ -107,7 +107,7 @@ export class DownloadManager {
} catch (error) {
console.error('Error:', error);
showToast(error.message, 'error');
showToast('import.processingError', { message: error.message }, 'error');
} finally {
this.importManager.loadingManager.hide();
}

View File

@@ -136,7 +136,7 @@ export class FolderBrowser {
this.initializeFolderBrowser();
} catch (error) {
console.error('Error in API calls:', error);
showToast(error.message, 'error');
showToast('import.folderBrowserError', { message: error.message }, 'error');
}
}