From ded95506c6bc8f6c839b1efaf2fc04923498e894 Mon Sep 17 00:00:00 2001 From: Allan Beaufour Date: Wed, 7 Oct 2015 12:52:59 -0400 Subject: fixes localized strings when using CocoaPods Puts strings inside a MASShortcut resource bundle, and looks for locallized strings inside that bundle when used as a CocoaPod --- Framework/MASLocalization.m | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'Framework/MASLocalization.m') diff --git a/Framework/MASLocalization.m b/Framework/MASLocalization.m index 7f395a9..a36d3a4 100644 --- a/Framework/MASLocalization.m +++ b/Framework/MASLocalization.m @@ -2,6 +2,12 @@ #import "MASShortcut.h" NSString *MASLocalizedString(NSString *key, NSString *comment) { - NSBundle *frameworkBundle = [NSBundle bundleForClass:[MASShortcut class]]; + NSBundle *frameworkBundle = nil; +#ifdef COCOAPODS + NSURL *bundleURL = [[NSBundle mainBundle] URLForResource:@"MASShortcut" withExtension:@"bundle"]; + frameworkBundle = [NSBundle bundleWithURL:bundleURL]; +#else + frameworkBundle = [NSBundle bundleForClass:[MASShortcut class]]; +#endif return [frameworkBundle localizedStringForKey:key value:@"XXX" table:@"Localizable"]; } -- cgit v1.2.3