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:
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 { openUrl } from '@tauri-apps/plugin-opener';
|
||||
import { showToast } from '$lib/stores/toastStore';
|
||||
import { t } from '$lib/i18n';
|
||||
|
||||
interface LocalTrack {
|
||||
id: number;
|
||||
@@ -153,7 +154,7 @@
|
||||
// Remote metadata functions
|
||||
async function searchRemoteMetadata() {
|
||||
if (!albumTitle.trim() && !albumArtist.trim()) {
|
||||
showToast('Enter album title or artist to search', 'error');
|
||||
showToast($t('toast.enterSearchTerms'), 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -173,7 +174,7 @@
|
||||
showRemotePanel = results.length > 0;
|
||||
} catch (err) {
|
||||
console.error('Remote search failed:', err);
|
||||
showToast(`Search failed: ${err}`, 'error');
|
||||
showToast($t('toast.searchFailed', { error: String(err) }), 'error');
|
||||
hasSearched = true;
|
||||
} finally {
|
||||
remoteSearching = false;
|
||||
@@ -224,7 +225,7 @@
|
||||
'warning'
|
||||
);
|
||||
} else {
|
||||
showToast(`Applied metadata from ${providerName}`, 'success');
|
||||
showToast($t('toast.appliedMetadata', { provider: providerName }), 'success');
|
||||
}
|
||||
showRemotePanel = false;
|
||||
} catch (err) {
|
||||
@@ -232,9 +233,9 @@
|
||||
// Check for rate limiting
|
||||
const errStr = String(err);
|
||||
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 {
|
||||
showToast(`Failed to fetch metadata: ${err}`, 'error');
|
||||
showToast($t('toast.failedFetchMetadata', { error: String(err) }), 'error');
|
||||
}
|
||||
} finally {
|
||||
remoteLoading = false;
|
||||
@@ -256,7 +257,7 @@
|
||||
await openUrl(url);
|
||||
} catch (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 });
|
||||
}
|
||||
showToast('Album metadata saved', 'success');
|
||||
showToast($t('toast.albumMetadataSaved'), 'success');
|
||||
await onSaved();
|
||||
onClose();
|
||||
} catch (err) {
|
||||
|
||||
@@ -155,12 +155,12 @@
|
||||
|
||||
onSuccess?.(result);
|
||||
if (result.matched_tracks > 0) {
|
||||
showToast('Playlist imported', 'success');
|
||||
showToast($t('toast.playlistImported'), 'success');
|
||||
}
|
||||
} catch (err) {
|
||||
error = String(err);
|
||||
pushLog(`Import failed: ${error}`, 'error');
|
||||
showToast('Playlist import failed', 'error');
|
||||
showToast($t('toast.playlistImportFailed'), 'error');
|
||||
} finally {
|
||||
loading = false;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
import { logPlaylistAdd } from '$lib/services/recoService';
|
||||
import { subscribe as subscribeOffline, getStatus, createPendingPlaylist } from '$lib/stores/offlineStore';
|
||||
import { showToast } from '$lib/stores/toastStore';
|
||||
import { t } from '$lib/i18n';
|
||||
import {
|
||||
subscribe as subscribeFolders,
|
||||
getVisibleFolders,
|
||||
@@ -241,7 +242,7 @@
|
||||
[], // No Qobuz 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
|
||||
const tempPlaylist: Playlist = {
|
||||
id: -pendingId, // Negative ID to distinguish from real playlists
|
||||
@@ -429,7 +430,7 @@
|
||||
qobuzTrackIds,
|
||||
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
|
||||
const tempPlaylist: Playlist = {
|
||||
|
||||
@@ -1357,19 +1357,19 @@
|
||||
|
||||
if (result.removed > 0) {
|
||||
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
|
||||
cleanupStatus = 'Refreshing library...';
|
||||
await loadAlbums();
|
||||
await loadArtists();
|
||||
} else {
|
||||
cleanupStatus = `Checked ${result.checked} tracks - all OK`;
|
||||
showToast('No missing files found', 'info');
|
||||
showToast($t('toast.noMissingFilesFound'), 'info');
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Failed to cleanup missing files:', err);
|
||||
cleanupStatus = 'Error during cleanup';
|
||||
showToast('Failed to cleanup missing files', 'error');
|
||||
showToast($t('toast.failedCleanupMissing'), 'error');
|
||||
} finally {
|
||||
cleaningUpMissingFiles = false;
|
||||
// Clear status after a delay
|
||||
@@ -1761,7 +1761,7 @@
|
||||
refreshingAlbumMetadata = true;
|
||||
albumMetadataRefreshed = false;
|
||||
await invoke('library_refresh_album_metadata_from_files', { albumGroupKey: selectedAlbum.id });
|
||||
showToast('Metadata refreshed from files', 'success');
|
||||
showToast($t('toast.metadataRefreshed'), 'success');
|
||||
albumMetadataRefreshed = true;
|
||||
await handleTagEditorSaved();
|
||||
} catch (err) {
|
||||
|
||||
@@ -1595,7 +1595,7 @@
|
||||
showToast($t('settings.appearance.tray.enableTrayDesc'), 'info');
|
||||
} catch (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;
|
||||
} catch (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;
|
||||
} catch (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');
|
||||
} catch (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');
|
||||
} catch (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();
|
||||
} catch (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 {
|
||||
isRepairingDownloads = false;
|
||||
}
|
||||
@@ -1705,7 +1705,7 @@
|
||||
await invoke('open_offline_cache_folder');
|
||||
} catch (err) {
|
||||
console.error('Failed to open cache folder:', err);
|
||||
showToast('Failed to open cache folder', 'error');
|
||||
showToast($t('toast.failedOpenCacheFolder'), 'error');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user