Skip to content

Commit

Permalink
English localization add
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakey committed Feb 8, 2017
1 parent 1ac0ac0 commit eb29dfb
Show file tree
Hide file tree
Showing 7 changed files with 489 additions and 17 deletions.
23 changes: 21 additions & 2 deletions ProfilesManager.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
A244DCBB1AFA0A2E00EB7E61 /* ProfilesManagerViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A244DCB41AFA0A2E00EB7E61 /* ProfilesManagerViewController.xib */; };
A244DCBC1AFA0A2E00EB7E61 /* ProfilesNode.m in Sources */ = {isa = PBXBuildFile; fileRef = A244DCB71AFA0A2E00EB7E61 /* ProfilesNode.m */; };
A2A8FA8A1AFA43E10087DD68 /* DragOutlineView.m in Sources */ = {isa = PBXBuildFile; fileRef = A2A8FA881AFA43E10087DD68 /* DragOutlineView.m */; };
B80FCFC31E4AAE480044098D /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = B80FCFC51E4AAE480044098D /* Localizable.strings */; };
B8C823BE1E0288D9004BEAEF /* NSData+JKBase64.m in Sources */ = {isa = PBXBuildFile; fileRef = B8C823BD1E0288D8004BEAEF /* NSData+JKBase64.m */; };
/* End PBXBuildFile section */

