diff --git a/ExampleProject/Reader.xcodeproj/project.pbxproj b/ExampleProject/Reader.xcodeproj/project.pbxproj index e9deebac..1f9660f2 100644 --- a/ExampleProject/Reader.xcodeproj/project.pbxproj +++ b/ExampleProject/Reader.xcodeproj/project.pbxproj @@ -12,7 +12,6 @@ 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765FC0DF74451002DB57D /* CoreGraphics.framework */; }; 450A670411D27B9D00014BF5 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 450A670311D27B9D00014BF5 /* QuartzCore.framework */; }; - 4541A9D8122EA716001A5E60 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 4541A9D7122EA716001A5E60 /* Localizable.strings */; }; 4544394817FDD5E700781873 /* AppIcon-076.png in Resources */ = {isa = PBXBuildFile; fileRef = 4544394517FDD5E700781873 /* AppIcon-076.png */; }; 4544394917FDD5E700781873 /* AppIcon-120.png in Resources */ = {isa = PBXBuildFile; fileRef = 4544394617FDD5E700781873 /* AppIcon-120.png */; }; 4544394A17FDD5E700781873 /* AppIcon-152.png in Resources */ = {isa = PBXBuildFile; fileRef = 4544394717FDD5E700781873 /* AppIcon-152.png */; }; @@ -28,6 +27,7 @@ 45AB72EC141FC0A2003524C3 /* ReaderDemoController.m in Sources */ = {isa = PBXBuildFile; fileRef = 45AB72EA141FC0A2003524C3 /* ReaderDemoController.m */; }; 45BD5AFE13AE721A00D6FE97 /* MessageUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 45BD5AFD13AE721A00D6FE97 /* MessageUI.framework */; }; 45D5AD9F1610E66B00706B9A /* HISTORY.md in Resources */ = {isa = PBXBuildFile; fileRef = 45D5AD9E1610E66B00706B9A /* HISTORY.md */; }; + 70A37E5E1934B47200D80C41 /* ReaderLanguage.m in Sources */ = {isa = PBXBuildFile; fileRef = 70A37E5D1934B47200D80C41 /* ReaderLanguage.m */; }; 9F3700CC192E0548003391C5 /* hackermonthly-issue2.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 9F3700CB192E0548003391C5 /* hackermonthly-issue2.pdf */; }; 9F3700F7192E0672003391C5 /* Reader.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 9F3700CE192E0672003391C5 /* Reader.bundle */; }; 9F3700F8192E0672003391C5 /* ReaderConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F3700D1192E0672003391C5 /* ReaderConstants.m */; }; @@ -59,7 +59,6 @@ 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 32CA4F630368D1EE00C91783 /* Reader-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Reader-Prefix.pch"; sourceTree = ""; }; 450A670311D27B9D00014BF5 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; - 4541A9D5122EA686001A5E60 /* en */ = {isa = PBXFileReference; fileEncoding = 10; indentWidth = 4; lastKnownFileType = text.plist.strings; name = en; path = Resources/en.lproj/Localizable.strings; sourceTree = ""; tabWidth = 4; }; 4544394517FDD5E700781873 /* AppIcon-076.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "AppIcon-076.png"; path = "Graphics/AppIcon-076.png"; sourceTree = ""; }; 4544394617FDD5E700781873 /* AppIcon-120.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "AppIcon-120.png"; path = "Graphics/AppIcon-120.png"; sourceTree = ""; }; 4544394717FDD5E700781873 /* AppIcon-152.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "AppIcon-152.png"; path = "Graphics/AppIcon-152.png"; sourceTree = ""; }; @@ -67,7 +66,6 @@ 4555C74A14211A00005F448D /* ReaderBookDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReaderBookDelegate.h; sourceTree = ""; }; 4555C74B14211A00005F448D /* ReaderBookDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ReaderBookDelegate.m; sourceTree = ""; }; 4583767E1533B0AC003CD230 /* AppIcon-144.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "AppIcon-144.png"; path = "Graphics/AppIcon-144.png"; sourceTree = ""; }; - 458BF155143E077500CDF567 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = Resources/de.lproj/Localizable.strings; sourceTree = ""; }; 458DDFD6140D45FA00C5DA94 /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = System/Library/Frameworks/ImageIO.framework; sourceTree = SDKROOT; }; 45AB72B9141FBFCA003524C3 /* AppIcon-057.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "AppIcon-057.png"; path = "Graphics/AppIcon-057.png"; sourceTree = ""; }; 45AB72BA141FBFCA003524C3 /* AppIcon-072.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "AppIcon-072.png"; path = "Graphics/AppIcon-072.png"; sourceTree = ""; }; @@ -79,6 +77,8 @@ 45AB72EA141FC0A2003524C3 /* ReaderDemoController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ReaderDemoController.m; sourceTree = ""; }; 45BD5AFD13AE721A00D6FE97 /* MessageUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MessageUI.framework; path = System/Library/Frameworks/MessageUI.framework; sourceTree = SDKROOT; }; 45D5AD9E1610E66B00706B9A /* HISTORY.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HISTORY.md; sourceTree = ""; }; + 70A37E5C1934B47200D80C41 /* ReaderLanguage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReaderLanguage.h; sourceTree = ""; }; + 70A37E5D1934B47200D80C41 /* ReaderLanguage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ReaderLanguage.m; sourceTree = ""; }; 8D1107310486CEB800E47090 /* Reader-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Reader-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = ""; }; 9F3700CB192E0548003391C5 /* hackermonthly-issue2.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "hackermonthly-issue2.pdf"; sourceTree = ""; }; 9F3700CE192E0672003391C5 /* Reader.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Reader.bundle; sourceTree = ""; }; @@ -188,7 +188,6 @@ isa = PBXGroup; children = ( 9F3700CB192E0548003391C5 /* hackermonthly-issue2.pdf */, - 4541A9D7122EA716001A5E60 /* Localizable.strings */, 45D5AD9E1610E66B00706B9A /* HISTORY.md */, 45AB72DD141FC043003524C3 /* LICENSE.md */, ); @@ -261,6 +260,8 @@ 9F3700DE192E0672003391C5 /* Supporting */, 9F3700F5192E0672003391C5 /* ThumbsViewController.h */, 9F3700F6192E0672003391C5 /* ThumbsViewController.m */, + 70A37E5C1934B47200D80C41 /* ReaderLanguage.h */, + 70A37E5D1934B47200D80C41 /* ReaderLanguage.m */, ); path = src; sourceTree = ""; @@ -346,7 +347,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4541A9D8122EA716001A5E60 /* Localizable.strings in Resources */, 45AB72C6141FBFCA003524C3 /* AppIcon-057.png in Resources */, 45AB72C7141FBFCA003524C3 /* AppIcon-072.png in Resources */, 45AB72C8141FBFCA003524C3 /* AppIcon-114.png in Resources */, @@ -379,6 +379,7 @@ 9F3700FE192E0672003391C5 /* ReaderViewController.m in Sources */, 9F370103192E0672003391C5 /* ReaderThumbQueue.m in Sources */, 9F3700FC192E0672003391C5 /* ReaderDocument.m in Sources */, + 70A37E5E1934B47200D80C41 /* ReaderLanguage.m in Sources */, 9F370108192E0672003391C5 /* UINavigationController+NavBarAnimation.m in Sources */, 9F3700F9192E0672003391C5 /* ReaderContentPage.m in Sources */, 9F3700FF192E0672003391C5 /* CGPDFDocument.m in Sources */, @@ -397,18 +398,6 @@ }; /* End PBXSourcesBuildPhase section */ -/* Begin PBXVariantGroup section */ - 4541A9D7122EA716001A5E60 /* Localizable.strings */ = { - isa = PBXVariantGroup; - children = ( - 4541A9D5122EA686001A5E60 /* en */, - 458BF155143E077500CDF567 /* de */, - ); - name = Localizable.strings; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - /* Begin XCBuildConfiguration section */ 1D6058940D05DD3E006BFB54 /* Debug */ = { isa = XCBuildConfiguration; diff --git a/ExampleProject/Resources/de.lproj/Localizable.strings b/ExampleProject/Resources/de.lproj/Localizable.strings deleted file mode 100644 index 3ae3724d..00000000 Binary files a/ExampleProject/Resources/de.lproj/Localizable.strings and /dev/null differ diff --git a/ExampleProject/Resources/en.lproj/Localizable.strings b/ExampleProject/Resources/en.lproj/Localizable.strings deleted file mode 100644 index 69a9b69d..00000000 Binary files a/ExampleProject/Resources/en.lproj/Localizable.strings and /dev/null differ diff --git a/ReaderFramework/Reader.bundle/Reader.plist b/ReaderFramework/Reader.bundle/Reader.plist new file mode 100644 index 00000000..b78caf82 --- /dev/null +++ b/ReaderFramework/Reader.bundle/Reader.plist @@ -0,0 +1,9 @@ + + + + + StringsTable + Reader + + + diff --git a/ReaderFramework/Reader.bundle/de.lproj/Reader.strings b/ReaderFramework/Reader.bundle/de.lproj/Reader.strings new file mode 100644 index 00000000..885d2967 --- /dev/null +++ b/ReaderFramework/Reader.bundle/de.lproj/Reader.strings @@ -0,0 +1,34 @@ +// +// Localizable.strings - German +// Reader v2.7.3 +// +// Created by Julius Oklamcak on 2011-07-01. +// Copyright © 2011-2013 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +"More" = "Mehr"; +"Dismiss" = "Entlassen"; +"Email" = "Email"; +"Open In..." = "Öffnen Sie in..."; +"Bookmark" = "Bookmark"; +"Unbookmark" = "Unbookmark"; +"Print" = "Drucken"; +"Done" = "Fertig"; +"%i of %i" = "%1$i von %2$i"; \ No newline at end of file diff --git a/ReaderFramework/Reader.bundle/en.lproj/Reader.strings b/ReaderFramework/Reader.bundle/en.lproj/Reader.strings new file mode 100644 index 00000000..40030748 --- /dev/null +++ b/ReaderFramework/Reader.bundle/en.lproj/Reader.strings @@ -0,0 +1,34 @@ +// +// Localizable.strings - English +// Reader v2.7.3 +// +// Created by Julius Oklamcak on 2011-07-01. +// Copyright © 2011-2013 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +"More" = "More"; +"Dismiss" = "Dismiss"; +"Email" = "Email"; +"Open In..." = "Open In..."; +"Bookmark" = "Bookmark"; +"Unbookmark" = "Unbookmark"; +"Print" = "Print"; +"Done" = "Done"; +"%i of %i" = "%1$i of %2$i"; \ No newline at end of file diff --git a/ReaderFramework/Reader.bundle/fr.lproj/Reader.strings b/ReaderFramework/Reader.bundle/fr.lproj/Reader.strings new file mode 100644 index 00000000..88671f6b --- /dev/null +++ b/ReaderFramework/Reader.bundle/fr.lproj/Reader.strings @@ -0,0 +1,34 @@ +// +// Localizable.strings - French +// Reader v2.7.3 +// +// Created by Julius Oklamcak on 2011-07-01. +// Copyright © 2011-2013 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +"More" = "Plus"; +"Dismiss" = "Annuler"; +"Email" = "Email"; +"Open In..." = "Ouvrir dans..."; +"Bookmark" = "Ajouter aux signets"; +"Unbookmark" = "Supprimer des signets"; +"Print" = "Imprimer"; +"Done" = "Fermer"; +"%i of %i" = "%1$i sur %2$i"; \ No newline at end of file diff --git a/ReaderFramework/src/ReaderConstants.h b/ReaderFramework/src/ReaderConstants.h index a4440ad9..48c2941a 100644 --- a/ReaderFramework/src/ReaderConstants.h +++ b/ReaderFramework/src/ReaderConstants.h @@ -30,6 +30,7 @@ #import #define READER_BOOKMARKS TRUE +#define READER_ENABLE_MORE_BUTTON TRUE #define READER_ENABLE_MAIL TRUE #define READER_ENABLE_PRINT TRUE #define READER_ENABLE_THUMBS TRUE diff --git a/ReaderFramework/src/ReaderLanguage.h b/ReaderFramework/src/ReaderLanguage.h new file mode 100644 index 00000000..4746b285 --- /dev/null +++ b/ReaderFramework/src/ReaderLanguage.h @@ -0,0 +1,30 @@ +// +// ReaderLanguage.m +// Reader v2.7.3 +// +// Created by Emmanuel Tabard on 2014-05-27. +// Copyright © 2011-2013 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import + +@interface ReaderLanguage : NSObject ++(NSString *)get:(NSString *)key; +@end diff --git a/ReaderFramework/src/ReaderLanguage.m b/ReaderFramework/src/ReaderLanguage.m new file mode 100644 index 00000000..62ea0d33 --- /dev/null +++ b/ReaderFramework/src/ReaderLanguage.m @@ -0,0 +1,46 @@ +// +// ReaderLanguage.h +// Reader v2.7.3 +// +// Created by Emmanuel Tabard on 2014-05-27. +// Copyright © 2011-2013 Julius Oklamcak. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to +// do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#import "ReaderLanguage.h" + +@implementation ReaderLanguage + +static NSBundle *bundle = nil; + ++(void)initialize { + NSUserDefaults* defs = [NSUserDefaults standardUserDefaults]; + NSArray* languages = [defs objectForKey:@"AppleLanguages"]; + + NSString *bundlePath = [[NSBundle mainBundle] pathForResource:@"Reader" ofType:@"bundle"]; + bundle = [NSBundle bundleWithPath:bundlePath]; + bundle = [NSBundle bundleWithPath:[bundle pathForResource:[languages objectAtIndex:0] ofType:@"lproj" ]]; + +} + ++(NSString *)get:(NSString *)key { + return NSLocalizedStringFromTableInBundle(key, @"Reader", bundle ,nil); +} + +@end diff --git a/ReaderFramework/src/ReaderMainPagebar.m b/ReaderFramework/src/ReaderMainPagebar.m index 69289069..30b77fd6 100644 --- a/ReaderFramework/src/ReaderMainPagebar.m +++ b/ReaderFramework/src/ReaderMainPagebar.m @@ -26,6 +26,7 @@ #import "ReaderMainPagebar.h" #import "ReaderThumbCache.h" #import "ReaderDocument.h" +#import "ReaderLanguage.h" #import @@ -124,7 +125,7 @@ - (void)updatePageNumberText:(NSInteger)page { NSInteger pages = [document.pageCount integerValue]; // Total pages - NSString *format = NSLocalizedString(@"%i of %i", @"format"); // Format + NSString *format = [ReaderLanguage get:@"%i of %i"]; // NSLocalizedString(@"%i of %i", @"format"); // Format NSString *number = [NSString stringWithFormat:format, page, pages]; // Text diff --git a/ReaderFramework/src/ReaderViewController.m b/ReaderFramework/src/ReaderViewController.m index f025075b..70cf4ddc 100644 --- a/ReaderFramework/src/ReaderViewController.m +++ b/ReaderFramework/src/ReaderViewController.m @@ -30,16 +30,17 @@ #import "ReaderContentView.h" #import "ReaderThumbCache.h" #import "ReaderThumbQueue.h" +#import "ReaderLanguage.h" #import "UINavigationController+NavBarAnimation.h" #import -NSString * const ReaderActionSheetItemTitleEmail = @"Email"; -NSString * const ReaderActionSheetItemTitlePrint = @"Print"; -NSString * const ReaderActionSheetItemTitleOpenIn = @"Open In..."; -NSString * const ReaderActionSheetItemTitleBookmark = @"Bookmark"; -NSString * const ReaderActionSheetItemTitleUnbookmark = @"Unbookmark"; +static NSString *ReaderActionSheetItemTitleEmail = nil; +static NSString *ReaderActionSheetItemTitlePrint = nil; +static NSString *ReaderActionSheetItemTitleOpenIn = nil; +static NSString *ReaderActionSheetItemTitleBookmark = nil; +static NSString *ReaderActionSheetItemTitleUnbookmark = nil; @interface ReaderViewController () @@ -87,6 +88,25 @@ @implementation ReaderViewController #pragma mark Support methods ++ (void)initialize +{ + if (ReaderActionSheetItemTitleEmail == nil) { + ReaderActionSheetItemTitleEmail = [ReaderLanguage get:@"Email"]; + } + if (ReaderActionSheetItemTitlePrint == nil) { + ReaderActionSheetItemTitlePrint = [ReaderLanguage get:@"Print"]; + } + if (ReaderActionSheetItemTitleOpenIn == nil) { + ReaderActionSheetItemTitleOpenIn = [ReaderLanguage get:@"Open In..."]; + } + if (ReaderActionSheetItemTitleBookmark == nil) { + ReaderActionSheetItemTitleBookmark = [ReaderLanguage get:@"Bookmark"]; + } + if (ReaderActionSheetItemTitleUnbookmark == nil) { + ReaderActionSheetItemTitleUnbookmark = [ReaderLanguage get:@"Unbookmark"]; + } +} + - (void)updateScrollViewContentSize { NSInteger count = [_document.pageCount integerValue]; @@ -365,24 +385,32 @@ - (void)viewDidLoad -(void)setUpBarButtonItems { if ([self isPresentedModally]) { - doneBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone - target:self - action:@selector(pushDoneBarButtonItem:)]; + doneBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:[ReaderLanguage get:@"Done"] style:UIBarButtonItemStyleDone + target:self + action:@selector(pushDoneBarButtonItem:)]; [self.navigationItem setLeftBarButtonItem:doneBarButtonItem]; } + NSMutableArray *buttons = [[NSMutableArray alloc] init]; +#if (READER_ENABLE_MORE_BUTTON == TRUE) // Option + moreBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction + target:self + action:@selector(pushActionBarButtonItem:)]; + + [buttons addObject:moreBarButtonItem]; +#endif +#if (READER_ENABLE_THUMBS == TRUE) thumbsBarButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"Reader.bundle/Reader-Thumbs"] style:UIBarButtonItemStylePlain target:self action:@selector(pushThumbsBarButtonItem:)]; + [buttons addObject:thumbsBarButton]; +#endif - - moreBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction - target:self - action:@selector(pushActionBarButtonItem:)]; - - [self.navigationItem setRightBarButtonItems:@[moreBarButtonItem, thumbsBarButton]]; + if ([buttons count]) { + [self.navigationItem setRightBarButtonItems:buttons]; + } } @@ -806,19 +834,26 @@ -(void)pushDoneBarButtonItem:(id)sender { } -(void)pushActionBarButtonItem:(id)sender { - NSInteger page = [_document.pageNumber integerValue]; - - BOOL bookmarked = [_document.bookmarks containsIndex:page]; - moreActionSheet = [[UIActionSheet alloc] initWithTitle:@"More" + moreActionSheet = [[UIActionSheet alloc] initWithTitle:[ReaderLanguage get:@"More"] delegate:self - cancelButtonTitle:@"Dismiss" + cancelButtonTitle:nil destructiveButtonTitle:nil - otherButtonTitles:(bookmarked ? ReaderActionSheetItemTitleUnbookmark : ReaderActionSheetItemTitleBookmark), - ReaderActionSheetItemTitleEmail, - ReaderActionSheetItemTitleOpenIn, - ReaderActionSheetItemTitlePrint, nil]; - + otherButtonTitles:nil]; +#if (READER_BOOKMARKS == TRUE) //option + NSInteger page = [_document.pageNumber integerValue]; + BOOL bookmarked = [_document.bookmarks containsIndex:page]; + [moreActionSheet addButtonWithTitle:(bookmarked ? ReaderActionSheetItemTitleUnbookmark : ReaderActionSheetItemTitleBookmark)]; +#endif +#if (READER_ENABLE_MAIL == TRUE) //option + [moreActionSheet addButtonWithTitle:ReaderActionSheetItemTitleEmail]; +#endif + [moreActionSheet addButtonWithTitle:ReaderActionSheetItemTitleOpenIn]; +#if (READER_ENABLE_PRINT == TRUE) //option + [moreActionSheet addButtonWithTitle:ReaderActionSheetItemTitlePrint]; +#endif + [moreActionSheet addButtonWithTitle:[ReaderLanguage get:@"Dismiss"]]; + moreActionSheet.cancelButtonIndex = moreActionSheet.numberOfButtons - 1; [moreActionSheet showFromBarButtonItem:moreBarButtonItem animated:YES]; } diff --git a/ReaderFramework/src/ThumbsViewController.m b/ReaderFramework/src/ThumbsViewController.m index 3d093c33..5376e855 100644 --- a/ReaderFramework/src/ThumbsViewController.m +++ b/ReaderFramework/src/ThumbsViewController.m @@ -28,7 +28,7 @@ #import "ReaderThumbRequest.h" #import "ReaderThumbCache.h" #import "ReaderDocument.h" - +#import "ReaderLanguage.h" #import @interface ThumbsViewController () @@ -153,19 +153,24 @@ - (void)viewDidLoad } -(void)setUpNavigationBarItems { - doneBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone + doneBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:[ReaderLanguage get:@"Done"] style:UIBarButtonItemStyleDone target:self action:@selector(pushDoneBarButtonItem:)]; [self.navigationItem setLeftBarButtonItem:doneBarButtonItem]; UIImage *thumbsImage = [UIImage imageNamed:@"Reader.bundle/Reader-Thumbs"]; + NSMutableArray *buttonItems = [NSMutableArray arrayWithObjects:thumbsImage, nil]; + +#if (READER_BOOKMARKS == TRUE) UIImage *bookmarkImage = [UIImage imageNamed:@"Reader.bundle/Reader-Mark-Y"]; - NSArray *buttonItems = [NSArray arrayWithObjects:thumbsImage, bookmarkImage, nil]; - + [buttonItems addObject:bookmarkImage]; +#endif toggleBookmarksSegmentedControl = [[UISegmentedControl alloc] initWithItems:buttonItems]; [toggleBookmarksSegmentedControl addTarget:self action:@selector(pushToggleBookmarkSegmentedControl:) forControlEvents:UIControlEventValueChanged]; [toggleBookmarksSegmentedControl setWidth:60.0f forSegmentAtIndex:0]; +#if (READER_BOOKMARKS == TRUE) [toggleBookmarksSegmentedControl setWidth:60.0f forSegmentAtIndex:1]; +#endif [toggleBookmarksSegmentedControl setSelectedSegmentIndex:0]; [self.navigationItem setTitleView:toggleBookmarksSegmentedControl];