From 925334fbc0cc349685c1481f10c8462285243146 Mon Sep 17 00:00:00 2001 From: Roman Petrenko Date: Wed, 18 May 2016 17:17:14 +0300 Subject: [PATCH] #48: Take localized string from default bundle if user's bundle misses it --- PasscodeLock/Functions.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PasscodeLock/Functions.swift b/PasscodeLock/Functions.swift index adb03903..df0b56bb 100644 --- a/PasscodeLock/Functions.swift +++ b/PasscodeLock/Functions.swift @@ -11,9 +11,9 @@ import Foundation func localizedStringFor(key: String, comment: String) -> String { let name = "PasscodeLock" - let bundle = bundleForResource(name, ofType: "strings") + let defaultString = NSLocalizedString(key, tableName: name, bundle: NSBundle(forClass: PasscodeLock.self), comment: comment) - return NSLocalizedString(key, tableName: name, bundle: bundle, comment: comment) + return NSLocalizedString(key, value: defaultString, tableName: name, bundle: NSBundle.mainBundle(), comment: comment) } func bundleForResource(name: String, ofType type: String) -> NSBundle {