i18n: Update toast messages in remaining components

- Update LocalLibraryTagEditorModal to use toast translations
- Update PlaylistImportModal to use toast translations
- Update PlaylistModal to use toast translations
- Update LocalLibraryView to use toast translations
- Update SettingsView to use toast translations for error messages
This commit is contained in:
vicrodh committed 2026-02-02 15:48:05 -06:00
1 parent 2dc9989d22
commit aa98b4d411
5 files changed
+24 -22

No files matched your search

@@ -5,6 +5,7 @@
import { ask } from '@tauri-apps/plugin-dialog'; import { ask } from '@tauri-apps/plugin-dialog';
import { openUrl } from '@tauri-apps/plugin-opener'; import { openUrl } from '@tauri-apps/plugin-opener';
import { showToast } from '$lib/stores/toastStore'; import { showToast } from '$lib/stores/toastStore';
import { t } from '$lib/i18n';
interface LocalTrack { interface LocalTrack {
id: number; id: number;
@@ -153,7 +154,7 @@
// Remote metadata functions // Remote metadata functions
async function searchRemoteMetadata() { async function searchRemoteMetadata() {
if (!albumTitle.trim() && !albumArtist.trim()) { if (!albumTitle.trim() && !albumArtist.trim()) {
showToast('Enter album title or artist to search', 'error'); showToast($t('toast.enterSearchTerms'), 'error');
return; return;
} }
@@ -173,7 +174,7 @@
showRemotePanel = results.length > 0; showRemotePanel = results.length > 0;
} catch (err) { } catch (err) {
console.error('Remote search failed:', err); console.error('Remote search failed:', err);
showToast(`Search failed: ${err}`, 'error'); showToast($t('toast.searchFailed', { error: String(err) }), 'error');
hasSearched = true; hasSearched = true;
} finally { } finally {
remoteSearching = false; remoteSearching = false;
@@ -224,7 +225,7 @@
'warning' 'warning'
); );
} else { } else {
showToast(`Applied metadata from ${providerName}`, 'success'); showToast($t('toast.appliedMetadata', { provider: providerName }), 'success');
} }
showRemotePanel = false; showRemotePanel = false;
} catch (err) { } catch (err) {
@@ -232,9 +233,9 @@
// Check for rate limiting // Check for rate limiting
const errStr = String(err); const errStr = String(err);
if (errStr.includes('429') || errStr.toLowerCase().includes('rate')) { if (errStr.includes('429') || errStr.toLowerCase().includes('rate')) {
showToast('Rate limited. Please wait a moment and try again.', 'warning'); showToast($t('toast.rateLimited'), 'warning');
} else { } else {
showToast(`Failed to fetch metadata: ${err}`, 'error'); showToast($t('toast.failedFetchMetadata', { error: String(err) }), 'error');
} }
} finally { } finally {
remoteLoading = false; remoteLoading = false;
@@ -256,7 +257,7 @@
await openUrl(url); await openUrl(url);
} catch (err) { } catch (err) {
console.error('Failed to open URL:', err); console.error('Failed to open URL:', err);
showToast('Failed to open browser', 'error'); showToast($t('toast.failedOpenBrowser'), 'error');
} }
} }
@@ -360,7 +361,7 @@
}); });
await invoke('library_write_album_metadata_to_files', { request: payload }); await invoke('library_write_album_metadata_to_files', { request: payload });
} }
showToast('Album metadata saved', 'success'); showToast($t('toast.albumMetadataSaved'), 'success');
await onSaved(); await onSaved();
onClose(); onClose();
} catch (err) { } catch (err) {
@@ -155,12 +155,12 @@
onSuccess?.(result); onSuccess?.(result);
if (result.matched_tracks > 0) { if (result.matched_tracks > 0) {
showToast('Playlist imported', 'success'); showToast($t('toast.playlistImported'), 'success');
} }
} catch (err) { } catch (err) {
error = String(err); error = String(err);
pushLog(`Import failed: ${error}`, 'error'); pushLog(`Import failed: ${error}`, 'error');
showToast('Playlist import failed', 'error'); showToast($t('toast.playlistImportFailed'), 'error');
} finally { } finally {
loading = false; loading = false;
} }
+3 -2
View File
@@ -4,6 +4,7 @@
import { logPlaylistAdd } from '$lib/services/recoService'; import { logPlaylistAdd } from '$lib/services/recoService';
import { subscribe as subscribeOffline, getStatus, createPendingPlaylist } from '$lib/stores/offlineStore'; import { subscribe as subscribeOffline, getStatus, createPendingPlaylist } from '$lib/stores/offlineStore';
import { showToast } from '$lib/stores/toastStore'; import { showToast } from '$lib/stores/toastStore';
import { t } from '$lib/i18n';
import { import {
subscribe as subscribeFolders, subscribe as subscribeFolders,
getVisibleFolders, getVisibleFolders,
@@ -241,7 +242,7 @@
[], // No Qobuz tracks for empty playlist [], // No Qobuz tracks for empty playlist
[] // No local tracks for empty playlist [] // No local tracks for empty playlist
); );
showToast('Playlist created offline - will sync when back online', 'info'); showToast($t('toast.playlistCreatedOffline'), 'info');
// Create a temporary playlist object for UI // Create a temporary playlist object for UI
const tempPlaylist: Playlist = { const tempPlaylist: Playlist = {
id: -pendingId, // Negative ID to distinguish from real playlists id: -pendingId, // Negative ID to distinguish from real playlists
@@ -429,7 +430,7 @@
qobuzTrackIds, qobuzTrackIds,
localTrackPaths localTrackPaths
); );
showToast(`Playlist "${name.trim()}" created offline - will sync when back online`, 'info'); showToast($t('toast.playlistCreatedOffline'), 'info');
// Create a temporary playlist object for UI // Create a temporary playlist object for UI
const tempPlaylist: Playlist = { const tempPlaylist: Playlist = {
@@ -1357,19 +1357,19 @@
if (result.removed > 0) { if (result.removed > 0) {
cleanupStatus = `Removed ${result.removed} of ${result.checked} tracks`; cleanupStatus = `Removed ${result.removed} of ${result.checked} tracks`;
showToast(`Removed ${result.removed} tracks with missing files`, 'success'); showToast($t('toast.removedMissingFiles', { count: result.removed }), 'success');
// Reload library data // Reload library data
cleanupStatus = 'Refreshing library...'; cleanupStatus = 'Refreshing library...';
await loadAlbums(); await loadAlbums();
await loadArtists(); await loadArtists();
} else { } else {
cleanupStatus = `Checked ${result.checked} tracks - all OK`; cleanupStatus = `Checked ${result.checked} tracks - all OK`;
showToast('No missing files found', 'info'); showToast($t('toast.noMissingFilesFound'), 'info');
} }
} catch (err) { } catch (err) {
console.error('Failed to cleanup missing files:', err); console.error('Failed to cleanup missing files:', err);
cleanupStatus = 'Error during cleanup'; cleanupStatus = 'Error during cleanup';
showToast('Failed to cleanup missing files', 'error'); showToast($t('toast.failedCleanupMissing'), 'error');
} finally { } finally {
cleaningUpMissingFiles = false; cleaningUpMissingFiles = false;
// Clear status after a delay // Clear status after a delay
@@ -1761,7 +1761,7 @@
refreshingAlbumMetadata = true; refreshingAlbumMetadata = true;
albumMetadataRefreshed = false; albumMetadataRefreshed = false;
await invoke('library_refresh_album_metadata_from_files', { albumGroupKey: selectedAlbum.id }); await invoke('library_refresh_album_metadata_from_files', { albumGroupKey: selectedAlbum.id });
showToast('Metadata refreshed from files', 'success'); showToast($t('toast.metadataRefreshed'), 'success');
albumMetadataRefreshed = true; albumMetadataRefreshed = true;
await handleTagEditorSaved(); await handleTagEditorSaved();
} catch (err) { } catch (err) {
+7 -7
View File
@@ -1595,7 +1595,7 @@
showToast($t('settings.appearance.tray.enableTrayDesc'), 'info'); showToast($t('settings.appearance.tray.enableTrayDesc'), 'info');
} catch (err) { } catch (err) {
console.error('Failed to set enable tray:', err); console.error('Failed to set enable tray:', err);
showToast('Failed to save tray setting', 'error'); showToast($t('toast.failedSaveTray'), 'error');
} }
} }
@@ -1605,7 +1605,7 @@
minimizeToTray = value; minimizeToTray = value;
} catch (err) { } catch (err) {
console.error('Failed to set minimize to tray:', err); console.error('Failed to set minimize to tray:', err);
showToast('Failed to save tray setting', 'error'); showToast($t('toast.failedSaveTray'), 'error');
} }
} }
@@ -1615,7 +1615,7 @@
closeToTray = value; closeToTray = value;
} catch (err) { } catch (err) {
console.error('Failed to set close to tray:', err); console.error('Failed to set close to tray:', err);
showToast('Failed to save tray setting', 'error'); showToast($t('toast.failedSaveTray'), 'error');
} }
} }
@@ -1627,7 +1627,7 @@
console.log('[Settings] Autoplay mode saved successfully'); console.log('[Settings] Autoplay mode saved successfully');
} catch (err) { } catch (err) {
console.error('[Settings] Failed to set autoplay mode:', err); console.error('[Settings] Failed to set autoplay mode:', err);
showToast('Failed to save autoplay preference', 'error'); showToast($t('toast.failedSaveAutoplay'), 'error');
} }
} }
@@ -1639,7 +1639,7 @@
console.log('[Settings] Show context icon saved successfully'); console.log('[Settings] Show context icon saved successfully');
} catch (err) { } catch (err) {
console.error('[Settings] Failed to set show context icon:', err); console.error('[Settings] Failed to set show context icon:', err);
showToast('Failed to save icon visibility preference', 'error'); showToast($t('toast.failedSaveIconVisibility'), 'error');
} }
} }
@@ -1681,7 +1681,7 @@
notifyDownloadSettingsChanged(); notifyDownloadSettingsChanged();
} catch (err) { } catch (err) {
console.error('Failed to repair downloads:', err); console.error('Failed to repair downloads:', err);
showToast('Failed to repair offline library: ' + String(err), 'error'); showToast($t('toast.failedRepairOffline', { error: String(err) }), 'error');
} finally { } finally {
isRepairingDownloads = false; isRepairingDownloads = false;
} }
@@ -1705,7 +1705,7 @@
await invoke('open_offline_cache_folder'); await invoke('open_offline_cache_folder');
} catch (err) { } catch (err) {
console.error('Failed to open cache folder:', err); console.error('Failed to open cache folder:', err);
showToast('Failed to open cache folder', 'error'); showToast($t('toast.failedOpenCacheFolder'), 'error');
} }
} }