aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan Beaufour2015-10-07 12:52:59 -0400
committerAllan Beaufour2015-10-07 12:52:59 -0400
commitded95506c6bc8f6c839b1efaf2fc04923498e894 (patch)
tree978121a3c8cedf63f8014a427c72dab216024816
parentb99a1a4dc431e90b3404cfc1f15b0dd7c2846323 (diff)
downloadMASShortcut-ded95506c6bc8f6c839b1efaf2fc04923498e894.tar.bz2
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
-rw-r--r--Framework/MASLocalization.m8
-rw-r--r--MASShortcut.podspec2
2 files changed, 9 insertions, 1 deletions
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"];
}
diff --git a/MASShortcut.podspec b/MASShortcut.podspec
index 2b66035..8369046 100644
--- a/MASShortcut.podspec
+++ b/MASShortcut.podspec
@@ -1,3 +1,4 @@
+# coding: utf-8
Pod::Spec.new do |s|
s.name = 'MASShortcut'
s.version = '2.3.1'
@@ -14,4 +15,5 @@ Pod::Spec.new do |s|
s.exclude_files = 'Framework/*Tests.m'
s.osx.frameworks = 'Carbon', 'AppKit'
s.requires_arc = true
+ s.osx.resource_bundles = { 'MASShortcut' => ['*.lproj'] }
end