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 item=`grep "^en " languages.txt`
41 for X in common.*.po; do
42 [ -f "$X" ] || continue
43 if [ -n "$language" ]; then
44 if [ x"${X#common.}" != x"$language.po" ]; then
48 if [ x"${X#common.}" = x"en.po" ]; then
52 po=`msgmerge -N "$X" common.pot`
53 ne=`printf "%s\n" "$po" | msgfmt -o /dev/null --check-format --check-header --use-fuzzy - 2>&1 | grep . | wc -l`
54 nu=`printf "%s\n" "$po" | msgattrib --untranslated - | grep -c ^#:`
55 nf=`printf "%s\n" "$po" | msgattrib --fuzzy - | grep -c ^#:`
56 nt=`printf "%s\n" "$po" | grep -c ^#:`
57 n=$(($ne + $nu + $nf))
58 p=$(( (nt - n) * 100 / nt ))
59 echo >&2 "TODO for translation $X:"
60 echo >&2 "Errors: $ne"
61 echo >&2 "Untranslated: $nu"
64 echo >&2 "Percent: $p"
67 if ! item=`grep "^$l " languages.txt`; then
68 if [ "$p" -lt 50 ]; then
71 item="$l $l \"$l\" 0%"
73 printf "%s\n" "$item" | sed -e "s/[0-9][0-9]*%/$p%/"
75 } | tr '"' '\t' | sort -k3 | tr '\t' '"'
78 if [ x"$mode" = x"po" ]; then
79 for X in common.*.po; do
80 [ -f "$X" ] || continue
81 if [ -n "$language" ]; then
82 if [ x"${X#common.}" != x"$language.po" ]; then
86 if [ x"${X#common.}" = x"en.po" ]; then
90 msgmerge -F -U "$X" common.pot >&2
91 msgfmt -o /dev/null --check-format --check-header --use-fuzzy "$X" 2>&1 \
92 | grep . > "$X".errors || rm -f "$X".errors
93 msgattrib --untranslated "$X" | grep . > "$X".untranslated || rm -f "$X".untranslated
94 msgattrib --fuzzy "$X" | grep . > "$X".fuzzy || rm -f "$X".fuzzy
95 ne=$((`wc -l < "$X".errors 2>/dev/null` + 0))
96 nu=$((`grep -c ^#: "$X".untranslated 2>/dev/null` + 0))
97 nf=$((`grep -c ^#: "$X".fuzzy 2>/dev/null` + 0))
98 n=$(($ne + $nu + $nf))
100 for Y in ~/check-translations/"$X".*; do
101 [ -f "$Y" ] || continue
104 set fileencoding=utf-8
109 if ! msgcat "$Y" >/dev/null; then
110 echo "File $Y has syntax errors. Skipped."
113 msgcat -F --use-first "$Y" "$X" > "$X".new
121 msgfmt -o /dev/null --check-format --check-header --use-fuzzy "$X" 2>&1 \
122 | grep . > "$X".errors || rm -f "$X".errors
123 msgattrib --untranslated "$X" | grep . > "$X".untranslated || rm -f "$X".untranslated
124 msgattrib --fuzzy "$X" | grep . > "$X".fuzzy || rm -f "$X".fuzzy
125 ne=$((`wc -l < "$X".errors 2>/dev/null` + 0))
126 nu=$((`grep -c ^#: "$X".untranslated 2>/dev/null` + 0))
127 nf=$((`grep -c ^#: "$X".fuzzy 2>/dev/null` + 0))
128 n=$(($ne + $nu + $nf))
130 if [ $n -gt 0 ]; then
131 echo "TODO for translation $X:"
132 echo "Errors: $ne (was: $ne0)"
133 echo "Untranslated: $nu (was: $nu0)"
134 echo "Fuzzy: $nf (was: $nf0)"
135 ltr=`grep '^"Last-Translator: ' "$X" | cut -d ' ' -f 2- | cut -d '\\' -f 1 | egrep -v '<LL@li.org>|<EMAIL@ADDRESS>'`
136 ltm=`grep '^"Language-Team: ' "$X" | cut -d ' ' -f 2- | cut -d '\\' -f 1 | egrep -v '<LL@li.org>|<EMAIL@ADDRESS>'`
137 echo "Translators: $ltr, $ltm"
145 if [ x"$ltr" = x"$ltm" ]; then
152 if [ -n "$to" ]; then
155 if [ -n "$cc" ]; then
158 if [ -n "$to" ]; then
160 echo "Send mail? [y/n]"
165 if [ $ne -gt 0 ]; then
166 attach="$attach $X.errors"
168 if [ $nu -gt 0 ]; then
169 attach="$attach $X.untranslated"
171 if [ $nf -gt 0 ]; then
172 attach="$attach $X.fuzzy"
178 as you provided us with translations in the past, we kindly ask you
179 to update the translation to match changes in the Xonotic source. Can
180 you please work on them and provide updates to us?
182 For reference, the current version of the translation file is at:
183 http://git.xonotic.org/?p=xonotic/xonotic-data.pk3dir.git;a=blob;f=$X
185 If you do not wish to be contacted for translation updates any more,
186 please tell us in a reply to this message.
189 if [ $nu -gt 0 ]; then
191 Attached to this message is a file
193 with $nu yet to be translated messages. Please translate them and reply
194 with the file containing the translations in the "msgstr" fields.
198 if [ $nf -gt 0 ]; then
200 Attached to this message is a file
202 with $nf automatically generated translations. Please verify and/or fix
203 them and reply with the file having been verified by you.
213 -e "set from=\"divVerent@xonotic.org\"" \
214 -e "set use_from=yes" \
215 -e "set use_envelope_from=yes" \
216 -s "Need update for translations: $X" \
218 -b "admin@xonotic.org" \
230 echo "$X is complete!"
234 for X in common.*.po.disabled; do
235 [ -f "$X" ] || continue
236 if [ -n "$language" ]; then
237 if [ x"${X#common.}" != x"$language.po" ]; then
241 msgmerge -F -U "$X" common.pot >/dev/null 2>&1