From b3eb77cefa66d4666550dcf2e6e8843af5cf4297 Mon Sep 17 00:00:00 2001 From: Tomo Matsumoto Date: Tue, 20 Jan 2015 11:01:46 +0900 Subject: [PATCH 1/2] add Japanese translation --- .../ELCImagePicker/ELCAlbumPickerController.m | 12 ++-- Classes/ELCImagePicker/ELCAssetTablePicker.m | 7 ++- Classes/ELCImagePicker/ELCGlobal.h | 1 + Classes/ELCImagePicker/ELCGlobal.m | 9 +++ .../ELCImagePicker/ELCImagePickerController.m | 7 ++- .../en.lproj/ELCImagePickerController.strings | Bin 0 -> 1992 bytes .../ja.lproj/ELCImagePickerController.strings | Bin 0 -> 1762 bytes ELCImagePickerController.podspec | 1 + ELCImagePickerDemo.xcodeproj/project.pbxproj | 53 ++++++++++++++++++ 9 files changed, 78 insertions(+), 12 deletions(-) create mode 100644 Classes/ELCImagePicker/ELCGlobal.h create mode 100644 Classes/ELCImagePicker/ELCGlobal.m create mode 100644 Classes/ELCImagePicker/Resources/en.lproj/ELCImagePickerController.strings create mode 100644 Classes/ELCImagePicker/Resources/ja.lproj/ELCImagePickerController.strings diff --git a/Classes/ELCImagePicker/ELCAlbumPickerController.m b/Classes/ELCImagePicker/ELCAlbumPickerController.m index e375a0a..148be8e 100755 --- a/Classes/ELCImagePicker/ELCAlbumPickerController.m +++ b/Classes/ELCImagePicker/ELCAlbumPickerController.m @@ -9,6 +9,7 @@ #import "ELCImagePickerController.h" #import "ELCAssetTablePicker.h" #import +#import "ELCGlobal.h" @interface ELCAlbumPickerController () @@ -27,8 +28,7 @@ - (void)viewDidLoad { [super viewDidLoad]; [self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone]; - - [self.navigationItem setTitle:NSLocalizedString(@"Loading...", nil)]; + [self.navigationItem setTitle:ELCLocalizedString(@"Loading...")]; UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self.parent action:@selector(cancelImagePicker)]; [self.navigationItem setRightBarButtonItem:cancelButton]; @@ -70,12 +70,12 @@ - (void)viewDidLoad void (^assetGroupEnumberatorFailure)(NSError *) = ^(NSError *error) { if ([ALAssetsLibrary authorizationStatus] == ALAuthorizationStatusDenied) { - NSString *errorMessage = NSLocalizedString(@"This app does not have access to your photos or videos. You can enable access in Privacy Settings.", nil); - [[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Access Denied", nil) message:errorMessage delegate:nil cancelButtonTitle:NSLocalizedString(@"Ok", nil) otherButtonTitles:nil] show]; + NSString *errorMessage = ELCLocalizedString(@"This app does not have access to your photos or videos. You can enable access in Privacy Settings."); + [[[UIAlertView alloc] initWithTitle:ELCLocalizedString(@"Access Denied") message:errorMessage delegate:nil cancelButtonTitle:ELCLocalizedString(@"Ok") otherButtonTitles:nil] show]; } else { NSString *errorMessage = [NSString stringWithFormat:@"Album Error: %@ - %@", [error localizedDescription], [error localizedRecoverySuggestion]]; - [[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Error", nil) message:errorMessage delegate:nil cancelButtonTitle:NSLocalizedString(@"Ok", nil) otherButtonTitles:nil] show]; + [[[UIAlertView alloc] initWithTitle:ELCLocalizedString(@"Error") message:errorMessage delegate:nil cancelButtonTitle:ELCLocalizedString(@"Ok") otherButtonTitles:nil] show]; } [self.navigationItem setTitle:nil]; @@ -106,7 +106,7 @@ - (void)viewWillDisappear:(BOOL)animated { - (void)reloadTableView { [self.tableView reloadData]; - [self.navigationItem setTitle:NSLocalizedString(@"Select an Album", nil)]; + [self.navigationItem setTitle:ELCLocalizedString(@"Select an Album")]; } - (BOOL)shouldSelectAsset:(ELCAsset *)asset previousCount:(NSUInteger)previousCount diff --git a/Classes/ELCImagePicker/ELCAssetTablePicker.m b/Classes/ELCImagePicker/ELCAssetTablePicker.m index 24830be..84b43a0 100755 --- a/Classes/ELCImagePicker/ELCAssetTablePicker.m +++ b/Classes/ELCImagePicker/ELCAssetTablePicker.m @@ -10,6 +10,7 @@ #import "ELCAsset.h" #import "ELCAlbumPickerController.h" #import "ELCConsole.h" +#import "ELCGlobal.h" @interface ELCAssetTablePicker () @@ -45,7 +46,7 @@ - (void)viewDidLoad } else { UIBarButtonItem *doneButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(doneAction:)]; [self.navigationItem setRightBarButtonItem:doneButtonItem]; - [self.navigationItem setTitle:NSLocalizedString(@"Loading...", nil)]; + [self.navigationItem setTitle:ELCLocalizedString(@"Loading...")]; } [self performSelectorInBackground:@selector(preparePhotos) withObject:nil]; @@ -118,8 +119,8 @@ - (void)preparePhotos atScrollPosition:UITableViewScrollPositionBottom animated:NO]; } - - [self.navigationItem setTitle:self.singleSelection ? NSLocalizedString(@"Pick Photo", nil) : NSLocalizedString(@"Pick Photos", nil)]; + + [self.navigationItem setTitle:self.singleSelection ? ELCLocalizedString(@"Pick Photo") : ELCLocalizedString(@"Pick Photos")]; }); } } diff --git a/Classes/ELCImagePicker/ELCGlobal.h b/Classes/ELCImagePicker/ELCGlobal.h new file mode 100644 index 0000000..53b71d8 --- /dev/null +++ b/Classes/ELCImagePicker/ELCGlobal.h @@ -0,0 +1 @@ +NSString *ELCLocalizedString(NSString *key); diff --git a/Classes/ELCImagePicker/ELCGlobal.m b/Classes/ELCImagePicker/ELCGlobal.m new file mode 100644 index 0000000..30b6bd2 --- /dev/null +++ b/Classes/ELCImagePicker/ELCGlobal.m @@ -0,0 +1,9 @@ +NSString *ELCLocalizedString(NSString *key) { + return NSLocalizedStringFromTableInBundle( + key, + @"ELCImagePickerController", + [NSBundle bundleWithPath:[[NSBundle mainBundle] + pathForResource:@"ELCImagePickerController" + ofType:@"bundle"]], + nil); +} diff --git a/Classes/ELCImagePicker/ELCImagePickerController.m b/Classes/ELCImagePicker/ELCImagePickerController.m index b7f3eda..8fb0f75 100755 --- a/Classes/ELCImagePicker/ELCImagePickerController.m +++ b/Classes/ELCImagePicker/ELCImagePickerController.m @@ -14,6 +14,7 @@ #import #import #import "ELCConsole.h" +#import "ELCGlobal.h" @implementation ELCImagePickerController @@ -71,13 +72,13 @@ - (BOOL)shouldSelectAsset:(ELCAsset *)asset previousCount:(NSUInteger)previousCo { BOOL shouldSelect = previousCount < self.maximumImagesCount; if (!shouldSelect) { - NSString *title = [NSString stringWithFormat:NSLocalizedString(@"Only %d photos please!", nil), self.maximumImagesCount]; - NSString *message = [NSString stringWithFormat:NSLocalizedString(@"You can only send %d photos at a time.", nil), self.maximumImagesCount]; + NSString *title = [NSString stringWithFormat:ELCLocalizedString(@"Only %d photos please!"), self.maximumImagesCount]; + NSString *message = [NSString stringWithFormat:ELCLocalizedString(@"You can only send %d photos at a time."), self.maximumImagesCount]; [[[UIAlertView alloc] initWithTitle:title message:message delegate:nil cancelButtonTitle:nil - otherButtonTitles:NSLocalizedString(@"Okay", nil), nil] show]; + otherButtonTitles:ELCLocalizedString(@"Okay"), nil] show]; } return shouldSelect; } diff --git a/Classes/ELCImagePicker/Resources/en.lproj/ELCImagePickerController.strings b/Classes/ELCImagePicker/Resources/en.lproj/ELCImagePickerController.strings new file mode 100644 index 0000000000000000000000000000000000000000..bcdcf54d0062ab64dcd000a484bc8e8073476657 GIT binary patch literal 1992 zcmds&K}*9x5QXR5U$F{adayr0JQVaMTF{HfZ4zqGCLxIh|GfIWjWkIKiqQ2SOP0;d zcIVC8m)DQ?h0V>`t(D9P^OliWVJ+{K)kJodTS_b?vbHy7k28|IS{s^9!74)PVsNMOg= zYLB_+Z94mRNSXm#Q&^ObgXW&Q(yb-Ig*;!6vn7$Wz2Z(iLqF|{gYJR5%7eB%>Z-t& zqBS|51F4kf*x~WbjFlhxp;YP6YDp(GtFcz)Pj2tG(yyHLG3=H*cTC8AJzR*P!}H}d zQd14WU8pU;7Edjs^C6wubND~HiF4D3%$Km+IgQ+;2yQdwIsQwxE^w~@(;?%>J+Hq)$ literal 0 HcmV?d00001 diff --git a/Classes/ELCImagePicker/Resources/ja.lproj/ELCImagePickerController.strings b/Classes/ELCImagePicker/Resources/ja.lproj/ELCImagePickerController.strings new file mode 100644 index 0000000000000000000000000000000000000000..16b302bb7c2ce53a765db1df16ece88386bf0bf0 GIT binary patch literal 1762 zcmcgtJud`N6up$8Ndu_7CV%zhYa+1>1}uf{g2B_Sjd3WX>{B1#c@ ztx#ySqVNX<=f1UOO_WAn=4Ix-H}9T%=G-$M?_JU^Mn)yeInH^JBPkgv@;N7YMwTTd z3C0qP#AJ=LuDgt8c$eg!PR81$OBy63eLN-3Xo17XfZdzooZy;~US1(N#s#i%ge3B>M%<%{7P)#+z2M z&^HdUF=}_KuU2YS-*i~Da^XK;okA6oC&Fc$Tb)*!D{@qP zL{IhDQsr#m0k=3q8dXn?ViRri;r(Isqx_}qdOXtYPRQ*gJ+GsDIPIdl{5s)cggc_B w4~%g?16fvC>0Is3jP2gvdf53=im|opAIV?2zmppy{j+J*?dZQm`?=appTopJ%>V!Z literal 0 HcmV?d00001 diff --git a/ELCImagePickerController.podspec b/ELCImagePickerController.podspec index 89e3c3a..2665be3 100644 --- a/ELCImagePickerController.podspec +++ b/ELCImagePickerController.podspec @@ -13,6 +13,7 @@ Pod::Spec.new do |s| } s.platform = :ios, '6.0' s.resources = 'Classes/**/*.{xib,png}' + s.resource_bundles = { 'ELCImagePickerController' => 'Classes/**/*.lproj' } s.source_files = 'Classes/ELCImagePicker/*.{h,m}' s.framework = 'Foundation', 'UIKit', 'AssetsLibrary', 'CoreLocation' s.requires_arc = true diff --git a/ELCImagePickerDemo.xcodeproj/project.pbxproj b/ELCImagePickerDemo.xcodeproj/project.pbxproj index eeecc92..d1f21c9 100755 --- a/ELCImagePickerDemo.xcodeproj/project.pbxproj +++ b/ELCImagePickerDemo.xcodeproj/project.pbxproj @@ -28,6 +28,9 @@ 83C6BC9714476B280064D71D /* elc-ios-icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 83C6BC9514476B280064D71D /* elc-ios-icon@2x.png */; }; 83C6BC9814476B280064D71D /* elc-ios-icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 83C6BC9614476B280064D71D /* elc-ios-icon.png */; }; E29A5E3C1239C42A008BB149 /* AssetsLibrary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E29A5E3B1239C42A008BB149 /* AssetsLibrary.framework */; }; + E507C2871A6DED4C00191D11 /* ELCGlobal.m in Sources */ = {isa = PBXBuildFile; fileRef = E507C2851A6DED4C00191D11 /* ELCGlobal.m */; }; + E507C28E1A6DED6F00191D11 /* ELCImagePickerController.strings in Resources */ = {isa = PBXBuildFile; fileRef = E507C2891A6DED6F00191D11 /* ELCImagePickerController.strings */; }; + E507C28F1A6DED6F00191D11 /* ELCImagePickerController.strings in Resources */ = {isa = PBXBuildFile; fileRef = E507C28C1A6DED6F00191D11 /* ELCImagePickerController.strings */; }; F1DF7842196FA475003524A2 /* ELCConsole.m in Sources */ = {isa = PBXBuildFile; fileRef = F1DF783F196FA475003524A2 /* ELCConsole.m */; }; F1DF7843196FA475003524A2 /* ELCOverlayImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = F1DF7841196FA475003524A2 /* ELCOverlayImageView.m */; }; /* End PBXBuildFile section */ @@ -67,6 +70,10 @@ 8D1107310486CEB800E47090 /* ELCImagePickerDemo-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "ELCImagePickerDemo-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = ""; }; A58058B417EB865B0078600C /* ELCAssetPickerFilterDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ELCAssetPickerFilterDelegate.h; sourceTree = ""; }; E29A5E3B1239C42A008BB149 /* AssetsLibrary.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AssetsLibrary.framework; path = System/Library/Frameworks/AssetsLibrary.framework; sourceTree = SDKROOT; }; + E507C2851A6DED4C00191D11 /* ELCGlobal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ELCGlobal.m; sourceTree = ""; }; + E507C2861A6DED4C00191D11 /* ELCGlobal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ELCGlobal.h; sourceTree = ""; }; + E507C28A1A6DED6F00191D11 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ELCImagePickerController.strings; sourceTree = ""; }; + E507C28D1A6DED6F00191D11 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = ELCImagePickerController.strings; sourceTree = ""; }; F1DF783E196FA475003524A2 /* ELCConsole.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ELCConsole.h; sourceTree = ""; }; F1DF783F196FA475003524A2 /* ELCConsole.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ELCConsole.m; sourceTree = ""; }; F1DF7840196FA475003524A2 /* ELCOverlayImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ELCOverlayImageView.h; sourceTree = ""; }; @@ -144,6 +151,8 @@ 29B97317FDCFA39411CA2CEA /* Resources */ = { isa = PBXGroup; children = ( + E507C2881A6DED6F00191D11 /* ja.lproj */, + E507C28B1A6DED6F00191D11 /* en.lproj */, 1A4C631217380272001E0978 /* Overlay.png */, 1A4C631317380272001E0978 /* Overlay@2x.png */, 83C6BC9514476B280064D71D /* elc-ios-icon@2x.png */, @@ -169,6 +178,8 @@ 4252A0981593013500086D05 /* ELCImagePicker */ = { isa = PBXGroup; children = ( + E507C2851A6DED4C00191D11 /* ELCGlobal.m */, + E507C2861A6DED4C00191D11 /* ELCGlobal.h */, 1A2C0FFD17026CF0004FAFA0 /* ELCAlbumPickerController.h */, 1A2C0FFE17026CF0004FAFA0 /* ELCAlbumPickerController.m */, 1A2C0FFF17026CF0004FAFA0 /* ELCAsset.h */, @@ -190,6 +201,24 @@ path = ELCImagePicker; sourceTree = ""; }; + E507C2881A6DED6F00191D11 /* ja.lproj */ = { + isa = PBXGroup; + children = ( + E507C2891A6DED6F00191D11 /* ELCImagePickerController.strings */, + ); + name = ja.lproj; + path = Classes/ELCImagePicker/Resources/ja.lproj; + sourceTree = ""; + }; + E507C28B1A6DED6F00191D11 /* en.lproj */ = { + isa = PBXGroup; + children = ( + E507C28C1A6DED6F00191D11 /* ELCImagePickerController.strings */, + ); + name = en.lproj; + path = Classes/ELCImagePicker/Resources/en.lproj; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -228,6 +257,8 @@ Japanese, French, German, + ja, + en, ); mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; projectDirPath = ""; @@ -248,6 +279,8 @@ 83C6BC9714476B280064D71D /* elc-ios-icon@2x.png in Resources */, 83C6BC9814476B280064D71D /* elc-ios-icon.png in Resources */, 230644BC15F8C0BB007679C7 /* MainWindow-iPad.xib in Resources */, + E507C28E1A6DED6F00191D11 /* ELCImagePickerController.strings in Resources */, + E507C28F1A6DED6F00191D11 /* ELCImagePickerController.strings in Resources */, 0B67B05B17E0ED1F002CC2C5 /* Default-568h@2x.png in Resources */, 1A4C631417380272001E0978 /* Overlay.png in Resources */, 1A4C631517380272001E0978 /* Overlay@2x.png in Resources */, @@ -270,12 +303,32 @@ 1A2C100717026CF0004FAFA0 /* ELCAlbumPickerController.m in Sources */, 1A2C100817026CF0004FAFA0 /* ELCAsset.m in Sources */, F1DF7843196FA475003524A2 /* ELCOverlayImageView.m in Sources */, + E507C2871A6DED4C00191D11 /* ELCGlobal.m in Sources */, 1A2C100917026CF0004FAFA0 /* ELCAssetCell.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXVariantGroup section */ + E507C2891A6DED6F00191D11 /* ELCImagePickerController.strings */ = { + isa = PBXVariantGroup; + children = ( + E507C28A1A6DED6F00191D11 /* ja */, + ); + name = ELCImagePickerController.strings; + sourceTree = ""; + }; + E507C28C1A6DED6F00191D11 /* ELCImagePickerController.strings */ = { + isa = PBXVariantGroup; + children = ( + E507C28D1A6DED6F00191D11 /* en */, + ); + name = ELCImagePickerController.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + /* Begin XCBuildConfiguration section */ 1D6058940D05DD3E006BFB54 /* Debug */ = { isa = XCBuildConfiguration; From 3f89146c8e778b5ff16c122435dcd82762ebfdd7 Mon Sep 17 00:00:00 2001 From: Tomo Matsumoto Date: Tue, 20 Jan 2015 16:29:48 +0900 Subject: [PATCH 2/2] Demo app now works with `[ELC setAlwaysUseMainBundle:YES]` --- Classes/ELCImagePicker/ELC.h | 7 +++++ Classes/ELCImagePicker/ELC.m | 28 +++++++++++++++++++ .../ELCImagePicker/ELCAlbumPickerController.m | 12 ++++---- Classes/ELCImagePicker/ELCAssetTablePicker.m | 6 ++-- Classes/ELCImagePicker/ELCGlobal.h | 1 - Classes/ELCImagePicker/ELCGlobal.m | 9 ------ .../ELCImagePicker/ELCImagePickerController.m | 8 +++--- Classes/ELCImagePickerDemoViewController.m | 3 +- ELCImagePickerDemo.xcodeproj/project.pbxproj | 12 ++++---- 9 files changed, 56 insertions(+), 30 deletions(-) create mode 100644 Classes/ELCImagePicker/ELC.h create mode 100644 Classes/ELCImagePicker/ELC.m delete mode 100644 Classes/ELCImagePicker/ELCGlobal.h delete mode 100644 Classes/ELCImagePicker/ELCGlobal.m diff --git a/Classes/ELCImagePicker/ELC.h b/Classes/ELCImagePicker/ELC.h new file mode 100644 index 0000000..dcdb9b3 --- /dev/null +++ b/Classes/ELCImagePicker/ELC.h @@ -0,0 +1,7 @@ +@interface ELC : NSObject + ++ (void)setAlwaysUseMainBundle:(BOOL)alwaysUseMainBundle; ++ (NSBundle *)bundle; ++ (NSString *)LocalizedString:(NSString *)key; + +@end diff --git a/Classes/ELCImagePicker/ELC.m b/Classes/ELCImagePicker/ELC.m new file mode 100644 index 0000000..a27f7a4 --- /dev/null +++ b/Classes/ELCImagePicker/ELC.m @@ -0,0 +1,28 @@ +#import "ELC.h" + +static BOOL _alwaysUseMainBundle = NO; + +@implementation ELC + ++ (void)setAlwaysUseMainBundle:(BOOL)alwaysUseMainBundle { + _alwaysUseMainBundle = alwaysUseMainBundle; +} + ++ (NSBundle *)bundle { + if (_alwaysUseMainBundle) { + return [NSBundle mainBundle]; + } + return [NSBundle bundleWithPath:[[NSBundle mainBundle] + pathForResource: @"ELCImagePickerController" + ofType: @"bundle"]]; +} + ++ (NSString *)LocalizedString:(NSString *)key { + return NSLocalizedStringFromTableInBundle( + key, + @"ELCImagePickerController", + [ELC bundle], + nil); +} + +@end diff --git a/Classes/ELCImagePicker/ELCAlbumPickerController.m b/Classes/ELCImagePicker/ELCAlbumPickerController.m index 148be8e..5ff8266 100755 --- a/Classes/ELCImagePicker/ELCAlbumPickerController.m +++ b/Classes/ELCImagePicker/ELCAlbumPickerController.m @@ -9,7 +9,7 @@ #import "ELCImagePickerController.h" #import "ELCAssetTablePicker.h" #import -#import "ELCGlobal.h" +#import "ELC.h" @interface ELCAlbumPickerController () @@ -28,7 +28,7 @@ - (void)viewDidLoad { [super viewDidLoad]; [self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone]; - [self.navigationItem setTitle:ELCLocalizedString(@"Loading...")]; + [self.navigationItem setTitle:[ELC LocalizedString:@"Loading..."]]; UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self.parent action:@selector(cancelImagePicker)]; [self.navigationItem setRightBarButtonItem:cancelButton]; @@ -70,12 +70,12 @@ - (void)viewDidLoad void (^assetGroupEnumberatorFailure)(NSError *) = ^(NSError *error) { if ([ALAssetsLibrary authorizationStatus] == ALAuthorizationStatusDenied) { - NSString *errorMessage = ELCLocalizedString(@"This app does not have access to your photos or videos. You can enable access in Privacy Settings."); - [[[UIAlertView alloc] initWithTitle:ELCLocalizedString(@"Access Denied") message:errorMessage delegate:nil cancelButtonTitle:ELCLocalizedString(@"Ok") otherButtonTitles:nil] show]; + NSString *errorMessage = [ELC LocalizedString:@"This app does not have access to your photos or videos. You can enable access in Privacy Settings."]; + [[[UIAlertView alloc] initWithTitle:[ELC LocalizedString:@"Access Denied"] message:errorMessage delegate:nil cancelButtonTitle:[ELC LocalizedString:@"Ok"] otherButtonTitles:nil] show]; } else { NSString *errorMessage = [NSString stringWithFormat:@"Album Error: %@ - %@", [error localizedDescription], [error localizedRecoverySuggestion]]; - [[[UIAlertView alloc] initWithTitle:ELCLocalizedString(@"Error") message:errorMessage delegate:nil cancelButtonTitle:ELCLocalizedString(@"Ok") otherButtonTitles:nil] show]; + [[[UIAlertView alloc] initWithTitle:[ELC LocalizedString:@"Error"] message:errorMessage delegate:nil cancelButtonTitle:[ELC LocalizedString:@"Ok"] otherButtonTitles:nil] show]; } [self.navigationItem setTitle:nil]; @@ -106,7 +106,7 @@ - (void)viewWillDisappear:(BOOL)animated { - (void)reloadTableView { [self.tableView reloadData]; - [self.navigationItem setTitle:ELCLocalizedString(@"Select an Album")]; + [self.navigationItem setTitle:[ELC LocalizedString:@"Select an Album"]]; } - (BOOL)shouldSelectAsset:(ELCAsset *)asset previousCount:(NSUInteger)previousCount diff --git a/Classes/ELCImagePicker/ELCAssetTablePicker.m b/Classes/ELCImagePicker/ELCAssetTablePicker.m index 84b43a0..1d92021 100755 --- a/Classes/ELCImagePicker/ELCAssetTablePicker.m +++ b/Classes/ELCImagePicker/ELCAssetTablePicker.m @@ -10,7 +10,7 @@ #import "ELCAsset.h" #import "ELCAlbumPickerController.h" #import "ELCConsole.h" -#import "ELCGlobal.h" +#import "ELC.h" @interface ELCAssetTablePicker () @@ -46,7 +46,7 @@ - (void)viewDidLoad } else { UIBarButtonItem *doneButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(doneAction:)]; [self.navigationItem setRightBarButtonItem:doneButtonItem]; - [self.navigationItem setTitle:ELCLocalizedString(@"Loading...")]; + [self.navigationItem setTitle:[ELC LocalizedString:@"Loading..."]]; } [self performSelectorInBackground:@selector(preparePhotos) withObject:nil]; @@ -120,7 +120,7 @@ - (void)preparePhotos animated:NO]; } - [self.navigationItem setTitle:self.singleSelection ? ELCLocalizedString(@"Pick Photo") : ELCLocalizedString(@"Pick Photos")]; + [self.navigationItem setTitle:self.singleSelection ? [ELC LocalizedString:@"Pick Photo"] : [ELC LocalizedString:@"Pick Photos"]]; }); } } diff --git a/Classes/ELCImagePicker/ELCGlobal.h b/Classes/ELCImagePicker/ELCGlobal.h deleted file mode 100644 index 53b71d8..0000000 --- a/Classes/ELCImagePicker/ELCGlobal.h +++ /dev/null @@ -1 +0,0 @@ -NSString *ELCLocalizedString(NSString *key); diff --git a/Classes/ELCImagePicker/ELCGlobal.m b/Classes/ELCImagePicker/ELCGlobal.m deleted file mode 100644 index 30b6bd2..0000000 --- a/Classes/ELCImagePicker/ELCGlobal.m +++ /dev/null @@ -1,9 +0,0 @@ -NSString *ELCLocalizedString(NSString *key) { - return NSLocalizedStringFromTableInBundle( - key, - @"ELCImagePickerController", - [NSBundle bundleWithPath:[[NSBundle mainBundle] - pathForResource:@"ELCImagePickerController" - ofType:@"bundle"]], - nil); -} diff --git a/Classes/ELCImagePicker/ELCImagePickerController.m b/Classes/ELCImagePicker/ELCImagePickerController.m index 8fb0f75..4396f30 100755 --- a/Classes/ELCImagePicker/ELCImagePickerController.m +++ b/Classes/ELCImagePicker/ELCImagePickerController.m @@ -14,7 +14,7 @@ #import #import #import "ELCConsole.h" -#import "ELCGlobal.h" +#import "ELC.h" @implementation ELCImagePickerController @@ -72,13 +72,13 @@ - (BOOL)shouldSelectAsset:(ELCAsset *)asset previousCount:(NSUInteger)previousCo { BOOL shouldSelect = previousCount < self.maximumImagesCount; if (!shouldSelect) { - NSString *title = [NSString stringWithFormat:ELCLocalizedString(@"Only %d photos please!"), self.maximumImagesCount]; - NSString *message = [NSString stringWithFormat:ELCLocalizedString(@"You can only send %d photos at a time."), self.maximumImagesCount]; + NSString *title = [NSString stringWithFormat:[ELC LocalizedString:@"Only %d photos please!"], self.maximumImagesCount]; + NSString *message = [NSString stringWithFormat:[ELC LocalizedString:@"You can only send %d photos at a time."], self.maximumImagesCount]; [[[UIAlertView alloc] initWithTitle:title message:message delegate:nil cancelButtonTitle:nil - otherButtonTitles:ELCLocalizedString(@"Okay"), nil] show]; + otherButtonTitles:[ELC LocalizedString:@"Okay"], nil] show]; } return shouldSelect; } diff --git a/Classes/ELCImagePickerDemoViewController.m b/Classes/ELCImagePickerDemoViewController.m index 0b53ef2..a4756dd 100644 --- a/Classes/ELCImagePickerDemoViewController.m +++ b/Classes/ELCImagePickerDemoViewController.m @@ -9,7 +9,7 @@ #import "ELCImagePickerDemoAppDelegate.h" #import "ELCImagePickerDemoViewController.h" #import - +#import "ELC.h" @interface ELCImagePickerDemoViewController () @@ -23,6 +23,7 @@ @implementation ELCImagePickerDemoViewController - (IBAction)launchController { + [ELC setAlwaysUseMainBundle:YES]; ELCImagePickerController *elcPicker = [[ELCImagePickerController alloc] initImagePicker]; elcPicker.maximumImagesCount = 100; //Set the maximum number of images to select to 100 diff --git a/ELCImagePickerDemo.xcodeproj/project.pbxproj b/ELCImagePickerDemo.xcodeproj/project.pbxproj index d1f21c9..0436cc0 100755 --- a/ELCImagePickerDemo.xcodeproj/project.pbxproj +++ b/ELCImagePickerDemo.xcodeproj/project.pbxproj @@ -28,9 +28,9 @@ 83C6BC9714476B280064D71D /* elc-ios-icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 83C6BC9514476B280064D71D /* elc-ios-icon@2x.png */; }; 83C6BC9814476B280064D71D /* elc-ios-icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 83C6BC9614476B280064D71D /* elc-ios-icon.png */; }; E29A5E3C1239C42A008BB149 /* AssetsLibrary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E29A5E3B1239C42A008BB149 /* AssetsLibrary.framework */; }; - E507C2871A6DED4C00191D11 /* ELCGlobal.m in Sources */ = {isa = PBXBuildFile; fileRef = E507C2851A6DED4C00191D11 /* ELCGlobal.m */; }; E507C28E1A6DED6F00191D11 /* ELCImagePickerController.strings in Resources */ = {isa = PBXBuildFile; fileRef = E507C2891A6DED6F00191D11 /* ELCImagePickerController.strings */; }; E507C28F1A6DED6F00191D11 /* ELCImagePickerController.strings in Resources */ = {isa = PBXBuildFile; fileRef = E507C28C1A6DED6F00191D11 /* ELCImagePickerController.strings */; }; + E507C2921A6DF4A400191D11 /* ELC.m in Sources */ = {isa = PBXBuildFile; fileRef = E507C2911A6DF4A400191D11 /* ELC.m */; }; F1DF7842196FA475003524A2 /* ELCConsole.m in Sources */ = {isa = PBXBuildFile; fileRef = F1DF783F196FA475003524A2 /* ELCConsole.m */; }; F1DF7843196FA475003524A2 /* ELCOverlayImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = F1DF7841196FA475003524A2 /* ELCOverlayImageView.m */; }; /* End PBXBuildFile section */ @@ -70,10 +70,10 @@ 8D1107310486CEB800E47090 /* ELCImagePickerDemo-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "ELCImagePickerDemo-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = ""; }; A58058B417EB865B0078600C /* ELCAssetPickerFilterDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ELCAssetPickerFilterDelegate.h; sourceTree = ""; }; E29A5E3B1239C42A008BB149 /* AssetsLibrary.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AssetsLibrary.framework; path = System/Library/Frameworks/AssetsLibrary.framework; sourceTree = SDKROOT; }; - E507C2851A6DED4C00191D11 /* ELCGlobal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ELCGlobal.m; sourceTree = ""; }; - E507C2861A6DED4C00191D11 /* ELCGlobal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ELCGlobal.h; sourceTree = ""; }; E507C28A1A6DED6F00191D11 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ELCImagePickerController.strings; sourceTree = ""; }; E507C28D1A6DED6F00191D11 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = ELCImagePickerController.strings; sourceTree = ""; }; + E507C2901A6DF4A400191D11 /* ELC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ELC.h; sourceTree = ""; }; + E507C2911A6DF4A400191D11 /* ELC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ELC.m; sourceTree = ""; }; F1DF783E196FA475003524A2 /* ELCConsole.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ELCConsole.h; sourceTree = ""; }; F1DF783F196FA475003524A2 /* ELCConsole.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ELCConsole.m; sourceTree = ""; }; F1DF7840196FA475003524A2 /* ELCOverlayImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ELCOverlayImageView.h; sourceTree = ""; }; @@ -178,8 +178,8 @@ 4252A0981593013500086D05 /* ELCImagePicker */ = { isa = PBXGroup; children = ( - E507C2851A6DED4C00191D11 /* ELCGlobal.m */, - E507C2861A6DED4C00191D11 /* ELCGlobal.h */, + E507C2901A6DF4A400191D11 /* ELC.h */, + E507C2911A6DF4A400191D11 /* ELC.m */, 1A2C0FFD17026CF0004FAFA0 /* ELCAlbumPickerController.h */, 1A2C0FFE17026CF0004FAFA0 /* ELCAlbumPickerController.m */, 1A2C0FFF17026CF0004FAFA0 /* ELCAsset.h */, @@ -294,6 +294,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + E507C2921A6DF4A400191D11 /* ELC.m in Sources */, 1D60589B0D05DD56006BFB54 /* main.m in Sources */, 1D3623260D0F684500981E51 /* ELCImagePickerDemoAppDelegate.m in Sources */, F1DF7842196FA475003524A2 /* ELCConsole.m in Sources */, @@ -303,7 +304,6 @@ 1A2C100717026CF0004FAFA0 /* ELCAlbumPickerController.m in Sources */, 1A2C100817026CF0004FAFA0 /* ELCAsset.m in Sources */, F1DF7843196FA475003524A2 /* ELCOverlayImageView.m in Sources */, - E507C2871A6DED4C00191D11 /* ELCGlobal.m in Sources */, 1A2C100917026CF0004FAFA0 /* ELCAssetCell.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0;