Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Japanese translation. #103

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Classes/ELCImagePicker/ELC.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@interface ELC : NSObject

+ (void)setAlwaysUseMainBundle:(BOOL)alwaysUseMainBundle;
+ (NSBundle *)bundle;
+ (NSString *)LocalizedString:(NSString *)key;

@end
28 changes: 28 additions & 0 deletions Classes/ELCImagePicker/ELC.m
Original file line number Diff line number Diff line change
@@ -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
12 changes: 6 additions & 6 deletions Classes/ELCImagePicker/ELCAlbumPickerController.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#import "ELCImagePickerController.h"
#import "ELCAssetTablePicker.h"
#import <MobileCoreServices/UTCoreTypes.h>
#import "ELC.h"

@interface ELCAlbumPickerController ()

Expand All @@ -27,8 +28,7 @@ - (void)viewDidLoad
{
[super viewDidLoad];
[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];

[self.navigationItem setTitle:NSLocalizedString(@"Loading...", nil)];
[self.navigationItem setTitle:[ELC LocalizedString:@"Loading..."]];

UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self.parent action:@selector(cancelImagePicker)];
[self.navigationItem setRightBarButtonItem:cancelButton];
Expand Down Expand Up @@ -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 = [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:NSLocalizedString(@"Error", nil) message:errorMessage delegate:nil cancelButtonTitle:NSLocalizedString(@"Ok", nil) otherButtonTitles:nil] show];
[[[UIAlertView alloc] initWithTitle:[ELC LocalizedString:@"Error"] message:errorMessage delegate:nil cancelButtonTitle:[ELC LocalizedString:@"Ok"] otherButtonTitles:nil] show];
}

[self.navigationItem setTitle:nil];
Expand Down Expand Up @@ -106,7 +106,7 @@ - (void)viewWillDisappear:(BOOL)animated {
- (void)reloadTableView
{
[self.tableView reloadData];
[self.navigationItem setTitle:NSLocalizedString(@"Select an Album", nil)];
[self.navigationItem setTitle:[ELC LocalizedString:@"Select an Album"]];
}

- (BOOL)shouldSelectAsset:(ELCAsset *)asset previousCount:(NSUInteger)previousCount
Expand Down
7 changes: 4 additions & 3 deletions Classes/ELCImagePicker/ELCAssetTablePicker.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#import "ELCAsset.h"
#import "ELCAlbumPickerController.h"
#import "ELCConsole.h"
#import "ELC.h"

@interface ELCAssetTablePicker ()

Expand Down Expand Up @@ -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:[ELC LocalizedString:@"Loading..."]];
}

[self performSelectorInBackground:@selector(preparePhotos) withObject:nil];
Expand Down Expand Up @@ -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 ? [ELC LocalizedString:@"Pick Photo"] : [ELC LocalizedString:@"Pick Photos"]];
});
}
}
Expand Down
7 changes: 4 additions & 3 deletions Classes/ELCImagePicker/ELCImagePickerController.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#import <CoreLocation/CoreLocation.h>
#import <MobileCoreServices/UTCoreTypes.h>
#import "ELCConsole.h"
#import "ELC.h"

@implementation ELCImagePickerController

Expand Down Expand Up @@ -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:[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:NSLocalizedString(@"Okay", nil), nil] show];
otherButtonTitles:[ELC LocalizedString:@"Okay"], nil] show];
}
return shouldSelect;
}
Expand Down
Binary file not shown.
Binary file not shown.
3 changes: 2 additions & 1 deletion Classes/ELCImagePickerDemoViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#import "ELCImagePickerDemoAppDelegate.h"
#import "ELCImagePickerDemoViewController.h"
#import <MobileCoreServices/UTCoreTypes.h>

#import "ELC.h"

