From 0a5f28b6af3184d8ec772ee8b347d06d8e0cf16f Mon Sep 17 00:00:00 2001 From: Alex Littlejohn Date: Mon, 10 Apr 2017 09:51:04 +0200 Subject: [PATCH] Merge: Add ability to localize all texts used in framework #188 --- ALCameraViewController/Utilities/Utilities.swift | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ALCameraViewController/Utilities/Utilities.swift b/ALCameraViewController/Utilities/Utilities.swift index 8d3dc3e2..d35977f7 100644 --- a/ALCameraViewController/Utilities/Utilities.swift +++ b/ALCameraViewController/Utilities/Utilities.swift @@ -14,7 +14,14 @@ internal func radians(_ degrees: Double) -> Double { } internal func localizedString(_ key: String) -> String { - return NSLocalizedString(key, tableName: CameraGlobals.shared.stringsTable, bundle: CameraGlobals.shared.bundle, comment: key) + var bundle: Bundle { + if Bundle.main.path(forResource: CameraGlobals.shared.stringsTable, ofType: "strings") != nil { + return Bundle.main + } + return CameraGlobals.shared.bundle + } + + return NSLocalizedString(key, tableName: CameraGlobals.shared.stringsTable, bundle: bundle, comment: key) } internal func currentRotation(_ oldOrientation: UIInterfaceOrientation, newOrientation: UIInterfaceOrientation) -> Double {