Created
June 9, 2020 09:36
-
-
Save yusuke024/6ab34ff06490541510dacad630ff150a to your computer and use it in GitHub Desktop.
Convert NSLocalizedString code into a Localizable.strings entry
This file contains 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
struct NSLocalizedString { | |
enum Bundle { | |
case main | |
} | |
var key: String | |
var value: String | |
var comment: String | |
init(_ key: String, tableName: Int?, bundle: Bundle?, value: String, comment: String) { | |
self.key = key | |
self.value = value | |
self.comment = comment | |
} | |
} | |
let text = | |
NSLocalizedString( | |
"<KEY>", | |
tableName: nil, | |
bundle: .main, | |
value: "<VALUE>", | |
comment: """ | |
<Comment> | |
""") | |
print("/* \(text.comment) */") | |
print("\"\(text.key)\" = \"\(text.value)\";") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment