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 -N --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 # Note: we're only reporting EXISTING fuzzy matches in the Fuzzy count, thus -N.
85 po=`msgmerge -N "$X" common.pot`
86 ne=`printf "%s\n" "$po" | msgfmt -o /dev/null --check-format --check-header --use-fuzzy - 2>&1 | grep . | wc -l`
87 nu=`printf "%s\n" "$po" | msgattrib --untranslated - | grep -c ^#:`
88 nf=`printf "%s\n" "$po" | msgattrib --fuzzy - | grep -c ^#:`
89 nt=`printf "%s\n" "$po" | grep -c ^#:`
90 n=$(($ne + $nu + $nf))
91 p=$(( (nt - n) * 100 / nt ))
92 echo >&2 "TODO for translation $X:"
93 echo >&2 "Errors: $ne"
94 echo >&2 "Untranslated: $nu"
97 echo >&2 "Percent: $p"
100 if ! item=`grep "^$l " languages.txt`; then
101 if [ "$p" -lt 50 ]; then
104 item="$l $l \"$l\" 0%"
106 printf "%s\n" "$item" | sed -e "s/[0-9][0-9]*%/$p%/"
108 } | tr '"' '\t' | sort -k3 | tr '\t' '"'
111 if [ x"$mode" = x"po" ]; then
112 for X in common.*.po; do
113 [ -f "$X" ] || continue
114 if [ -n "$language" ]; then
115 if [ x"${X#common.}" != x"$language.po" ]; then
119 if [ x"${X#common.}" = x"en.po" ]; then
123 # Note: no -N here, this is the point where we allow fuzzy matching.
124 msgmerge -F -U "$X" common.pot >&2
125 msgfmt -o /dev/null --check-format --check-header --use-fuzzy "$X" 2>&1 \
126 | grep . > "$X".errors || rm -f "$X".errors
127 msgattrib --untranslated "$X" | grep . > "$X".untranslated || rm -f "$X".untranslated
128 msgattrib --fuzzy "$X" | grep . > "$X".fuzzy || rm -f "$X".fuzzy
129 ne=$((`wc -l < "$X".errors 2>/dev/null` + 0))
130 nu=$((`grep -c ^#: "$X".untranslated 2>/dev/null` + 0))
131 nf=$((`grep -c ^#: "$X".fuzzy 2>/dev/null` + 0))
132 n=$(($ne + $nu + $nf))
134 for Y in ~/check-translations/"$X".*; do
135 [ -f "$Y" ] || continue
138 set fileencoding=utf-8
143 if ! msgcat "$Y" >/dev/null; then
144 echo "File $Y has syntax errors. Skipped."
147 msgcat -F --use-first "$Y" "$X" > "$X".new
155 msgfmt -o /dev/null --check-format --check-header --use-fuzzy "$X" 2>&1 \
156 | grep . > "$X".errors || rm -f "$X".errors
157 msgattrib --untranslated "$X" | grep . > "$X".untranslated || rm -f "$X".untranslated
158 msgattrib --fuzzy "$X" | grep . > "$X".fuzzy || rm -f "$X".fuzzy
159 ne=$((`wc -l < "$X".errors 2>/dev/null` + 0))
160 nu=$((`grep -c ^#: "$X".untranslated 2>/dev/null` + 0))
161 nf=$((`grep -c ^#: "$X".fuzzy 2>/dev/null` + 0))
162 n=$(($ne + $nu + $nf))
164 if [ $n -gt 0 ]; then
165 echo "TODO for translation $X:"
166 echo "Errors: $ne (was: $ne0)"
167 echo "Untranslated: $nu (was: $nu0)"
168 echo "Fuzzy: $nf (was: $nf0)"
169 ltr=`grep '^"Last-Translator: ' "$X" | cut -d ' ' -f 2- | cut -d '\\' -f 1 | egrep -v '<LL@li.org>|<EMAIL@ADDRESS>'`
170 ltm=`grep '^"Language-Team: ' "$X" | cut -d ' ' -f 2- | cut -d '\\' -f 1 | egrep -v '<LL@li.org>|<EMAIL@ADDRESS>'`
171 echo "Translators: $ltr, $ltm"
179 if [ x"$ltr" = x"$ltm" ]; then
186 if [ -n "$to" ]; then
189 if [ -n "$cc" ]; then
192 if [ -n "$to" ]; then
194 echo "Send mail? [y/n]"
199 if [ $ne -gt 0 ]; then
200 attach="$attach $X.errors"
202 if [ $nu -gt 0 ]; then
203 attach="$attach $X.untranslated"
205 if [ $nf -gt 0 ]; then
206 attach="$attach $X.fuzzy"
212 as you provided us with translations in the past, we kindly ask you
213 to update the translation to match changes in the Xonotic source. Can
214 you please work on them and provide updates to us?
216 For reference, the current version of the translation file is at:
217 http://git.xonotic.org/?p=xonotic/xonotic-data.pk3dir.git;a=blob;f=$X
219 If you do not wish to be contacted for translation updates any more,
220 please tell us in a reply to this message.
223 if [ $nu -gt 0 ]; then
225 Attached to this message is a file
227 with $nu yet to be translated messages. Please translate them and reply
228 with the file containing the translations in the "msgstr" fields.
232 if [ $nf -gt 0 ]; then
234 Attached to this message is a file
236 with $nf automatically generated translations. Please verify and/or fix
237 them and reply with the file having been verified by you.
247 -e "set from=\"divVerent@xonotic.org\"" \
248 -e "set use_from=yes" \
249 -e "set use_envelope_from=yes" \
250 -s "Need update for translations: $X" \
252 -b "admin@xonotic.org" \
264 echo "$X is complete!"
268 for X in common.*.po.disabled; do
269 [ -f "$X" ] || continue
270 if [ -n "$language" ]; then
271 if [ x"${X#common.}" != x"$language.po" ]; then
275 # Note: no -N here, this is the point where we allow fuzzy matching.
276 msgmerge -F -U "$X" common.pot >/dev/null 2>&1