20 echo "Sorry, you are not supposed to use this script."
21 echo "This script is solely for use by the Xonotic Core Team."
22 echo "Unauthorized use of it can cause HIGHLY annoying merge"
33 if [ x"$mode" = x"pot" ]; then
35 git ls-files qcsrc | sort -u
36 } | xgettext -LC -k_ -f- --from-code utf-8 -F -o common.pot.new >&2
37 if msgcmp -N --use-untranslated common.pot common.pot.new && msgcmp -N --use-untranslated common.pot.new common.pot; then
38 echo "No contentful changes to common.pot - OK."
39 ls -la common.pot common.pot.new
42 echo "Updating common.pot. This probably should be committed."
43 mv -v common.pot.new common.pot
47 if [ x"$mode" = x"txt" ]; then
49 item=`grep "^en " languages.txt`
51 for X in common.*.po; do
52 [ -f "$X" ] || continue
53 if [ -n "$language" ]; then
54 if [ x"${X#common.}" != x"$language.po" ]; then
58 if [ x"${X#common.}" = x"en.po" ]; then
62 # Note: we're only reporting EXISTING fuzzy matches in the Fuzzy count, thus -N.
63 po=`msgmerge -N "$X" common.pot`
64 ne=`printf "%s\n" "$po" | msgfmt -o /dev/null --check-format --check-header --use-fuzzy - 2>&1 | grep . | wc -l || true`
65 nu=`printf "%s\n" "$po" | msgattrib --untranslated - | grep -c ^#: || true`
66 nf=`printf "%s\n" "$po" | msgattrib --fuzzy - | grep -c ^#: || true`
67 nt=`printf "%s\n" "$po" | grep -c ^#: || true`
68 n=$(($ne + $nu + $nf))
69 p=$(( (nt - n) * 100 / nt ))
70 echo >&2 "TODO for translation $X:"
71 echo >&2 "Errors: $ne"
72 echo >&2 "Untranslated: $nu"
75 echo >&2 "Percent: $p"
78 if ! item=`grep "^$l " languages.txt`; then
79 if [ "$p" -lt 50 ]; then
82 item="$l \"$l\" \"$l\" 0%"
84 printf "%s\n" "$item" | sed -e "s/[0-9][0-9]*%/$p%/"
86 } | LC_ALL=C sort -t '"' -k4,4
89 if [ x"$mode" = x"po" ]; then
90 for X in common.*.po; do
91 [ -f "$X" ] || continue
92 if [ -n "$language" ]; then
93 if [ x"${X#common.}" != x"$language.po" ]; then
97 if [ x"${X#common.}" = x"en.po" ]; then
101 # Note: no -N here, this is the point where we allow fuzzy matching.
102 msgmerge -F -U "$X" common.pot >&2
103 msgfmt -o /dev/null --check-format --check-header --use-fuzzy "$X" 2>&1 \
104 | grep . > "$X".errors || rm -f "$X".errors
105 msgattrib --untranslated "$X" | grep . > "$X".untranslated || rm -f "$X".untranslated
106 msgattrib --fuzzy "$X" | grep . > "$X".fuzzy || rm -f "$X".fuzzy
107 ne=$((`wc -l < "$X".errors 2>/dev/null` + 0))
108 nu=$((`grep -c ^#: "$X".untranslated 2>/dev/null` + 0))
109 nf=$((`grep -c ^#: "$X".fuzzy 2>/dev/null` + 0))
110 n=$(($ne + $nu + $nf))
112 for Y in ~/check-translations/"$X".*; do
113 [ -f "$Y" ] || continue
116 set fileencoding=utf-8
121 if ! msgcat "$Y" >/dev/null; then
122 echo "File $Y has syntax errors. Skipped."
125 msgcat -F --use-first "$Y" "$X" > "$X".new
133 msgfmt -o /dev/null --check-format --check-header --use-fuzzy "$X" 2>&1 \
134 | grep . > "$X".errors || rm -f "$X".errors
135 msgattrib --untranslated "$X" | grep . > "$X".untranslated || rm -f "$X".untranslated
136 msgattrib --fuzzy "$X" | grep . > "$X".fuzzy || rm -f "$X".fuzzy
137 ne=$((`wc -l < "$X".errors 2>/dev/null` + 0))
138 nu=$((`grep -c ^#: "$X".untranslated 2>/dev/null` + 0))
139 nf=$((`grep -c ^#: "$X".fuzzy 2>/dev/null` + 0))
140 n=$(($ne + $nu + $nf))
142 if [ $n -gt 0 ]; then
143 echo "TODO for translation $X:"
144 echo "Errors: $ne (was: $ne0)"
145 echo "Untranslated: $nu (was: $nu0)"
146 echo "Fuzzy: $nf (was: $nf0)"
147 ltr=`grep '^"Last-Translator: ' "$X" | cut -d ' ' -f 2- | cut -d '\\' -f 1 | egrep -v '<LL@li.org>|<EMAIL@ADDRESS>'`
148 ltm=`grep '^"Language-Team: ' "$X" | cut -d ' ' -f 2- | cut -d '\\' -f 1 | egrep -v '<LL@li.org>|<EMAIL@ADDRESS>'`
149 echo "Translators: $ltr, $ltm"
157 if [ x"$ltr" = x"$ltm" ]; then
164 if [ -n "$to" ]; then
167 if [ -n "$cc" ]; then
170 if [ -n "$to" ]; then
172 echo "Send mail? [y/n]"
177 if [ $ne -gt 0 ]; then
178 attach="$attach $X.errors"
180 if [ $nu -gt 0 ]; then
181 attach="$attach $X.untranslated"
183 if [ $nf -gt 0 ]; then
184 attach="$attach $X.fuzzy"
190 as you provided us with translations in the past, we kindly ask you
191 to update the translation to match changes in the Xonotic source. Can
192 you please work on them and provide updates to us?
194 For reference, the current version of the translation file is at:
195 http://git.xonotic.org/?p=xonotic/xonotic-data.pk3dir.git;a=blob;f=$X
197 If you do not wish to be contacted for translation updates any more,
198 please tell us in a reply to this message.
201 if [ $nu -gt 0 ]; then
203 Attached to this message is a file
205 with $nu yet to be translated messages. Please translate them and reply
206 with the file containing the translations in the "msgstr" fields.
210 if [ $nf -gt 0 ]; then
212 Attached to this message is a file
214 with $nf automatically generated translations. Please verify and/or fix
215 them and reply with the file having been verified by you.
225 -e "set from=\"divVerent@xonotic.org\"" \
226 -e "set use_from=yes" \
227 -e "set use_envelope_from=yes" \
228 -s "Need update for translations: $X" \
230 -b "admin@xonotic.org" \
242 echo "$X is complete!"
246 for X in common.*.po.disabled; do
247 [ -f "$X" ] || continue
248 if [ -n "$language" ]; then
249 if [ x"${X#common.}" != x"$language.po" ]; then
253 # Note: no -N here, this is the point where we allow fuzzy matching.
254 msgmerge -F -U "$X" common.pot >/dev/null 2>&1