18 echo "Sorry, you are not supposed to use this script."
19 echo "This script is solely for use by the Xonotic Core Team."
20 echo "Unauthorized use of it can cause HIGHLY annoying merge"
31 if [ x"$mode" = x"pot" ]; then
33 find qcsrc -type f -name \*.\* -not -name \*.po -not -name \*.txt
34 } | xgettext -LC -k_ -f- --from-code utf-8 -F -o common.pot >&2
37 if [ x"$mode" = x"txt" ]; then
38 echo "en English \"English\""
39 for X in common.*.po; do
40 [ -f "$X" ] || continue
41 if [ -n "$language" ]; then
42 if [ x"${X#common.}" != x"$language.po" ]; then
46 if [ x"${X#common.}" = x"en.po" ]; then
50 po=`msgmerge -N "$X" common.pot`
51 ne=`printf "%s\n" "$po" | msgfmt -o /dev/null --check-format --check-header --use-fuzzy - 2>&1 | grep . | wc -l`
52 nu=`printf "%s\n" "$po" | msgattrib --untranslated - | grep -c ^#:`
53 nf=`printf "%s\n" "$po" | msgattrib --fuzzy - | grep -c ^#:`
54 nt=`printf "%s\n" "$po" | grep -c ^#:`
55 n=$(($ne + $nu + $nf))
56 p=$(( (nt - n) * 100 / nt ))
57 echo >&2 "TODO for translation $X:"
58 echo >&2 "Errors: $ne"
59 echo >&2 "Untranslated: $nu"
62 echo >&2 "Percent: $p"
65 if ! item=`grep "^$l " languages.txt`; then
66 if [ "$p" -lt 50 ]; then
69 item="$l $l \"$l (0%)\""
71 printf "%s\n" "$item" | sed -e "s/([0-9][0-9]*%)/($p%)/"
75 if [ x"$mode" = x"po" ]; then
76 for X in common.*.po; do
77 [ -f "$X" ] || continue
78 if [ -n "$language" ]; then
79 if [ x"${X#common.}" != x"$language.po" ]; then
83 if [ x"${X#common.}" = x"en.po" ]; then
87 msgmerge -F -U "$X" common.pot >&2
88 msgfmt -o /dev/null --check-format --check-header --use-fuzzy "$X" 2>&1 \
89 | grep . > "$X".errors || rm -f "$X".errors
90 msgattrib --untranslated "$X" | grep . > "$X".untranslated || rm -f "$X".untranslated
91 msgattrib --fuzzy "$X" | grep . > "$X".fuzzy || rm -f "$X".fuzzy
92 ne=$((`wc -l < "$X".errors 2>/dev/null` + 0))
93 nu=$((`grep -c ^#: "$X".untranslated 2>/dev/null` + 0))
94 nf=$((`grep -c ^#: "$X".fuzzy 2>/dev/null` + 0))
95 n=$(($ne + $nu + $nf))
97 for Y in ~/check-translations/"$X".*; do
98 [ -f "$Y" ] || continue
101 set fileencoding=utf-8
106 if ! msgcat "$Y" >/dev/null; then
107 echo "File $Y has syntax errors. Skipped."
110 msgcat -F --use-first "$Y" "$X" > "$X".new
118 msgfmt -o /dev/null --check-format --check-header --use-fuzzy "$X" 2>&1 \
119 | grep . > "$X".errors || rm -f "$X".errors
120 msgattrib --untranslated "$X" | grep . > "$X".untranslated || rm -f "$X".untranslated
121 msgattrib --fuzzy "$X" | grep . > "$X".fuzzy || rm -f "$X".fuzzy
122 ne=$((`wc -l < "$X".errors 2>/dev/null` + 0))
123 nu=$((`grep -c ^#: "$X".untranslated 2>/dev/null` + 0))
124 nf=$((`grep -c ^#: "$X".fuzzy 2>/dev/null` + 0))
125 n=$(($ne + $nu + $nf))
127 if [ $n -gt 0 ]; then
128 echo "TODO for translation $X:"
129 echo "Errors: $ne (was: $ne0)"
130 echo "Untranslated: $nu (was: $nu0)"
131 echo "Fuzzy: $nf (was: $nf0)"
132 ltr=`grep '^"Last-Translator: ' "$X" | cut -d ' ' -f 2- | cut -d '\\' -f 1 | egrep -v '<LL@li.org>|<EMAIL@ADDRESS>'`
133 ltm=`grep '^"Language-Team: ' "$X" | cut -d ' ' -f 2- | cut -d '\\' -f 1 | egrep -v '<LL@li.org>|<EMAIL@ADDRESS>'`
134 echo "Translators: $ltr, $ltm"
142 if [ x"$ltr" = x"$ltm" ]; then
149 if [ -n "$to" ]; then
152 if [ -n "$cc" ]; then
155 if [ -n "$to" ]; then
157 echo "Send mail? [y/n]"
162 if [ $ne -gt 0 ]; then
163 attach="$attach $X.errors"
165 if [ $nu -gt 0 ]; then
166 attach="$attach $X.untranslated"
168 if [ $nf -gt 0 ]; then
169 attach="$attach $X.fuzzy"
175 as you provided us with translations in the past, we kindly ask you
176 to update the translation to match changes in the Xonotic source. Can
177 you please work on them and provide updates to us?
179 For reference, the current version of the translation file is at:
180 http://git.xonotic.org/?p=xonotic/xonotic-data.pk3dir.git;a=blob;f=$X
182 If you do not wish to be contacted for translation updates any more,
183 please tell us in a reply to this message.
186 if [ $nu -gt 0 ]; then
188 Attached to this message is a file
190 with $nu yet to be translated messages. Please translate them and reply
191 with the file containing the translations in the "msgstr" fields.
195 if [ $nf -gt 0 ]; then
197 Attached to this message is a file
199 with $nf automatically generated translations. Please verify and/or fix
200 them and reply with the file having been verified by you.
210 -e "set from=\"divVerent@xonotic.org\"" \
211 -e "set use_from=yes" \
212 -e "set use_envelope_from=yes" \
213 -s "Need update for translations: $X" \
215 -b "admin@xonotic.org" \
227 echo "$X is complete!"
231 for X in common.*.po.disabled; do
232 [ -f "$X" ] || continue
233 if [ -n "$language" ]; then
234 if [ x"${X#common.}" != x"$language.po" ]; then
238 msgmerge -F -U "$X" common.pot >/dev/null 2>&1