Skip to content
This repository has been archived by the owner on Aug 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #64 from readium/fixes/l10n
Browse files Browse the repository at this point in the history
Localize the framework
  • Loading branch information
aferditamuriqi authored Jun 16, 2019
2 parents 192ae99 + d5e39f5 commit df76dcd
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "readium/r2-shared-swift" == 1.2.11
github "readium/r2-shared-swift" == 1.2.12
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "readium/r2-shared-swift" "1.2.11"
github "readium/r2-shared-swift" "1.2.12"
32 changes: 29 additions & 3 deletions r2-navigator-swift.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
CACE84FB2254BFEE00E19E8B /* EditingAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = CACE84FA2254BFEE00E19E8B /* EditingAction.swift */; };
CACE851F225CDE3400E19E8B /* FixedDocumentWebView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CACE851E225CDE3300E19E8B /* FixedDocumentWebView.swift */; };
CACE8521225CDFB000E19E8B /* ReflowableDocumentWebView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CACE8520225CDFB000E19E8B /* ReflowableDocumentWebView.swift */; };
CAD178B622B3B553004E6812 /* R2NavigatorLocalizedString.swift in Sources */ = {isa = PBXBuildFile; fileRef = CAD178B522B3B553004E6812 /* R2NavigatorLocalizedString.swift */; };
CAD178BA22B3B5B6004E6812 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = CAD178BC22B3B5B6004E6812 /* Localizable.strings */; };
CAEACA222272EFBD00476340 /* ImageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CAEACA212272EFBD00476340 /* ImageViewController.swift */; };
F341C2711F506ED5005E6758 /* UserSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = F341C2701F506ED5005E6758 /* UserSettings.swift */; };
F3E7D3D41F4D83B000DF166D /* r2-navigator-swift.h in Headers */ = {isa = PBXBuildFile; fileRef = F3E7D3C61F4D83B000DF166D /* r2-navigator-swift.h */; settings = {ATTRIBUTES = (Public, ); }; };
Expand All @@ -45,6 +47,8 @@
CACE84FA2254BFEE00E19E8B /* EditingAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditingAction.swift; sourceTree = "<group>"; };
CACE851E225CDE3300E19E8B /* FixedDocumentWebView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FixedDocumentWebView.swift; sourceTree = "<group>"; };
CACE8520225CDFB000E19E8B /* ReflowableDocumentWebView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReflowableDocumentWebView.swift; sourceTree = "<group>"; };
CAD178B522B3B553004E6812 /* R2NavigatorLocalizedString.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = R2NavigatorLocalizedString.swift; sourceTree = "<group>"; };
CAD178BB22B3B5B6004E6812 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
CAEACA212272EFBD00476340 /* ImageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageViewController.swift; sourceTree = "<group>"; };
F341C2701F506ED5005E6758 /* UserSettings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserSettings.swift; sourceTree = "<group>"; };
F3E7D3C31F4D83B000DF166D /* R2Navigator.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = R2Navigator.framework; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -86,6 +90,7 @@
children = (
CA479DC2226493570053445E /* UIView.swift */,
CA479DC42264AEA20053445E /* UIColor.swift */,
CAD178B522B3B553004E6812 /* R2NavigatorLocalizedString.swift */,
);
path = Toolkit;
sourceTree = "<group>";
Expand Down Expand Up @@ -116,6 +121,14 @@
path = Resources;
sourceTree = "<group>";
};
CAD178B722B3B580004E6812 /* Resources */ = {
isa = PBXGroup;
children = (
CAD178BC22B3B5B6004E6812 /* Localizable.strings */,
);
path = Resources;
sourceTree = "<group>";
};
CAFC2F672278957A007DBB02 /* CBZ */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -151,10 +164,11 @@
CAB9086A22492D4C00711C3F /* Navigator.swift */,
CA26EF7D22803FE90011653E /* VisualNavigator.swift */,
CACE84FA2254BFEE00E19E8B /* EditingAction.swift */,
CA479DC1226493390053445E /* Toolkit */,
CAFC2F672278957A007DBB02 /* CBZ */,
CAA9A38A226F406300BE1D6A /* EPUB */,
CA0B3AC1222EE530006D9363 /* PDF */,
CA479DC1226493390053445E /* Toolkit */,
CAD178B722B3B580004E6812 /* Resources */,
);
path = "r2-navigator-swift";
sourceTree = "<group>";
Expand Down Expand Up @@ -227,10 +241,9 @@
};
buildConfigurationList = F3E7D3BD1F4D83B000DF166D /* Build configuration list for PBXProject "r2-navigator-swift" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
);
mainGroup = F3E7D3B91F4D83B000DF166D;
Expand All @@ -249,6 +262,7 @@
buildActionMask = 2147483647;
files = (
CA7B4B4E227B253200393E3E /* gestures.js in Resources */,
CAD178BA22B3B5B6004E6812 /* Localizable.strings in Resources */,
CAA9A38D226F409C00BE1D6A /* fxl-wrapper.html in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -267,6 +281,7 @@
F3E7D3E61F4D84EF00DF166D /* DocumentWebView.swift in Sources */,
F3E7D42E1F4EE0FE00DF166D /* CBZNavigatorViewController.swift in Sources */,
CA479DC52264AEA20053445E /* UIColor.swift in Sources */,
CAD178B622B3B553004E6812 /* R2NavigatorLocalizedString.swift in Sources */,
F3E7D3E01F4D847E00DF166D /* Disjunction.swift in Sources */,
CAEACA222272EFBD00476340 /* ImageViewController.swift in Sources */,
CACE84FB2254BFEE00E19E8B /* EditingAction.swift in Sources */,
Expand All @@ -283,6 +298,17 @@
};
/* End PBXSourcesBuildPhase section */

