Skip to content

Instantly share code, notes, and snippets.

@MatejBalantic
Created October 19, 2016 13:14
Show Gist options
  • Save MatejBalantic/29857a9b2897e4b8d09fdcd7f6c574ec to your computer and use it in GitHub Desktop.
Save MatejBalantic/29857a9b2897e4b8d09fdcd7f6c574ec to your computer and use it in GitHub Desktop.
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