@interface ELCImagePickerDemoViewController ()

Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions ELCImagePickerController.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
53 changes: 53 additions & 0 deletions ELCImagePickerDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
83C6BC9714476B280064D71D /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 83C6BC9514476B280064D71D /* [email protected] */; };
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 */; };
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 */
Expand Down Expand Up @@ -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 = "<group>"; };
A58058B417EB865B0078600C /* ELCAssetPickerFilterDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ELCAssetPickerFilterDelegate.h; sourceTree = "<group>"; };
E29A5E3B1239C42A008BB149 /* AssetsLibrary.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AssetsLibrary.framework; path = System/Library/Frameworks/AssetsLibrary.framework; sourceTree = SDKROOT; };
E507C28A1A6DED6F00191D11 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ELCImagePickerController.strings; sourceTree = "<group>"; };
E507C28D1A6DED6F00191D11 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = ELCImagePickerController.strings; sourceTree = "<group>"; };
E507C2901A6DF4A400191D11 /* ELC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ELC.h; sourceTree = "<group>"; };
E507C2911A6DF4A400191D11 /* ELC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ELC.m; sourceTree = "<group>"; };
F1DF783E196FA475003524A2 /* ELCConsole.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ELCConsole.h; sourceTree = "<group>"; };
F1DF783F196FA475003524A2 /* ELCConsole.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ELCConsole.m; sourceTree = "<group>"; };
F1DF7840196FA475003524A2 /* ELCOverlayImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ELCOverlayImageView.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -144,6 +151,8 @@
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
E507C2881A6DED6F00191D11 /* ja.lproj */,
E507C28B1A6DED6F00191D11 /* en.lproj */,
1A4C631217380272001E0978 /* Overlay.png */,
1A4C631317380272001E0978 /* [email protected] */,
83C6BC9514476B280064D71D /* [email protected] */,
Expand All @@ -169,6 +178,8 @@
4252A0981593013500086D05 /* ELCImagePicker */ = {
isa = PBXGroup;
children = (
E507C2901A6DF4A400191D11 /* ELC.h */,
E507C2911A6DF4A400191D11 /* ELC.m */,
1A2C0FFD17026CF0004FAFA0 /* ELCAlbumPickerController.h */,
1A2C0FFE17026CF0004FAFA0 /* ELCAlbumPickerController.m */,
1A2C0FFF17026CF0004FAFA0 /* ELCAsset.h */,
Expand All @@ -190,6 +201,24 @@
path = ELCImagePicker;
sourceTree = "<group>";
};
E507C2881A6DED6F00191D11 /* ja.lproj */ = {
isa = PBXGroup;
children = (
E507C2891A6DED6F00191D11 /* ELCImagePickerController.strings */,
);
name = ja.lproj;
path = Classes/ELCImagePicker/Resources/ja.lproj;
sourceTree = "<group>";
};
E507C28B1A6DED6F00191D11 /* en.lproj */ = {
isa = PBXGroup;
children = (
E507C28C1A6DED6F00191D11 /* ELCImagePickerController.strings */,
);
name = en.lproj;
path = Classes/ELCImagePicker/Resources/en.lproj;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -228,6 +257,8 @@
Japanese,
French,
German,
ja,
en,
);
mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
projectDirPath = "";
Expand All @@ -248,6 +279,8 @@
83C6BC9714476B280064D71D /* [email protected] 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 /* [email protected] in Resources */,
1A4C631417380272001E0978 /* Overlay.png in Resources */,
1A4C631517380272001E0978 /* [email protected] in Resources */,
Expand All @@ -261,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 */,
Expand All @@ -276,6 +310,25 @@
};
/* End PBXSourcesBuildPhase section */

/* Begin PBXVariantGroup section */
E507C2891A6DED6F00191D11 /* ELCImagePickerController.strings */ = {
isa = PBXVariantGroup;
children = (
E507C28A1A6DED6F00191D11 /* ja */,
);
name = ELCImagePickerController.strings;
sourceTree = "<group>";
};
E507C28C1A6DED6F00191D11 /* ELCImagePickerController.strings */ = {
isa = PBXVariantGroup;
children = (
E507C28D1A6DED6F00191D11 /* en */,
);
name = ELCImagePickerController.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */

/* Begin XCBuildConfiguration section */
1D6058940D05DD3E006BFB54 /* Debug */ = {
isa = XCBuildConfiguration;
Expand Down