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
32 make QCC="../../../../gmqcc/gmqcc" clean
33 make QCC="../../../../gmqcc/gmqcc"
35 grep -h '^\.' .tmp/*_includes.txt | cut -d ' ' -f 2 | sed -e 's,^,qcsrc/,' | while IFS= read -r name; do
39 name=${name%%/./*}/${name#*/./}
47 name=$before/${name#*/../}
59 } | xgettext -LC -k_ -f- --from-code utf-8 -F -o common.pot >&2
62 if [ x"$mode" = x"txt" ]; then
64 item=`grep "^en " languages.txt`
66 for X in common.*.po; do
67 [ -f "$X" ] || continue
68 if [ -n "$language" ]; then
69 if [ x"${X#common.}" != x"$language.po" ]; then
73 if [ x"${X#common.}" = x"en.po" ]; then
77 po=`msgmerge -N "$X" common.pot`
78 ne=`printf "%s\n" "$po" | msgfmt -o /dev/null --check-format --check-header --use-fuzzy - 2>&1 | grep . | wc -l`
79 nu=`printf "%s\n" "$po" | msgattrib --untranslated - | grep -c ^#:`
80 nf=`printf "%s\n" "$po" | msgattrib --fuzzy - | grep -c ^#:`
81 nt=`printf "%s\n" "$po" | grep -c ^#:`
82 n=$(($ne + $nu + $nf))
83 p=$(( (nt - n) * 100 / nt ))
84 echo >&2 "TODO for translation $X:"
85 echo >&2 "Errors: $ne"
86 echo >&2 "Untranslated: $nu"
89 echo >&2 "Percent: $p"
92 if ! item=`grep "^$l " languages.txt`; then
93 if [ "$p" -lt 50 ]; then
96 item="$l $l \"$l\" 0%"
98 printf "%s\n" "$item" | sed -e "s/[0-9][0-9]*%/$p%/"
100 } | tr '"' '\t' | sort -k3 | tr '\t' '"'
103 if [ x"$mode" = x"po" ]; then
104 for X in common.*.po; do
105 [ -f "$X" ] || continue
106 if [ -n "$language" ]; then
107 if [ x"${X#common.}" != x"$language.po" ]; then
111 if [ x"${X#common.}" = x"en.po" ]; then
115 msgmerge -F -U "$X" common.pot >&2
116 msgfmt -o /dev/null --check-format --check-header --use-fuzzy "$X" 2>&1 \
117 | grep . > "$X".errors || rm -f "$X".errors
118 msgattrib --untranslated "$X" | grep . > "$X".untranslated || rm -f "$X".untranslated
119 msgattrib --fuzzy "$X" | grep . > "$X".fuzzy || rm -f "$X".fuzzy
120 ne=$((`wc -l < "$X".errors 2>/dev/null` + 0))
121 nu=$((`grep -c ^#: "$X".untranslated 2>/dev/null` + 0))
122 nf=$((`grep -c ^#: "$X".fuzzy 2>/dev/null` + 0))
123 n=$(($ne + $nu + $nf))
125 for Y in ~/check-translations/"$X".*; do
126 [ -f "$Y" ] || continue
129 set fileencoding=utf-8
134 if ! msgcat "$Y" >/dev/null; then
135 echo "File $Y has syntax errors. Skipped."
138 msgcat -F --use-first "$Y" "$X" > "$X".new
146 msgfmt -o /dev/null --check-format --check-header --use-fuzzy "$X" 2>&1 \
147 | grep . > "$X".errors || rm -f "$X".errors
148 msgattrib --untranslated "$X" | grep . > "$X".untranslated || rm -f "$X".untranslated
149 msgattrib --fuzzy "$X" | grep . > "$X".fuzzy || rm -f "$X".fuzzy
150 ne=$((`wc -l < "$X".errors 2>/dev/null` + 0))
151 nu=$((`grep -c ^#: "$X".untranslated 2>/dev/null` + 0))
152 nf=$((`grep -c ^#: "$X".fuzzy 2>/dev/null` + 0))
153 n=$(($ne + $nu + $nf))
155 if [ $n -gt 0 ]; then
156 echo "TODO for translation $X:"
157 echo "Errors: $ne (was: $ne0)"
158 echo "Untranslated: $nu (was: $nu0)"
159 echo "Fuzzy: $nf (was: $nf0)"
160 ltr=`grep '^"Last-Translator: ' "$X" | cut -d ' ' -f 2- | cut -d '\\' -f 1 | egrep -v '<LL@li.org>|<EMAIL@ADDRESS>'`
161 ltm=`grep '^"Language-Team: ' "$X" | cut -d ' ' -f 2- | cut -d '\\' -f 1 | egrep -v '<LL@li.org>|<EMAIL@ADDRESS>'`
162 echo "Translators: $ltr, $ltm"
170 if [ x"$ltr" = x"$ltm" ]; then
177 if [ -n "$to" ]; then
180 if [ -n "$cc" ]; then
183 if [ -n "$to" ]; then
185 echo "Send mail? [y/n]"
190 if [ $ne -gt 0 ]; then
191 attach="$attach $X.errors"
193 if [ $nu -gt 0 ]; then
194 attach="$attach $X.untranslated"
196 if [ $nf -gt 0 ]; then
197 attach="$attach $X.fuzzy"
203 as you provided us with translations in the past, we kindly ask you
204 to update the translation to match changes in the Xonotic source. Can
205 you please work on them and provide updates to us?
207 For reference, the current version of the translation file is at:
208 http://git.xonotic.org/?p=xonotic/xonotic-data.pk3dir.git;a=blob;f=$X
210 If you do not wish to be contacted for translation updates any more,
211 please tell us in a reply to this message.
214 if [ $nu -gt 0 ]; then
216 Attached to this message is a file
218 with $nu yet to be translated messages. Please translate them and reply
219 with the file containing the translations in the "msgstr" fields.
223 if [ $nf -gt 0 ]; then
225 Attached to this message is a file
227 with $nf automatically generated translations. Please verify and/or fix
228 them and reply with the file having been verified by you.
238 -e "set from=\"divVerent@xonotic.org\"" \
239 -e "set use_from=yes" \
240 -e "set use_envelope_from=yes" \
241 -s "Need update for translations: $X" \
243 -b "admin@xonotic.org" \
255 echo "$X is complete!"
259 for X in common.*.po.disabled; do
260 [ -f "$X" ] || continue
261 if [ -n "$language" ]; then
262 if [ x"${X#common.}" != x"$language.po" ]; then
266 msgmerge -F -U "$X" common.pot >/dev/null 2>&1