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

@@ -280,6 +280,27 @@
"export": "Export Recipe", "export": "Export Recipe",
"delete": "Delete Recipe" "delete": "Delete Recipe"
} }
},
"contextMenu": {
"copyRecipe": {
"missingId": "Cannot copy recipe: Missing recipe ID",
"failed": "Failed to copy recipe syntax"
},
"sendRecipe": {
"missingId": "Cannot send recipe: Missing recipe ID",
"failed": "Failed to send recipe to workflow"
},
"viewLoras": {
"missingId": "Cannot view LoRAs: Missing recipe ID",
"noLorasFound": "No LoRAs found in this recipe",
"loadError": "Error loading recipe LoRAs: {message}"
},
"downloadMissing": {
"missingId": "Cannot download LoRAs: Missing recipe ID",
"noMissingLoras": "No missing LoRAs to download",
"getInfoFailed": "Failed to get information for missing LoRAs",
"prepareError": "Error preparing LoRAs for download: {message}"
}
} }
}, },
"checkpoints": { "checkpoints": {
@@ -563,6 +584,17 @@
} }
} }
}, },
"modelTags": {
"messages": {
"updated": "Tags updated successfully",
"updateFailed": "Failed to update tags"
},
"validation": {
"maxLength": "Tag should not exceed 30 characters",
"maxCount": "Maximum 30 tags allowed",
"duplicate": "This tag already exists"
}
},
"errors": { "errors": {
"general": "An error occurred", "general": "An error occurred",
"networkError": "Network error. Please check your connection.", "networkError": "Network error. Please check your connection.",
@@ -663,6 +695,11 @@
"finalizing": "Finalizing..." "finalizing": "Finalizing..."
} }
}, },
"showcase": {
"exampleImages": {
"deleteFailed": "Failed to delete example image: {error}"
}
},
"duplicates": { "duplicates": {
"found": "Found {count} duplicate groups", "found": "Found {count} duplicate groups",
"showNotification": "Show Duplicates Notification", "showNotification": "Show Duplicates Notification",
@@ -868,7 +905,7 @@
"cacheClearError": "Error clearing cache: {message}" "cacheClearError": "Error clearing cache: {message}"
}, },
"filters": { "filters": {
"applied": "Filters applied - showing {count} {type}", "applied": "{message}",
"cleared": "Filters cleared" "cleared": "Filters cleared"
}, },
"downloads": { "downloads": {
@@ -884,7 +921,9 @@
"resumed": "Download resumed", "resumed": "Download resumed",
"resumeFailed": "Failed to resume download", "resumeFailed": "Failed to resume download",
"imagesCompleted": "Example images {action} completed", "imagesCompleted": "Example images {action} completed",
"imagesFailed": "Example images {action} failed" "imagesFailed": "Example images {action} failed",
"loadError": "Error loading downloads: {message}",
"downloadError": "Download error: {message}"
}, },
"import": { "import": {
"enterRecipeName": "Please enter a recipe name", "enterRecipeName": "Please enter a recipe name",
@@ -892,7 +931,10 @@
"folderTreeFailed": "Failed to load folder tree", "folderTreeFailed": "Failed to load folder tree",
"folderTreeError": "Error loading folder tree", "folderTreeError": "Error loading folder tree",
"imagesImported": "Example images imported successfully", "imagesImported": "Example images imported successfully",
"importFailed": "Failed to import example images: {message}" "importFailed": "Failed to import example images: {message}",
"recipeSaveFailed": "Failed to save recipe: {error}",
"processingError": "Processing error: {message}",
"folderBrowserError": "Folder browser error: {message}"
}, },
"triggerWords": { "triggerWords": {
"loadFailed": "Could not load trained words", "loadFailed": "Could not load trained words",
@@ -939,11 +981,11 @@
"downloadInProgress": "Download already in progress", "downloadInProgress": "Download already in progress",
"enterLocationFirst": "Please enter a download location first", "enterLocationFirst": "Please enter a download location first",
"downloadStarted": "Example images download started", "downloadStarted": "Example images download started",
"downloadStartFailed": "Failed to start download", "downloadStartFailed": "Failed to start download: {error}",
"downloadPaused": "Download paused", "downloadPaused": "Download paused",
"pauseFailed": "Failed to pause download", "pauseFailed": "Failed to pause download: {error}",
"downloadResumed": "Download resumed", "downloadResumed": "Download resumed",
"resumeFailed": "Failed to resume download", "resumeFailed": "Failed to resume download: {error}",
"deleted": "Example image deleted", "deleted": "Example image deleted",
"deleteFailed": "Failed to delete example image", "deleteFailed": "Failed to delete example image",
"setPreviewFailed": "Failed to set preview image" "setPreviewFailed": "Failed to set preview image"
@@ -961,8 +1003,14 @@
"previewUploadFailed": "Failed to upload preview image", "previewUploadFailed": "Failed to upload preview image",
"refreshComplete": "{action} complete", "refreshComplete": "{action} complete",
"refreshFailed": "Failed to {action} {type}s", "refreshFailed": "Failed to {action} {type}s",
"metadataRefreshed": "Metadata refreshed successfully",
"metadataRefreshFailed": "Failed to refresh metadata: {message}",
"metadataUpdateComplete": "Metadata update complete", "metadataUpdateComplete": "Metadata update complete",
"metadataFetchFailed": "Failed to fetch metadata: {message}", "metadataFetchFailed": "Failed to fetch metadata: {message}",
"bulkMetadataCompleteAll": "Successfully refreshed all {count} {type}s",
"bulkMetadataCompletePartial": "Refreshed {success} of {total} {type}s",
"bulkMetadataCompleteNone": "Failed to refresh metadata for any {type}s",
"bulkMetadataFailureDetails": "Failed refreshes:\n{failures}",
"bulkMetadataFailed": "Failed to refresh metadata: {message}", "bulkMetadataFailed": "Failed to refresh metadata: {message}",
"moveNotSupported": "Moving {type}s is not supported", "moveNotSupported": "Moving {type}s is not supported",
"alreadyInFolder": "{type} is already in the selected folder", "alreadyInFolder": "{type} is already in the selected folder",

View File

@@ -280,6 +280,27 @@
"export": "导出配方", "export": "导出配方",
"delete": "删除配方" "delete": "删除配方"
} }
},
"contextMenu": {
"copyRecipe": {
"missingId": "无法复制配方:缺少配方 ID",
"failed": "复制配方语法失败"
},
"sendRecipe": {
"missingId": "无法发送配方:缺少配方 ID",
"failed": "发送配方到工作流失败"
},
"viewLoras": {
"missingId": "无法查看 LoRA缺少配方 ID",
"noLorasFound": "在此配方中未找到 LoRA",
"loadError": "加载配方 LoRA 错误:{message}"
},
"downloadMissing": {
"missingId": "无法下载 LoRA缺少配方 ID",
"noMissingLoras": "没有缺失的 LoRA 需要下载",
"getInfoFailed": "获取缺失 LoRA 信息失败",
"prepareError": "准备下载 LoRA 时出错:{message}"
}
} }
}, },
"checkpoints": { "checkpoints": {
@@ -563,6 +584,22 @@
} }
} }
}, },
"showcase": {
"exampleImages": {
"deleteFailed": "删除示例图片失败:{error}"
}
},
"modelTags": {
"messages": {
"updated": "标签更新成功",
"updateFailed": "更新标签失败"
},
"validation": {
"maxLength": "标签长度不应超过 30 个字符",
"maxCount": "最多允许 30 个标签",
"duplicate": "此标签已存在"
}
},
"errors": { "errors": {
"general": "发生错误", "general": "发生错误",
"networkError": "网络错误,请检查您的连接。", "networkError": "网络错误,请检查您的连接。",
@@ -899,8 +936,14 @@
"previewUploadFailed": "上传预览图失败", "previewUploadFailed": "上传预览图失败",
"refreshComplete": "{action} 完成", "refreshComplete": "{action} 完成",
"refreshFailed": "{action} {type} 失败", "refreshFailed": "{action} {type} 失败",
"metadataRefreshed": "元数据刷新成功",
"metadataRefreshFailed": "刷新元数据失败:{message}",
"metadataUpdateComplete": "元数据更新完成", "metadataUpdateComplete": "元数据更新完成",
"metadataFetchFailed": "获取元数据失败:{message}", "metadataFetchFailed": "获取元数据失败:{message}",
"bulkMetadataCompleteAll": "成功刷新了所有 {count} 个 {type}",
"bulkMetadataCompletePartial": "已刷新 {success} / {total} 个 {type}",
"bulkMetadataCompleteNone": "刷新任何 {type} 的元数据都失败了",
"bulkMetadataFailureDetails": "刷新失败:\n{failures}",
"bulkMetadataFailed": "刷新元数据失败:{message}", "bulkMetadataFailed": "刷新元数据失败:{message}",
"moveNotSupported": "不支持移动 {type}", "moveNotSupported": "不支持移动 {type}",
"alreadyInFolder": "{type} 已在所选文件夹中", "alreadyInFolder": "{type} 已在所选文件夹中",

View File

@@ -1,5 +1,6 @@
import { state, getCurrentPageState } from '../state/index.js'; import { state, getCurrentPageState } from '../state/index.js';
import { showToast } from '../utils/uiHelpers.js'; import { showToast } from '../utils/uiHelpers.js';
import { translate } from '../utils/i18n.js';
import { getStorageItem, getSessionItem, saveMapToStorage } from '../utils/storageHelpers.js'; import { getStorageItem, getSessionItem, saveMapToStorage } from '../utils/storageHelpers.js';
import { import {
getCompleteApiConfig, getCompleteApiConfig,
@@ -503,22 +504,22 @@ export class BaseModelApiClient {
let completionMessage; let completionMessage;
if (successCount === totalItems) { if (successCount === totalItems) {
completionMessage = `Successfully refreshed all ${successCount} ${this.apiConfig.config.displayName}s`; completionMessage = translate('toast.api.bulkMetadataCompleteAll', { count: successCount, type: this.apiConfig.config.displayName }, `Successfully refreshed all ${successCount} ${this.apiConfig.config.displayName}s`);
showToast(completionMessage, 'success'); showToast('toast.api.bulkMetadataCompleteAll', { count: successCount, type: this.apiConfig.config.displayName }, 'success');
} else if (successCount > 0) { } else if (successCount > 0) {
completionMessage = `Refreshed ${successCount} of ${totalItems} ${this.apiConfig.config.displayName}s`; completionMessage = translate('toast.api.bulkMetadataCompletePartial', { success: successCount, total: totalItems, type: this.apiConfig.config.displayName }, `Refreshed ${successCount} of ${totalItems} ${this.apiConfig.config.displayName}s`);
showToast(completionMessage, 'warning'); showToast('toast.api.bulkMetadataCompletePartial', { success: successCount, total: totalItems, type: this.apiConfig.config.displayName }, 'warning');
if (failedItems.length > 0) { if (failedItems.length > 0) {
const failureMessage = failedItems.length <= 3 const failureMessage = failedItems.length <= 3
? failedItems.map(item => `${item.fileName}: ${item.error}`).join('\n') ? failedItems.map(item => `${item.fileName}: ${item.error}`).join('\n')
: failedItems.slice(0, 3).map(item => `${item.fileName}: ${item.error}`).join('\n') + : failedItems.slice(0, 3).map(item => `${item.fileName}: ${item.error}`).join('\n') +
`\n(and ${failedItems.length - 3} more)`; `\n(and ${failedItems.length - 3} more)`;
showToast(`Failed refreshes:\n${failureMessage}`, 'warning', 6000); showToast('toast.api.bulkMetadataFailureDetails', { failures: failureMessage }, 'warning', 6000);
} }
} else { } else {
completionMessage = `Failed to refresh metadata for any ${this.apiConfig.config.displayName}s`; completionMessage = translate('toast.api.bulkMetadataCompleteNone', { type: this.apiConfig.config.displayName }, `Failed to refresh metadata for any ${this.apiConfig.config.displayName}s`);
showToast(completionMessage, 'error'); showToast('toast.api.bulkMetadataCompleteNone', { type: this.apiConfig.config.displayName }, 'error');
} }
await progressController.complete(completionMessage); await progressController.complete(completionMessage);

View File

@@ -99,7 +99,7 @@ export class RecipeContextMenu extends BaseContextMenu {
copyRecipeSyntax() { copyRecipeSyntax() {
const recipeId = this.currentCard.dataset.id; const recipeId = this.currentCard.dataset.id;
if (!recipeId) { if (!recipeId) {
showToast('Cannot copy recipe: Missing recipe ID', 'error'); showToast('recipes.contextMenu.copyRecipe.missingId', {}, 'error');
return; return;
} }
@@ -114,7 +114,7 @@ export class RecipeContextMenu extends BaseContextMenu {
}) })
.catch(err => { .catch(err => {
console.error('Failed to copy recipe syntax: ', err); console.error('Failed to copy recipe syntax: ', err);
showToast('Failed to copy recipe syntax', 'error'); showToast('recipes.contextMenu.copyRecipe.failed', {}, 'error');
}); });
} }
@@ -122,7 +122,7 @@ export class RecipeContextMenu extends BaseContextMenu {
sendRecipeToWorkflow(replaceMode) { sendRecipeToWorkflow(replaceMode) {
const recipeId = this.currentCard.dataset.id; const recipeId = this.currentCard.dataset.id;
if (!recipeId) { if (!recipeId) {
showToast('Cannot send recipe: Missing recipe ID', 'error'); showToast('recipes.contextMenu.sendRecipe.missingId', {}, 'error');
return; return;
} }
@@ -137,14 +137,14 @@ export class RecipeContextMenu extends BaseContextMenu {
}) })
.catch(err => { .catch(err => {
console.error('Failed to send recipe to workflow: ', err); console.error('Failed to send recipe to workflow: ', err);
showToast('Failed to send recipe to workflow', 'error'); showToast('recipes.contextMenu.sendRecipe.failed', {}, 'error');
}); });
} }
// View all LoRAs in the recipe // View all LoRAs in the recipe
viewRecipeLoRAs(recipeId) { viewRecipeLoRAs(recipeId) {
if (!recipeId) { if (!recipeId) {
showToast('Cannot view LoRAs: Missing recipe ID', 'error'); showToast('recipes.contextMenu.viewLoras.missingId', {}, 'error');
return; return;
} }
@@ -171,19 +171,19 @@ export class RecipeContextMenu extends BaseContextMenu {
// Navigate to the LoRAs page // Navigate to the LoRAs page
window.location.href = '/loras'; window.location.href = '/loras';
} else { } else {
showToast('No LoRAs found in this recipe', 'info'); showToast('recipes.contextMenu.viewLoras.noLorasFound', {}, 'info');
} }
}) })
.catch(error => { .catch(error => {
console.error('Error loading recipe LoRAs:', error); console.error('Error loading recipe LoRAs:', error);
showToast('Error loading recipe LoRAs: ' + error.message, 'error'); showToast('recipes.contextMenu.viewLoras.loadError', { message: error.message }, 'error');
}); });
} }
// Download missing LoRAs // Download missing LoRAs
async downloadMissingLoRAs(recipeId) { async downloadMissingLoRAs(recipeId) {
if (!recipeId) { if (!recipeId) {
showToast('Cannot download LoRAs: Missing recipe ID', 'error'); showToast('recipes.contextMenu.downloadMissing.missingId', {}, 'error');
return; return;
} }
@@ -196,7 +196,7 @@ export class RecipeContextMenu extends BaseContextMenu {
const missingLoras = recipe.loras.filter(lora => !lora.inLibrary && !lora.isDeleted); const missingLoras = recipe.loras.filter(lora => !lora.inLibrary && !lora.isDeleted);
if (missingLoras.length === 0) { if (missingLoras.length === 0) {
showToast('No missing LoRAs to download', 'info'); showToast('recipes.contextMenu.downloadMissing.noMissingLoras', {}, 'info');
return; return;
} }
@@ -234,7 +234,7 @@ export class RecipeContextMenu extends BaseContextMenu {
const validLoras = lorasWithVersionInfo.filter(lora => lora !== null); const validLoras = lorasWithVersionInfo.filter(lora => lora !== null);
if (validLoras.length === 0) { if (validLoras.length === 0) {
showToast('Failed to get information for missing LoRAs', 'error'); showToast('recipes.contextMenu.downloadMissing.getInfoFailed', {}, 'error');
return; return;
} }
@@ -275,7 +275,7 @@ export class RecipeContextMenu extends BaseContextMenu {
window.importManager.downloadMissingLoras(recipeData, recipeId); window.importManager.downloadMissingLoras(recipeData, recipeId);
} catch (error) { } catch (error) {
console.error('Error downloading missing LoRAs:', error); console.error('Error downloading missing LoRAs:', error);
showToast('Error preparing LoRAs for download: ' + error.message, 'error'); showToast('recipes.contextMenu.downloadMissing.prepareError', { message: error.message }, 'error');
} finally { } finally {
if (state.loadingManager) { if (state.loadingManager) {
state.loadingManager.hide(); state.loadingManager.hide();

View File

@@ -143,16 +143,13 @@ async function toggleFavorite(card) {
}); });
if (newFavoriteState) { if (newFavoriteState) {
const addedText = translate('modelCard.favorites.added', {}, 'Added to favorites'); showToast('modelCard.favorites.added', {}, 'success');
showToast(addedText, 'success');
} else { } else {
const removedText = translate('modelCard.favorites.removed', {}, 'Removed from favorites'); showToast('modelCard.favorites.removed', {}, 'success');
showToast(removedText, 'success');
} }
} catch (error) { } catch (error) {
console.error('Failed to update favorite status:', error); console.error('Failed to update favorite status:', error);
const errorText = translate('modelCard.favorites.updateFailed', {}, 'Failed to update favorite status'); showToast('modelCard.favorites.updateFailed', {}, 'error');
showToast(errorText, 'error');
} }
} }
@@ -164,8 +161,7 @@ function handleSendToWorkflow(card, replaceMode, modelType) {
sendLoraToWorkflow(loraSyntax, replaceMode, 'lora'); sendLoraToWorkflow(loraSyntax, replaceMode, 'lora');
} else { } else {
// Checkpoint send functionality - to be implemented // Checkpoint send functionality - to be implemented
const text = translate('modelCard.sendToWorkflow.checkpointNotImplemented', {}, 'Send checkpoint to workflow - feature to be implemented'); showToast('modelCard.sendToWorkflow.checkpointNotImplemented', {}, 'info');
showToast(text, 'info');
} }
} }
@@ -201,8 +197,7 @@ async function handleExampleImagesAccess(card, modelType) {
} }
} catch (error) { } catch (error) {
console.error('Error checking for example images:', error); console.error('Error checking for example images:', error);
const text = translate('modelCard.exampleImages.checkError', {}, 'Error checking for example images'); showToast('modelCard.exampleImages.checkError', {}, 'error');
showToast(text, 'error');
} }
} }
@@ -284,8 +279,7 @@ function showExampleAccessModal(card, modelType) {
// Get the model hash // Get the model hash
const modelHash = card.dataset.sha256; const modelHash = card.dataset.sha256;
if (!modelHash) { if (!modelHash) {
const text = translate('modelCard.exampleImages.missingHash', {}, 'Missing model hash information.'); showToast('modelCard.exampleImages.missingHash', {}, 'error');
showToast(text, 'error');
return; return;
} }

View File

@@ -154,8 +154,7 @@ export async function setupModelDescriptionEditing(filePath) {
} }
if (!newValue) { if (!newValue) {
this.innerHTML = originalValue; this.innerHTML = originalValue;
const emptyErrorText = translate('modals.model.description.validation.cannotBeEmpty', {}, 'Description cannot be empty'); showToast('modals.model.description.validation.cannotBeEmpty', {}, 'error');
showToast(emptyErrorText, 'error');
exitEditMode(); exitEditMode();
return; return;
} }
@@ -163,12 +162,10 @@ export async function setupModelDescriptionEditing(filePath) {
// Save to backend // Save to backend
const { getModelApiClient } = await import('../../api/modelApiFactory.js'); const { getModelApiClient } = await import('../../api/modelApiFactory.js');
await getModelApiClient().saveModelMetadata(filePath, { modelDescription: newValue }); await getModelApiClient().saveModelMetadata(filePath, { modelDescription: newValue });
const successText = translate('modals.model.description.messages.updated', {}, 'Model description updated'); showToast('modals.model.description.messages.updated', {}, 'success');
showToast(successText, 'success');
} catch (err) { } catch (err) {
this.innerHTML = originalValue; this.innerHTML = originalValue;
const errorText = translate('modals.model.description.messages.updateFailed', {}, 'Failed to update model description'); showToast('modals.model.description.messages.updateFailed', {}, 'error');
showToast(errorText, 'error');
} finally { } finally {
exitEditMode(); exitEditMode();
} }

