Skip to content

Commit

Permalink
Add comment paramterer to match NSLocalizedString() macro and make it…
Browse files Browse the repository at this point in the history
… able to work with genstrings.
  • Loading branch information
tomkowz committed Jun 29, 2015
1 parent 09f1e33 commit 901fe6f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Swifternalization/Swifternalization.swift
Expand Up @@ -128,7 +128,7 @@ public extension Swifternalization {
// key - key in Localizable.strings
// defaultValue - will be return when nothing can be found
// otherwise will return key
public class func localizedString(key: String, defaultValue: String? = nil) -> String {
public class func localizedString(key: String, defaultValue: String? = nil, comment: String? = nil) -> String {
if sharedInstance() == nil { return (defaultValue != nil) ? defaultValue! : key }

for TranslatablePair in sharedInstance().preferredPairs.filter({$0.key == key}) {
Expand All @@ -147,7 +147,7 @@ public extension Swifternalization {
Expressions key-value translations support.
*/
public extension Swifternalization {
public class func localizedExpressionString(key: String, value: String, defaultValue: String? = nil) -> String {
public class func localizedExpressionString(key: String, value: String, defaultValue: String? = nil, comment: String? = nil) -> String {
if sharedInstance() == nil { return (defaultValue != nil) ? defaultValue! : key }

let filter = {(pair: TranslatablePair) -> Bool in
Expand Down Expand Up @@ -176,7 +176,7 @@ public extension Swifternalization {
Int support for expressions key-value translations.
*/
public extension Swifternalization {
public class func localizedExpressionString(key: String, value: Int, defaultValue: String? = nil) -> String {
return self.localizedExpressionString(key, value: "\(value)", defaultValue: defaultValue)
public class func localizedExpressionString(key: String, value: Int, defaultValue: String? = nil, comment: String? = nil) -> String {
return self.localizedExpressionString(key, value: "\(value)", defaultValue: defaultValue, comment: comment)
}
}

0 comments on commit 901fe6f

Please sign in to comment.