Skip to content

Instantly share code, notes, and snippets.

@yusuke024
Created June 9, 2020 09:36
Show Gist options
  • Save yusuke024/6ab34ff06490541510dacad630ff150a to your computer and use it in GitHub Desktop.
Save yusuke024/6ab34ff06490541510dacad630ff150a to your computer and use it in GitHub Desktop.
Convert NSLocalizedString code into a Localizable.strings entry
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