Expand All @@ -41,6 +42,9 @@
A244DCB71AFA0A2E00EB7E61 /* ProfilesNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProfilesNode.m; sourceTree = "<group>"; };
A2A8FA881AFA43E10087DD68 /* DragOutlineView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DragOutlineView.m; sourceTree = "<group>"; };
A2A8FA891AFA43E10087DD68 /* DragOutlineView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DragOutlineView.h; sourceTree = "<group>"; };
B80FCFC41E4AAE480044098D /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
B80FCFC61E4AAE560044098D /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/MainMenu.strings"; sourceTree = "<group>"; };
B80FCFC71E4AAE560044098D /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = "<group>"; };
B856B7801E25EDC800060107 /* ProfilesManager.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = ProfilesManager.entitlements; sourceTree = "<group>"; };
B8C823BC1E0288D8004BEAEF /* NSData+JKBase64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+JKBase64.h"; sourceTree = "<group>"; };
B8C823BD1E0288D8004BEAEF /* NSData+JKBase64.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSData+JKBase64.m"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -96,6 +100,7 @@
isa = PBXGroup;
children = (
A211931D1AF1CA5B0064CA7D /* Info.plist */,
B80FCFC51E4AAE480044098D /* Localizable.strings */,
A21193211AF1CA5B0064CA7D /* main.m */,
);
name = "Supporting Files";
Expand Down Expand Up @@ -196,6 +201,7 @@
knownRegions = (
en,
Base,
"zh-Hans",
);
mainGroup = A21193101AF1CA5B0064CA7D;
productRefGroup = A211931A1AF1CA5B0064CA7D /* Products */;
Expand All @@ -213,6 +219,7 @@
buildActionMask = 2147483647;
files = (
A244DCBB1AFA0A2E00EB7E61 /* ProfilesManagerViewController.xib in Resources */,
B80FCFC31E4AAE480044098D /* Localizable.strings in Resources */,
A21193241AF1CA5B0064CA7D /* Images.xcassets in Resources */,
A21193271AF1CA5B0064CA7D /* MainMenu.xib in Resources */,
);
Expand Down Expand Up @@ -243,17 +250,28 @@
isa = PBXVariantGroup;
children = (
A21193261AF1CA5B0064CA7D /* Base */,
B80FCFC61E4AAE560044098D /* zh-Hans */,
);
name = MainMenu.xib;
sourceTree = "<group>";
};
B80FCFC51E4AAE480044098D /* Localizable.strings */ = {
isa = PBXVariantGroup;
children = (
B80FCFC41E4AAE480044098D /* en */,
B80FCFC71E4AAE560044098D /* zh-Hans */,
);
name = Localizable.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */

/* Begin XCBuildConfiguration section */
A21193341AF1CA5B0064CA7D /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand Down Expand Up @@ -288,7 +306,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MACOSX_DEPLOYMENT_TARGET = 10.9;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
Expand All @@ -299,6 +317,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand Down Expand Up @@ -327,7 +346,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MACOSX_DEPLOYMENT_TARGET = 10.9;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
};
Expand Down
46 changes: 33 additions & 13 deletions ProfilesManager/Controller/ProfilesManagerViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ - (void)viewDidLoad {
[[NSFileManager defaultManager]copyItemAtPath:result toPath:[_profileDir stringByAppendingString:[result lastPathComponent]?:@""] error:&error];
if(error)
{
[self showMessage:[error localizedDescription]];
[self showMessage:[error localizedDescription] completionHandler:^(NSModalResponse returnCode) {

}];
}
}
[self loadProfileFiles];
Expand Down Expand Up @@ -228,23 +230,23 @@ - (void)menuWillOpen:(NSMenu *)menu
NSMenuItem *moveTrashItem = [menu itemWithTag:1000];
if (!moveTrashItem)
{
moveTrashItem = [[NSMenuItem alloc] initWithTitle:@"移动到废纸篓" action:@selector(moveTrashItemClick:) keyEquivalent:@""];
moveTrashItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"move to trash",nil) action:@selector(moveTrashItemClick:) keyEquivalent:@""];
[moveTrashItem setTarget:self];
[moveTrashItem setTag:1000];
[menu addItem:moveTrashItem];
}
NSMenuItem *deleteItem = [menu itemWithTag:1001];
if (!deleteItem)
{
deleteItem = [[NSMenuItem alloc] initWithTitle:@"完全删除" action:@selector(deleteItemClick:) keyEquivalent:@""];
deleteItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"delete",nil) action:@selector(deleteItemClick:) keyEquivalent:@""];
[deleteItem setTarget:self];
[deleteItem setTag:1001];
[menu addItem:deleteItem];
}
NSMenuItem *gotoItemName = [menu itemWithTag:1002];
if (!gotoItemName)
{
gotoItemName = [[NSMenuItem alloc] initWithTitle:@"定位" action:@selector(gotoClick:) keyEquivalent:@""];
gotoItemName = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"show in finder",nil) action:@selector(gotoClick:) keyEquivalent:@""];
[gotoItemName setTarget:self];
[gotoItemName setTag:1002];
[menu addItem:gotoItemName];
Expand All @@ -262,15 +264,15 @@ - (void)menuWillOpen:(NSMenu *)menu
NSMenuItem *refreshItem = [menu itemWithTag:2000];
if (!refreshItem)
{
refreshItem = [[NSMenuItem alloc] initWithTitle:@"刷新列表" action:@selector(refreshItemClick:) keyEquivalent:@""];
refreshItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"refresh table",nil) action:@selector(refreshItemClick:) keyEquivalent:@""];
[refreshItem setTarget:self];
[refreshItem setTag:2000];
[menu addItem:refreshItem];
}
NSMenuItem *importItem = [menu itemWithTag:2001];
if (!importItem)
{
importItem = [[NSMenuItem alloc] initWithTitle:@"导入" action:@selector(importItemClick:) keyEquivalent:@""];
importItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"import profile",nil) action:@selector(importItemClick:) keyEquivalent:@""];
[importItem setTarget:self];
[importItem setTag:2001];
[menu addItem:importItem];
Expand All @@ -280,7 +282,7 @@ - (void)menuWillOpen:(NSMenu *)menu
NSMenuItem *exportItem = [menu itemWithTag:3001];
if (!exportItem)
{
exportItem = [[NSMenuItem alloc] initWithTitle:@"导出证书Cer" action:@selector(exportCerItemClick:) keyEquivalent:@""];
exportItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"export certificate file",nil) action:@selector(exportCerItemClick:) keyEquivalent:@""];
[exportItem setTarget:self];
[exportItem setTag:3001];
[menu addItem:exportItem];
Expand All @@ -291,8 +293,23 @@ - (void)menuWillOpen:(NSMenu *)menu
#pragma mark Operation
- (void)deleteItemClick:(id)sender
{

NSInteger index = [self.treeView clickedRow];

NSAlert *alert = [[NSAlert alloc]init];
[alert addButtonWithTitle:NSLocalizedString(@"Ok",nil)];
[alert addButtonWithTitle:NSLocalizedString(@"Cancel",nil)];
alert.messageText = NSLocalizedString(@"Confirm Delete Opration",nil);
alert.informativeText = NSLocalizedString(@"Delete this profie item permanently,can't rollback!",nil);
[alert setAlertStyle:NSAlertStyleCritical];
[alert beginSheetModalForWindow:[self.view window] completionHandler:^(NSModalResponse returnCode) {
if (returnCode == NSAlertFirstButtonReturn ) {
[self totalDelteItem:index];
}else if (returnCode == NSAlertSecondButtonReturn){
NSLog(@"this is Cancel Button tap");
}
}];
}
- (void)totalDelteItem:(NSInteger)index{
ProfilesNode *node = [self.treeView itemAtRow:index];

NSLog(@"deleteItem inde%zd",index);
Expand All @@ -304,7 +321,6 @@ - (void)deleteItemClick:(id)sender

[self deleteProfile:node.filePath option:YES];
[self loadProfileFiles];

}
- (void)moveTrashItemClick:(id)sender{
NSInteger index = [self.treeView clickedRow];
Expand Down Expand Up @@ -333,7 +349,9 @@ -(BOOL)deleteProfile:(NSString*)filePath option:(BOOL)totle{
}
if(error)
{
[self showMessage:[error localizedDescription]];
[self showMessage:[error localizedDescription] completionHandler:^(NSModalResponse returnCode) {

}];

}
return result;
Expand Down Expand Up @@ -377,7 +395,9 @@ - (void)importItemClick:(id)sender{
}
if(error)
{
[self showMessage:[error localizedDescription]];
[self showMessage:[error localizedDescription] completionHandler:^(NSModalResponse returnCode) {

}];

}
[self loadProfileFiles];
Expand Down Expand Up @@ -410,11 +430,11 @@ - (void)exportCerItemClick:(id)sender
}
}
#pragma mark --alert
-(void)showMessage:(NSString*)message{
-(void)showMessage:(NSString*)message completionHandler:(void (^)(NSModalResponse returnCode))handler{
NSAlert *alert = [[NSAlert alloc] init];
[alert setMessageText:message];
[alert beginSheetModalForWindow:self.view.window completionHandler:^(NSModalResponse returnCode) {

handler(returnCode);
}];

}
Expand Down
2 changes: 1 addition & 1 deletion ProfilesManager/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>3</string>
<string>4</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.developer-tools</string>
<key>LSMinimumSystemVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion ProfilesManager/Model/ProfilesNode.m
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ - (id)initWithRootNode:(ProfilesNode *)rootNode originInfo:(id)info key:(NSStrin

if(_uuid){
NSDate *expiration = [dict objectForKey:@"ExpirationDate"];
_detail = [[NSDate date] compare:expiration] == NSOrderedDescending ?@"过期(expire)":@"有效(valid)";
_detail = [[NSDate date] compare:expiration] == NSOrderedDescending ?NSLocalizedString(@"expired",nil):NSLocalizedString(@"valid",nil);
_type = [dict objectForKey:@"Name"];
}

Expand Down
22 changes: 22 additions & 0 deletions ProfilesManager/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
Localizable.strings
ProfilesManager

Created by Jakey on 2017/2/8.
Copyright © 2017年 Jakey. All rights reserved.
*/

"move to trash" = "move to trash";
"delete" = "delete";
"show in finder" = "show in finder";
"refresh table" = "refresh";
"import profile" = "import profile";
"export certificate file" = "export certificate file";
"expired" = "expired";
"valid" = "valid";
"OK" = "OK";
"Cancel" = "Cancel";
"Confirm Delete Opration" = "Confirm Delete Opration";
"Delete this profie item permanently,can't rollback!" = "Delete this profie item permanently,can't rollback!";


21 changes: 21 additions & 0 deletions ProfilesManager/zh-Hans.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
Localizable.strings
ProfilesManager

Created by Jakey on 2017/2/8.
Copyright © 2017年 Jakey. All rights reserved.
*/

"move to trash" = "移动到废纸篓";
"delete" = "完全删除";
"show in finder" = "定位文件";
"refresh table" = "刷新列表";
"import profile" = "导入profile";
"export certificate file" = "导出证书文件";
"expired" = "过期";
"valid" = "有效";
"OK" = "确定";
"Cancel" = "取消";
"Confirm Delete Opration" = "确认删除操作";
"Delete this profie item permanently,can't rollback!" = "完全删除这个profie文件,不可回滚!";

Loading

0 comments on commit eb29dfb

Please sign in to comment.