Created
March 3, 2013 14:36
-
-
Save orlandoaleman/5076340 to your computer and use it in GitHub Desktop.
Extracts title and footer texts from Settings.bundle plists to your *.strings localized files.
Usage:
plist2strings.sh Settings.bundle/Root.plist Settings.bundle/es.lproj/Root.strings
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
#!/bin/sh | |
die () { | |
echo >&2 "$@" | |
exit 1 | |
} | |
[ "$#" -eq 2 ] || die "2 arguments required, $# provided" | |
[ -e $1 ] || die "File \"$1\" does not exist" | |
sed -n ' | |
# look for a "#" at the end of the line | |
/<key>Title<\/key>$/ { | |
# Found one - now read in the next line | |
N | |
# delete the "#" and the new line character, | |
s/.*<\(string\)>\(.*\)<\/\1>/"\2" = "\2";/gp | |
}' $1 >> $2 | |
sed -n ' | |
# look for a "#" at the end of the line | |
/<key>FooterText<\/key>$/ { | |
# Found one - now read in the next line | |
N | |
# delete the "#" and the new line character, | |
s/.*<\(string\)>\(.*\)<\/\1>/"\2" = "\2";/gp | |
}' $1 >> $2 | |
cat $2 | sort | uniq > tmpfile | |
rm $2 | |
mv tmpfile $2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment