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.new >&2
60 if msgcmp --use-untranslated common.pot common.pot.new; then
61 echo "No contentful changes to common.pot - OK."
64 echo "Updating common.pot. This probably should be committed."
65 mv -v common.pot.new common.pot
69 if [ x"$mode" = x"txt" ]; then
71 item=`grep "^en " languages.txt`
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 po=`msgmerge -N "$X" common.pot`
85 ne=`printf "%s\n" "$po" | msgfmt -o /dev/null --check-format --check-header --use-fuzzy - 2>&1 | grep . | wc -l`
86 nu=`printf "%s\n" "$po" | msgattrib --untranslated - | grep -c ^#:`
87 nf=`printf "%s\n" "$po" | msgattrib --fuzzy - | grep -c ^#:`
88 nt=`printf "%s\n" "$po" | grep -c ^#:`
89 n=$(($ne + $nu + $nf))
90 p=$(( (nt - n) * 100 / nt ))
91 echo >&2 "TODO for translation $X:"
92 echo >&2 "Errors: $ne"
93 echo >&2 "Untranslated: $nu"
96 echo >&2 "Percent: $p"
99 if ! item=`grep "^$l " languages.txt`; then
100 if [ "$p" -lt 50 ]; then
103 item="$l $l \"$l\" 0%"
105 printf "%s\n" "$item" | sed -e "s/[0-9][0-9]*%/$p%/"
107 } | tr '"' '\t' | sort -k3 | tr '\t' '"'
110 if [ x"$mode" = x"po" ]; then
111 for X in common.*.po; do
112 [ -f "$X" ] || continue
113 if [ -n "$language" ]; then
114 if [ x"${X#common.}" != x"$language.po" ]; then
118 if [ x"${X#common.}" = x"en.po" ]; then
122 msgmerge -F -U "$X" common.pot >&2
123 msgfmt -o /dev/null --check-format --check-header --use-fuzzy "$X" 2>&1 \
124 | grep . > "$X".errors || rm -f "$X".errors
125 msgattrib --untranslated "$X" | grep . > "$X".untranslated || rm -f "$X".untranslated
126 msgattrib --fuzzy "$X" | grep . > "$X".fuzzy || rm -f "$X".fuzzy
127 ne=$((`wc -l < "$X".errors 2>/dev/null` + 0))
128 nu=$((`grep -c ^#: "$X".untranslated 2>/dev/null` + 0))
129 nf=$((`grep -c ^#: "$X".fuzzy 2>/dev/null` + 0))
130 n=$(($ne + $nu + $nf))
132 for Y in ~/check-translations/"$X".*; do
133 [ -f "$Y" ] || continue
136 set fileencoding=utf-8
141 if ! msgcat "$Y" >/dev/null; then
142 echo "File $Y has syntax errors. Skipped."
145 msgcat -F --use-first "$Y" "$X" > "$X".new
153 msgfmt -o /dev/null --check-format --check-header --use-fuzzy "$X" 2>&1 \
154 | grep . > "$X".errors || rm -f "$X".errors
155 msgattrib --untranslated "$X" | grep . > "$X".untranslated || rm -f "$X".untranslated
156 msgattrib --fuzzy "$X" | grep . > "$X".fuzzy || rm -f "$X".fuzzy
157 ne=$((`wc -l < "$X".errors 2>/dev/null` + 0))
158 nu=$((`grep -c ^#: "$X".untranslated 2>/dev/null` + 0))
159 nf=$((`grep -c ^#: "$X".fuzzy 2>/dev/null` + 0))
160 n=$(($ne + $nu + $nf))
162 if [ $n -gt 0 ]; then
163 echo "TODO for translation $X:"
164 echo "Errors: $ne (was: $ne0)"
165 echo "Untranslated: $nu (was: $nu0)"
166 echo "Fuzzy: $nf (was: $nf0)"
167 ltr=`grep '^"Last-Translator: ' "$X" | cut -d ' ' -f 2- | cut -d '\\' -f 1 | egrep -v '<LL@li.org>|<EMAIL@ADDRESS>'`
168 ltm=`grep '^"Language-Team: ' "$X" | cut -d ' ' -f 2- | cut -d '\\' -f 1 | egrep -v '<LL@li.org>|<EMAIL@ADDRESS>'`
169 echo "Translators: $ltr, $ltm"
177 if [ x"$ltr" = x"$ltm" ]; then
184 if [ -n "$to" ]; then
187 if [ -n "$cc" ]; then
190 if [ -n "$to" ]; then
192 echo "Send mail? [y/n]"
197 if [ $ne -gt 0 ]; then
198 attach="$attach $X.errors"
200 if [ $nu -gt 0 ]; then
201 attach="$attach $X.untranslated"
203 if [ $nf -gt 0 ]; then
204 attach="$attach $X.fuzzy"
210 as you provided us with translations in the past, we kindly ask you
211 to update the translation to match changes in the Xonotic source. Can
212 you please work on them and provide updates to us?
214 For reference, the current version of the translation file is at:
215 http://git.xonotic.org/?p=xonotic/xonotic-data.pk3dir.git;a=blob;f=$X
217 If you do not wish to be contacted for translation updates any more,
218 please tell us in a reply to this message.
221 if [ $nu -gt 0 ]; then
223 Attached to this message is a file
225 with $nu yet to be translated messages. Please translate them and reply
226 with the file containing the translations in the "msgstr" fields.
230 if [ $nf -gt 0 ]; then
232 Attached to this message is a file
234 with $nf automatically generated translations. Please verify and/or fix
235 them and reply with the file having been verified by you.
245 -e "set from=\"divVerent@xonotic.org\"" \
246 -e "set use_from=yes" \
247 -e "set use_envelope_from=yes" \
248 -s "Need update for translations: $X" \
250 -b "admin@xonotic.org" \
262 echo "$X is complete!"
266 for X in common.*.po.disabled; do
267 [ -f "$X" ] || continue
268 if [ -n "$language" ]; then
269 if [ x"${X#common.}" != x"$language.po" ]; then
273 msgmerge -F -U "$X" common.pot >/dev/null 2>&1