2 # This program creates the neverball.pot file from source code and level files.
4 # Copyright (C) 2006 Jean Privat
5 # Part of the Neverball Project http://icculus.org/neverball/
7 # NEVERBALL is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published
9 # by the Free Software Foundation; either version 2 of the License,
10 # or (at your option) any later version.
12 # This program is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # General Public License for more details.
20 COPYRIGHT="Robert Kooima"
21 BUGADDR="robert.kooima@gmail.com"
23 # First, extract from source
26 xgettext --from-code=UTF-8 --keyword=_ --keyword=N_ --keyword=sgettext -d "$DOMAIN" --copyright-holder="$COPYRIGHT" --msgid-bugs-address="$BUGADDR" -F -o "$POTFILE" ball/*.[ch] putt/*.[ch] share/*.[ch]
28 # Force encoding to UTF-8
29 sed -i "s/charset=CHARSET/charset=UTF-8/" "$POTFILE"
31 # Second, extract from neverball sets and neverputt courses
32 echo "# Sets and courses"
33 for i in data/sets.txt data/courses.txt; do
34 # the "echo | cat x -" forces the end of the last line
35 echo | cat "$i" - | while read -r d; do
36 # Heuristic: description is non empty line without .txt inside
37 if test -n "$d" && echo "$d" | grep -v ".txt" > /dev/null 2> /dev/null; then
41 echo "msgid \"${d//\\/\\\\}\""
47 # Third, extracts from levels
49 for i in `find data -name "*.map"`; do
53 # Only translatable string is "message"
54 grep -E "^\"message\"" "$i" | while read -r a b; do
57 echo "msgid ${b//\\/\\\\}"
62 # Remove duplicates, to keep msgmerge from complaining
63 echo "Removing duplicates."
64 msguniq -o "$POTFILE" -t UTF-8 "$POTFILE"