2 # This script extracts translatable messages from maps and sets.
3 # Copyright (C) 2006 Jean Privat
5 # Part of the Neverball project
6 # http://icculus.org/neverball/
8 # NEVERBALL is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published
10 # by the Free Software Foundation; either version 2 of the License,
11 # or (at your option) any later version.
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
18 test -n "$1" || exit 1
27 COURSES="$DATA/courses.txt"
29 for i in $(cat "$SETS"); do
32 # Only translate the two first lines
33 head -n 2 $i | while read -r d; do
36 echo "msgid \"$(echo "$d" | sed 's/\\/\\\\/g')\""
41 # the "echo | cat x -" forces the end of the last line
42 echo | cat "$COURSES" - | while read -r d; do
43 # Heuristic: description is non empty line without .txt inside
44 if test -n "$d" && echo "$d" | grep -v ".txt" &> /dev/null; then
47 echo "msgid \"$(echo "$d" | sed 's/\\/\\\\/g')\""
52 for i in $(find $DATA -name "*.map" | sort); do
53 # Only translatable string is "message"
54 grep -E "^\"message\"" "$i" | while read -r a b; do
57 echo "msgid $(echo "$b" | sed 's/\\/\\\\/g')"