View File

@@ -438,11 +438,9 @@ async function saveNotes(filePath) {
try { try {
await getModelApiClient().saveModelMetadata(filePath, { notes: content }); await getModelApiClient().saveModelMetadata(filePath, { notes: content });
const successMessage = translate('modals.model.notes.saved', {}, 'Notes saved successfully'); showToast('modals.model.notes.saved', {}, 'success');
showToast(successMessage, 'success');
} catch (error) { } catch (error) {
const errorMessage = translate('modals.model.notes.saveFailed', {}, 'Failed to save notes'); showToast('modals.model.notes.saveFailed', {}, 'error');
showToast(errorMessage, 'error');
} }
} }

View File

@@ -217,10 +217,10 @@ async function saveTags() {
// Exit edit mode // Exit edit mode
editBtn.click(); editBtn.click();
showToast(translate('modelTags.messages.updated', {}, 'Tags updated successfully'), 'success'); showToast('modelTags.messages.updated', {}, 'success');
} catch (error) { } catch (error) {
console.error('Error saving tags:', error); console.error('Error saving tags:', error);
showToast(translate('modelTags.messages.updateFailed', {}, 'Failed to update tags'), 'error'); showToast('modelTags.messages.updateFailed', {}, 'error');
} }
} }
@@ -362,24 +362,21 @@ function addNewTag(tag) {
// Validation: Check length // Validation: Check length
if (tag.length > 30) { if (tag.length > 30) {
const text = translate('modelTags.validation.maxLength', {}, 'Tag should not exceed 30 characters'); showToast('modelTags.validation.maxLength', {}, 'error');
showToast(text, 'error');
return; return;
} }
// Validation: Check total number // Validation: Check total number
const currentTags = tagsContainer.querySelectorAll('.metadata-item'); const currentTags = tagsContainer.querySelectorAll('.metadata-item');
if (currentTags.length >= 30) { if (currentTags.length >= 30) {
const text = translate('modelTags.validation.maxCount', {}, 'Maximum 30 tags allowed'); showToast('modelTags.validation.maxCount', {}, 'error');
showToast(text, 'error');
return; return;
} }
// Validation: Check for duplicates // Validation: Check for duplicates
const existingTags = Array.from(currentTags).map(tag => tag.dataset.tag); const existingTags = Array.from(currentTags).map(tag => tag.dataset.tag);
if (existingTags.includes(tag)) { if (existingTags.includes(tag)) {
const text = translate('modelTags.validation.duplicate', {}, 'This tag already exists'); showToast('modelTags.validation.duplicate', {}, 'error');
showToast(text, 'error');
return; return;
} }

View File

@@ -445,7 +445,7 @@ export function initMediaControlHandlers(container) {
state.virtualScroller.updateSingleItem(result.model_file_path, updateData); state.virtualScroller.updateSingleItem(result.model_file_path, updateData);
} else { } else {
// Show error message // Show error message
showToast(result.error || 'Failed to delete example image', 'error'); showToast('showcase.exampleImages.deleteFailed', { error: result.error }, 'error');
// Reset button state // Reset button state
this.disabled = false; this.disabled = false;

View File

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

View File

@@ -285,7 +285,7 @@ class ExampleImagesManager {
// Close settings modal // Close settings modal
modalManager.closeModal('settingsModal'); modalManager.closeModal('settingsModal');
} else { } else {
showToast(data.error || 'Failed to start download', 'error'); showToast('exampleImages.downloadStartFailed', { error: data.error }, 'error');
} }
} catch (error) { } catch (error) {
console.error('Failed to start download:', error); console.error('Failed to start download:', error);
@@ -321,7 +321,7 @@ class ExampleImagesManager {
this.updateDownloadButtonText(); this.updateDownloadButtonText();
showToast('toast.exampleImages.downloadPaused', {}, 'info'); showToast('toast.exampleImages.downloadPaused', {}, 'info');
} else { } else {
showToast(data.error || 'Failed to pause download', 'error'); showToast('exampleImages.pauseFailed', { error: data.error }, 'error');
} }
} catch (error) { } catch (error) {
console.error('Failed to pause download:', error); console.error('Failed to pause download:', error);
@@ -357,7 +357,7 @@ class ExampleImagesManager {
this.updateDownloadButtonText(); this.updateDownloadButtonText();
showToast('toast.exampleImages.downloadResumed', {}, 'success'); showToast('toast.exampleImages.downloadResumed', {}, 'success');
} else { } else {
showToast(data.error || 'Failed to resume download', 'error'); showToast('exampleImages.resumeFailed', { error: data.error }, 'error');
} }
} catch (error) { } catch (error) {
console.error('Failed to resume download:', 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' : ''}`; message = `Filtering by ${tagsCount} tag${tagsCount > 1 ? 's' : ''}`;
} }
showToast(message, 'success'); showToast('filters.applied', { message }, 'success');
} }
} else { } else {
this.filterButton.classList.remove('active'); this.filterButton.classList.remove('active');

View File

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

View File

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