Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.