From 41d4c7458e62b58462b550a5368ee3d65f016116 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Sat, 18 Jun 2022 16:16:43 -0700 Subject: [PATCH] [Translations] Load PlaylistEntry error messages These error messages should be loaded from the main bundle, where the class is located. Signed-off-by: Christopher Snowhill --- Application/PlaybackController.m | 4 ++-- Playlist/PlaylistEntry.m | 2 +- Playlist/PlaylistLoader.m | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Application/PlaybackController.m b/Application/PlaybackController.m index 88c1493cb..2efa189af 100644 --- a/Application/PlaybackController.m +++ b/Application/PlaybackController.m @@ -189,7 +189,7 @@ NSDictionary *makeRGInfo(PlaylistEntry *pe) { if(!pe.url) { pe.error = YES; - pe.errorMessage = NSLocalizedString(@"ErrorMessageBadFile", @""); + pe.errorMessage = NSLocalizedStringFromTableInBundle(@"ErrorMessageBadFile", nil, [NSBundle bundleForClass:[self class]], @""); [[FIRCrashlytics crashlytics] log:@"Attempting to play bad file."]; return; } @@ -591,7 +591,7 @@ NSDictionary *makeRGInfo(PlaylistEntry *pe) { [[FIRCrashlytics crashlytics] log:@"Invalid playlist entry reached."]; [player setNextStream:nil]; pe.error = YES; - pe.errorMessage = NSLocalizedString(@"ErrorMessageBadFile", @""); + pe.errorMessage = NSLocalizedStringFromTableInBundle(@"ErrorMessageBadFile", nil, [NSBundle bundleForClass:[self class]], @""); } else { [[FIRCrashlytics crashlytics] log:@"End of playlist reached."]; [player setNextStream:nil]; diff --git a/Playlist/PlaylistEntry.m b/Playlist/PlaylistEntry.m index cbf44a86c..08c85838a 100644 --- a/Playlist/PlaylistEntry.m +++ b/Playlist/PlaylistEntry.m @@ -484,7 +484,7 @@ NSURL *_Nullable urlForPath(NSString *_Nullable path) { - (void)setMetadata:(NSDictionary *)metadata { if(metadata == nil) { self.error = YES; - self.errorMessage = NSLocalizedString(@"ErrorMetadata", @""); + self.errorMessage = NSLocalizedStringFromTableInBundle(@"ErrorMetadata", nil, [NSBundle bundleForClass:[self class]], @""); } else { self.volume = 1; [self setValuesForKeysWithDictionary:metadata]; diff --git a/Playlist/PlaylistLoader.m b/Playlist/PlaylistLoader.m index fe2a60942..f2b24c164 100644 --- a/Playlist/PlaylistLoader.m +++ b/Playlist/PlaylistLoader.m @@ -646,7 +646,7 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc [weakLock lock]; if(!weakPe.url) { weakPe.error = YES; - weakPe.errorMessage = NSLocalizedString(@"ErrorMessageBadFile", @""); + weakPe.errorMessage = NSLocalizedStringFromTableInBundle(@"ErrorMessageBadFile", nil, [NSBundle bundleForClass:[self class]], @""); } progress += progressstep; [self setProgressJobStatus:progress];