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
39 echo "en English \"English\""
40 for X in common.*.po; do
41 [ -f "$X" ] || continue
42 if [ -n "$language" ]; then
43 if [ x"${X#common.}" != x"$language.po" ]; then
47 if [ x"${X#common.}" = x"en.po" ]; then
51 po=`msgmerge -N "$X" common.pot`
52 ne=`printf "%s\n" "$po" | msgfmt -o /dev/null --check-format --check-header --use-fuzzy - 2>&1 | grep . | wc -l`
53 nu=`printf "%s\n" "$po" | msgattrib --untranslated - | grep -c ^#:`
54 nf=`printf "%s\n" "$po" | msgattrib --fuzzy - | grep -c ^#:`
55 nt=`printf "%s\n" "$po" | grep -c ^#:`
56 n=$(($ne + $nu + $nf))
57 p=$(( (nt - n) * 100 / nt ))
58 echo >&2 "TODO for translation $X:"
59 echo >&2 "Errors: $ne"
60 echo >&2 "Untranslated: $nu"
63 echo >&2 "Percent: $p"
66 if ! item=`grep "^$l " languages.txt`; then
67 if [ "$p" -lt 50 ]; then
70 item="$l $l \"$l (0%)\""
72 printf "%s\n" "$item" | sed -e "s/([0-9][0-9]*%)/($p%)/"
74 } | tr '"' '\t' | sort -k3 | tr '\t' '"'
77 if [ x"$mode" = x"po" ]; then
78 for X in common.*.po; do
79 [ -f "$X" ] || continue
80 if [ -n "$language" ]; then
81 if [ x"${X#common.}" != x"$language.po" ]; then
85 if [ x"${X#common.}" = x"en.po" ]; then
89 msgmerge -F -U "$X" common.pot >&2
90 msgfmt -o /dev/null --check-format --check-header --use-fuzzy "$X" 2>&1 \
91 | grep . > "$X".errors || rm -f "$X".errors
92 msgattrib --untranslated "$X" | grep . > "$X".untranslated || rm -f "$X".untranslated
93 msgattrib --fuzzy "$X" | grep . > "$X".fuzzy || rm -f "$X".fuzzy
94 ne=$((`wc -l < "$X".errors 2>/dev/null` + 0))
95 nu=$((`grep -c ^#: "$X".untranslated 2>/dev/null` + 0))
96 nf=$((`grep -c ^#: "$X".fuzzy 2>/dev/null` + 0))
97 n=$(($ne + $nu + $nf))
99 for Y in ~/check-translations/"$X".*; do
100 [ -f "$Y" ] || continue
103 set fileencoding=utf-8
108 if ! msgcat "$Y" >/dev/null; then
109 echo "File $Y has syntax errors. Skipped."
112 msgcat -F --use-first "$Y" "$X" > "$X".new
120 msgfmt -o /dev/null --check-format --check-header --use-fuzzy "$X" 2>&1 \
121 | grep . > "$X".errors || rm -f "$X".errors
122 msgattrib --untranslated "$X" | grep . > "$X".untranslated || rm -f "$X".untranslated
123 msgattrib --fuzzy "$X" | grep . > "$X".fuzzy || rm -f "$X".fuzzy
124 ne=$((`wc -l < "$X".errors 2>/dev/null` + 0))
125 nu=$((`grep -c ^#: "$X".untranslated 2>/dev/null` + 0))
126 nf=$((`grep -c ^#: "$X".fuzzy 2>/dev/null` + 0))
127 n=$(($ne + $nu + $nf))
129 if [ $n -gt 0 ]; then
130 echo "TODO for translation $X:"
131 echo "Errors: $ne (was: $ne0)"
132 echo "Untranslated: $nu (was: $nu0)"
133 echo "Fuzzy: $nf (was: $nf0)"
134 ltr=`grep '^"Last-Translator: ' "$X" | cut -d ' ' -f 2- | cut -d '\\' -f 1 | egrep -v '<LL@li.org>|<EMAIL@ADDRESS>'`
135 ltm=`grep '^"Language-Team: ' "$X" | cut -d ' ' -f 2- | cut -d '\\' -f 1 | egrep -v '<LL@li.org>|<EMAIL@ADDRESS>'`
136 echo "Translators: $ltr, $ltm"
144 if [ x"$ltr" = x"$ltm" ]; then
151 if [ -n "$to" ]; then
154 if [ -n "$cc" ]; then
157 if [ -n "$to" ]; then
159 echo "Send mail? [y/n]"
164 if [ $ne -gt 0 ]; then
165 attach="$attach $X.errors"
167 if [ $nu -gt 0 ]; then
168 attach="$attach $X.untranslated"
170 if [ $nf -gt 0 ]; then
171 attach="$attach $X.fuzzy"
177 as you provided us with translations in the past, we kindly ask you
178 to update the translation to match changes in the Xonotic source. Can
179 you please work on them and provide updates to us?
181 For reference, the current version of the translation file is at:
182 http://git.xonotic.org/?p=xonotic/xonotic-data.pk3dir.git;a=blob;f=$X
184 If you do not wish to be contacted for translation updates any more,
185 please tell us in a reply to this message.
188 if [ $nu -gt 0 ]; then
190 Attached to this message is a file
192 with $nu yet to be translated messages. Please translate them and reply
193 with the file containing the translations in the "msgstr" fields.
197 if [ $nf -gt 0 ]; then
199 Attached to this message is a file
201 with $nf automatically generated translations. Please verify and/or fix
202 them and reply with the file having been verified by you.
212 -e "set from=\"divVerent@xonotic.org\"" \
213 -e "set use_from=yes" \
214 -e "set use_envelope_from=yes" \
215 -s "Need update for translations: $X" \
217 -b "admin@xonotic.org" \
229 echo "$X is complete!"
233 for X in common.*.po.disabled; do
234 [ -f "$X" ] || continue
235 if [ -n "$language" ]; then
236 if [ x"${X#common.}" != x"$language.po" ]; then
240 msgmerge -F -U "$X" common.pot >/dev/null 2>&1