From b390dd952b2ca29a0da10f907bc1d2bb23bcf2e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sone=C3=A9=20John?= Date: Thu, 23 Apr 2020 07:54:00 -0400 Subject: [PATCH 1/2] Use `localizedInfoDictionary` instead of `infoDictionary` Spent about 20 mins figuring out why `NSHumanReadableCopyright` which was localized with my in my InfoPlist.strings wasn't appearing. See documentation here: https://developer.apple.com/documentation/foundation/nsbundle/1407645-localizedinfodictionary?language=objc --- PFAboutWindow/PFAboutWindowController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PFAboutWindow/PFAboutWindowController.m b/PFAboutWindow/PFAboutWindowController.m index 9ee6718..470ada7 100755 --- a/PFAboutWindow/PFAboutWindowController.m +++ b/PFAboutWindow/PFAboutWindowController.m @@ -78,7 +78,7 @@ - (void)windowDidLoad { [self.visitWebsiteButton.cell setHighlightsBy:NSContentsCellMask]; // Load variables - NSDictionary *bundleDict = [[NSBundle mainBundle] infoDictionary]; + NSDictionary *bundleDict = [[NSBundle mainBundle] localizedInfoDictionary]; // Set app name if(!self.appName) { From 3a28c4d7fd36d1ea1d162084170e099c57330743 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sonee=CC=81=20John?= Date: Thu, 23 Apr 2020 13:53:18 -0400 Subject: [PATCH 2/2] Use `-objectForInfoDictionaryKey:` to retrieve bundle values --- PFAboutWindow/PFAboutWindowController.m | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/PFAboutWindow/PFAboutWindowController.m b/PFAboutWindow/PFAboutWindowController.m index 470ada7..d127821 100755 --- a/PFAboutWindow/PFAboutWindowController.m +++ b/PFAboutWindow/PFAboutWindowController.m @@ -78,23 +78,23 @@ - (void)windowDidLoad { [self.visitWebsiteButton.cell setHighlightsBy:NSContentsCellMask]; // Load variables - NSDictionary *bundleDict = [[NSBundle mainBundle] localizedInfoDictionary]; + NSBundle *mainBundle = [NSBundle mainBundle]; // Set app name if(!self.appName) { - self.appName = [bundleDict objectForKey:@"CFBundleName"]; + self.appName = [mainBundle objectForInfoDictionaryKey:@"CFBundleName"]; } // Set app version if(!self.appVersion) { - NSString *version = [bundleDict objectForKey:@"CFBundleVersion"]; - NSString *shortVersion = [bundleDict objectForKey:@"CFBundleShortVersionString"]; + NSString *version = [mainBundle objectForInfoDictionaryKey:@"CFBundleVersion"]; + NSString *shortVersion = [mainBundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"]; self.appVersion = [NSString stringWithFormat:NSLocalizedString(@"Version %@ (Build %@)", @"Version %@ (Build %@), displayed in the about window"), shortVersion, version]; } // Set copyright if(!self.appCopyright) { - self.appCopyright = [[NSAttributedString alloc] initWithString:[bundleDict objectForKey:@"NSHumanReadableCopyright"] attributes:@{ + self.appCopyright = [[NSAttributedString alloc] initWithString:[mainBundle objectForInfoDictionaryKey:@"NSHumanReadableCopyright"] attributes:@{ NSFontAttributeName:[NSFont fontWithName:@"HelveticaNeue" size:11]/*/NSParagraphStyleAttributeName : paragraphStyle*/}]; }