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 item=`grep "^$l " languages.txt || echo "$l $l \"$l (0%)\""`
66 if [ "$p" -gt 50 ]; then
67 printf "%s\n" "$item" | sed -e "s/([0-9][0-9]*%)/($p%)/"
72 if [ x"$mode" = x"po" ]; then
73 for X in common.*.po; do
74 [ -f "$X" ] || continue
75 if [ -n "$language" ]; then
76 if [ x"${X#common.}" != x"$language.po" ]; then
80 if [ x"${X#common.}" = x"en.po" ]; then
84 msgmerge -F -U "$X" common.pot >&2
85 msgfmt -o /dev/null --check-format --check-header --use-fuzzy "$X" 2>&1 \
86 | grep . > "$X".errors || rm -f "$X".errors
87 msgattrib --untranslated "$X" | grep . > "$X".untranslated || rm -f "$X".untranslated
88 msgattrib --fuzzy "$X" | grep . > "$X".fuzzy || rm -f "$X".fuzzy
89 ne=$((`wc -l < "$X".errors 2>/dev/null` + 0))
90 nu=$((`grep -c ^#: "$X".untranslated 2>/dev/null` + 0))
91 nf=$((`grep -c ^#: "$X".fuzzy 2>/dev/null` + 0))
92 n=$(($ne + $nu + $nf))
94 for Y in ~/check-translations/"$X".*; do
95 [ -f "$Y" ] || continue
98 set fileencoding=utf-8
103 if ! msgcat "$Y" >/dev/null; then
104 echo "File $Y has syntax errors. Skipped."
107 msgcat -F --use-first "$Y" "$X" > "$X".new
115 msgfmt -o /dev/null --check-format --check-header --use-fuzzy "$X" 2>&1 \
116 | grep . > "$X".errors || rm -f "$X".errors
117 msgattrib --untranslated "$X" | grep . > "$X".untranslated || rm -f "$X".untranslated
118 msgattrib --fuzzy "$X" | grep . > "$X".fuzzy || rm -f "$X".fuzzy
119 ne=$((`wc -l < "$X".errors 2>/dev/null` + 0))
120 nu=$((`grep -c ^#: "$X".untranslated 2>/dev/null` + 0))
121 nf=$((`grep -c ^#: "$X".fuzzy 2>/dev/null` + 0))
122 n=$(($ne + $nu + $nf))
124 if [ $n -gt 0 ]; then
125 echo "TODO for translation $X:"
126 echo "Errors: $ne (was: $ne0)"
127 echo "Untranslated: $nu (was: $nu0)"
128 echo "Fuzzy: $nf (was: $nf0)"
129 ltr=`grep '^"Last-Translator: ' "$X" | cut -d ' ' -f 2- | cut -d '\\' -f 1 | egrep -v '<LL@li.org>|<EMAIL@ADDRESS>'`
130 ltm=`grep '^"Language-Team: ' "$X" | cut -d ' ' -f 2- | cut -d '\\' -f 1 | egrep -v '<LL@li.org>|<EMAIL@ADDRESS>'`
131 echo "Translators: $ltr, $ltm"
139 if [ x"$ltr" = x"$ltm" ]; then
146 if [ -n "$to" ]; then
149 if [ -n "$cc" ]; then
152 if [ -n "$to" ]; then
154 echo "Send mail? [y/n]"
159 if [ $ne -gt 0 ]; then
160 attach="$attach $X.errors"
162 if [ $nu -gt 0 ]; then
163 attach="$attach $X.untranslated"
165 if [ $nf -gt 0 ]; then
166 attach="$attach $X.fuzzy"
172 as you provided us with translations in the past, we kindly ask you
173 to update the translation to match changes in the Xonotic source. Can
174 you please work on them and provide updates to us?
176 For reference, the current version of the translation file is at:
177 http://git.xonotic.org/?p=xonotic/xonotic-data.pk3dir.git;a=blob;f=$X
179 If you do not wish to be contacted for translation updates any more,
180 please tell us in a reply to this message.
183 if [ $nu -gt 0 ]; then
185 Attached to this message is a file
187 with $nu yet to be translated messages. Please translate them and reply
188 with the file containing the translations in the "msgstr" fields.
192 if [ $nf -gt 0 ]; then
194 Attached to this message is a file
196 with $nf automatically generated translations. Please verify and/or fix
197 them and reply with the file having been verified by you.
207 -e "set from=\"divVerent@xonotic.org\"" \
208 -e "set use_from=yes" \
209 -e "set use_envelope_from=yes" \
210 -s "Need update for translations: $X" \
212 -b "admin@xonotic.org" \
224 echo "$X is complete!"
228 for X in common.*.po.disabled; do
229 [ -f "$X" ] || continue
230 if [ -n "$language" ]; then
231 if [ x"${X#common.}" != x"$language.po" ]; then
235 msgmerge -F -U "$X" common.pot >/dev/null 2>&1