Created
July 9, 2020 15:07
-
-
Save DanielCardonaRojas/fca5055fa76009c669953f3d0e31f9da to your computer and use it in GitHub Desktop.
Generate type safe class for localized strings #awk #iOS #Localized Strings
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
#! /usr/bin/awk -f | |
BEGIN { | |
print "\ | |
// This file is autogenerated do not modify\ | |
\ | |
import Foundation\ | |
"; | |
print "public struct TextResource {" | |
} | |
/^\".*\";$/{ | |
gsub(/\"/,"") | |
gsub(/=/,"") | |
gsub(/;/,"") | |
print " public static let", $1, "= NSLocalizedString(\"" $1 "\", comment: \"\")" | |
} | |
END { | |
print "}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment