Created
October 19, 2016 13:14
-
-
Save MatejBalantic/29857a9b2897e4b8d09fdcd7f6c574ec to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
extension String { | |
private class LocalizationReference { } | |
public var localized : String { | |
let bundle = Bundle.init(for: LocalizationReference.self) | |
let defaultValue = self | |
return NSLocalizedString(self, tableName: nil, bundle: bundle, value: defaultValue, comment: "") | |
} | |
public func localizedWith(_ arguments: String ...) -> String { | |
return String(format: localized, arguments: arguments) | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment