Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DanielCardonaRojas/fca5055fa76009c669953f3d0e31f9da to your computer and use it in GitHub Desktop.
Save DanielCardonaRojas/fca5055fa76009c669953f3d0e31f9da to your computer and use it in GitHub Desktop.
Generate type safe class for localized strings #awk #iOS #Localized Strings
#! /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