/* Begin PBXVariantGroup section */
CAD178BC22B3B5B6004E6812 /* Localizable.strings */ = {
isa = PBXVariantGroup;
children = (
CAD178BB22B3B5B6004E6812 /* en */,
);
name = Localizable.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */

/* Begin XCBuildConfiguration section */
F3E7D3D51F4D83B000DF166D /* Debug */ = {
isa = XCBuildConfiguration;
Expand Down
2 changes: 1 addition & 1 deletion r2-navigator-swift/Navigator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public enum NavigatorError: LocalizedError {
public var errorDescription: String? {
switch self {
case .copyForbidden:
return "You exceeded the amount of characters allowed to be copied."
return R2NavigatorLocalizedString("NavigatorError.copyForbidden")
}
}
}
2 changes: 1 addition & 1 deletion r2-navigator-swift/PDF/PDFNavigatorViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ open class PDFNavigatorViewController: UIViewController, VisualNavigator, Loggab
extension PDFNavigatorViewController: PDFViewDelegate {

public func pdfViewWillClick(onLink sender: PDFView, with url: URL) {
print(url)
log(.debug, "Click URL: \(url)")
delegate?.navigator(self, presentExternalURL: url)
}

Expand Down
12 changes: 12 additions & 0 deletions r2-navigator-swift/Resources/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
Localizable.strings
r2-navigator-swift

Created by Mickaël Menu on 14.06.19.

Copyright 2019 Readium Foundation. All rights reserved.
Use of this source code is governed by a BSD-style license which is detailed
in the LICENSE file present in the project repository where this source code is maintained.
*/

"R2Navigator.NavigatorError.copyForbidden" = "You exceeded the amount of characters allowed to be copied.";
17 changes: 17 additions & 0 deletions r2-navigator-swift/Toolkit/R2NavigatorLocalizedString.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// R2NavigatorLocalizedString.swift
// r2-navigator-swift
//
// Created by Mickaël Menu on 14.06.19.
//
// Copyright 2019 Readium Foundation. All rights reserved.
// Use of this source code is governed by a BSD-style license which is detailed
// in the LICENSE file present in the project repository where this source code is maintained.
//

import Foundation
import R2Shared

func R2NavigatorLocalizedString(_ key: String, _ values: CVarArg...) -> String {
return R2LocalizedString("R2Navigator.\(key)", in: "org.readium.r2-navigator-swift", values)
}

0 comments on commit df76dcd

Please sign in to comment.