2 # This program creates the neverball.pot file from source code and level files.
6 COPYRIGHT="Robert Kooima"
7 BUGADDR="robert.kooima@gmail.com"
9 # First, extract from source
12 xgettext --from-code=UTF-8 --keyword=_ --keyword=N_ -d "$DOMAIN" --copyright-holder="$COPYRIGHT" --msgid-bugs-address="$BUGADDR" -F -o "$POTFILE" ball/*.[ch] putt/*.[ch] share/*.[ch]
14 # Force encoding to UTF-8
15 sed -i "s/charset=CHARSET/charset=UTF-8/" "$POTFILE"
17 # Second, extract from neverball sets and neverputt courses
18 echo "# Sets and courses"
19 for i in data/sets.txt data/courses.txt; do
20 # the "echo | cat x -" forces the end of the last line
21 echo | cat "$i" - | while read -r d; do
22 # Heuristic: description is non empty line without .txt inside
23 if test -n "$d" && echo "$d" | grep -v ".txt" > /dev/null 2> /dev/null; then
27 echo "msgid \"${d//\\/\\\\}\""
33 # Third, extracts from levels
35 for i in `find data -name "*.map"`; do
39 # Only translatable string is "message"
40 grep -E "^\"message\"" "$i" | while read -r a b; do
43 echo "msgid ${b//\\/\\\\}"
48 # Remove duplicates, to keep msgmerge from complaining
49 echo "Removing duplicates."
50 msguniq -o "$POTFILE" -t UTF-8 "$POTFILE"