Skip to content

Commit 1039c86

Browse files
committed
Add translation for adding artist to queue
1 parent 4735588 commit 1039c86

2 files changed

Lines changed: 20 additions & 8 deletions

File tree

lib/l10n/app_en.arb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,6 +1251,12 @@
12511251
"artistDataNotFound": "Artist not found",
12521252
"@artistDataNotFound": { "description": "Error state on the artist screen when artist data fails to load" },
12531253

1254+
"addedArtistToQueue": "Added artist to Queue",
1255+
"@addedArtistToQueue": { "description": "Snackbar when user adds artist to queue" },
1256+
1257+
"addedArtistToQueueError": "Failed adding artist to Queue",
1258+
"@addedArtistToQueueError": { "description": "Error shown in snackbar when adding artist to queue fails" },
1259+
12541260
"@_CAST_DLNA": {},
12551261
"casting": "Casting",
12561262
"@casting": { "description": "Title shown in the Chromecast control dialog when actively casting" },

lib/screens/artist_screen.dart

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ class _ArtistScreenState extends State<ArtistScreen> {
8080
final playerProvider = Provider.of<PlayerProvider>(context, listen: false);
8181
final libraryProvider = Provider.of<LibraryProvider>(context, listen: false);
8282
final subsonicService = libraryProvider.subsonicService;
83+
8384
final messenger = ScaffoldMessenger.of(context);
85+
final loc = AppLocalizations.of(context);
8486

8587
try {
8688
final songsToQueue = <Song>[];
@@ -97,19 +99,23 @@ class _ArtistScreenState extends State<ArtistScreen> {
9799
if (songsToQueue.isNotEmpty) {
98100
playerProvider.addAllToQueue(songsToQueue);
99101
}
100-
// Show snackbar on success?
101102

102-
// messenger.showSnackBar(
103-
// SnackBar(
104-
// content: Text(AppLocalizations.of(context)!.addToQueue),
105-
// duration: const Duration(seconds: 2),
106-
// ),
107-
// );
103+
if (!mounted) return;
104+
105+
final addedToQueueMessage = loc?.addedArtistToQueue ?? 'Added artist to Queue';
106+
messenger.showSnackBar(
107+
SnackBar(
108+
content: Text(addedToQueueMessage),
109+
duration: const Duration(seconds: 2),
110+
),
111+
);
108112
} catch (e) {
109113
if (!mounted) return;
114+
115+
final addedToQueueErrorMessage = loc?.addedArtistToQueueError ?? 'Failed adding artist to Queue';
110116
messenger.showSnackBar(
111117
SnackBar(
112-
content: Text('Error adding to queue: $e'), //Add localization for this error msg?
118+
content: Text(addedToQueueErrorMessage),
113119
duration: const Duration(seconds: 2),
114120
),
115121
);

0 commit comments

Comments
 (0)