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
34 make QCC="../../../../gmqcc/gmqcc" clean
35 make QCC="../../../../gmqcc/gmqcc"
37 grep -h '^\.' .tmp/*_includes.txt | cut -d ' ' -f 2 | sed -e 's,^,qcsrc/,' | while IFS= read -r name; do
41 name=${name%%/./*}/${name#*/./}
49 name=$before/${name#*/../}
61 } | xgettext -LC -k_ -f- --from-code utf-8 -F -o common.pot.new >&2
62 if msgcmp -N --use-untranslated common.pot common.pot.new && msgcmp -N --use-untranslated common.pot.new common.pot; then
63 echo "No contentful changes to common.pot - OK."
66 echo "Updating common.pot. This probably should be committed."
67 mv -v common.pot.new common.pot
71 if [ x"$mode" = x"txt" ]; then
73 item=`grep "^en " languages.txt`
75 for X in common.*.po; do
76 [ -f "$X" ] || continue
77 if [ -n "$language" ]; then
78 if [ x"${X#common.}" != x"$language.po" ]; then
82 if [ x"${X#common.}" = x"en.po" ]; then
86 # Note: we're only reporting EXISTING fuzzy matches in the Fuzzy count, thus -N.
87 po=`msgmerge -N "$X" common.pot`
88 ne=`printf "%s\n" "$po" | msgfmt -o /dev/null --check-format --check-header --use-fuzzy - 2>&1 | grep . | wc -l`
89 nu=`printf "%s\n" "$po" | msgattrib --untranslated - | grep -c ^#:`
90 nf=`printf "%s\n" "$po" | msgattrib --fuzzy - | grep -c ^#:`
91 nt=`printf "%s\n" "$po" | grep -c ^#:`
92 n=$(($ne + $nu + $nf))
93 p=$(( (nt - n) * 100 / nt ))
94 echo >&2 "TODO for translation $X:"
95 echo >&2 "Errors: $ne"
96 echo >&2 "Untranslated: $nu"
99 echo >&2 "Percent: $p"
102 if ! item=`grep "^$l " languages.txt`; then
103 if [ "$p" -lt 50 ]; then
106 item="$l \"$l\" \"$l\" 0%"
108 printf "%s\n" "$item" | sed -e "s/[0-9][0-9]*%/$p%/"
110 } | LC_ALL=C sort -t '"' -k4,4
113 if [ x"$mode" = x"po" ]; then
114 for X in common.*.po; do
115 [ -f "$X" ] || continue
116 if [ -n "$language" ]; then
117 if [ x"${X#common.}" != x"$language.po" ]; then
121 if [ x"${X#common.}" = x"en.po" ]; then
125 # Note: no -N here, this is the point where we allow fuzzy matching.
126 msgmerge -F -U "$X" common.pot >&2
127 msgfmt -o /dev/null --check-format --check-header --use-fuzzy "$X" 2>&1 \
128 | grep . > "$X".errors || rm -f "$X".errors
129 msgattrib --untranslated "$X" | grep . > "$X".untranslated || rm -f "$X".untranslated
130 msgattrib --fuzzy "$X" | grep . > "$X".fuzzy || rm -f "$X".fuzzy
131 ne=$((`wc -l < "$X".errors 2>/dev/null` + 0))
132 nu=$((`grep -c ^#: "$X".untranslated 2>/dev/null` + 0))
133 nf=$((`grep -c ^#: "$X".fuzzy 2>/dev/null` + 0))
134 n=$(($ne + $nu + $nf))
136 for Y in ~/check-translations/"$X".*; do
137 [ -f "$Y" ] || continue
140 set fileencoding=utf-8
145 if ! msgcat "$Y" >/dev/null; then
146 echo "File $Y has syntax errors. Skipped."
149 msgcat -F --use-first "$Y" "$X" > "$X".new
157 msgfmt -o /dev/null --check-format --check-header --use-fuzzy "$X" 2>&1 \
158 | grep . > "$X".errors || rm -f "$X".errors
159 msgattrib --untranslated "$X" | grep . > "$X".untranslated || rm -f "$X".untranslated
160 msgattrib --fuzzy "$X" | grep . > "$X".fuzzy || rm -f "$X".fuzzy
161 ne=$((`wc -l < "$X".errors 2>/dev/null` + 0))
162 nu=$((`grep -c ^#: "$X".untranslated 2>/dev/null` + 0))
163 nf=$((`grep -c ^#: "$X".fuzzy 2>/dev/null` + 0))
164 n=$(($ne + $nu + $nf))
166 if [ $n -gt 0 ]; then
167 echo "TODO for translation $X:"
168 echo "Errors: $ne (was: $ne0)"
169 echo "Untranslated: $nu (was: $nu0)"
170 echo "Fuzzy: $nf (was: $nf0)"
171 ltr=`grep '^"Last-Translator: ' "$X" | cut -d ' ' -f 2- | cut -d '\\' -f 1 | egrep -v '<LL@li.org>|<EMAIL@ADDRESS>'`
172 ltm=`grep '^"Language-Team: ' "$X" | cut -d ' ' -f 2- | cut -d '\\' -f 1 | egrep -v '<LL@li.org>|<EMAIL@ADDRESS>'`
173 echo "Translators: $ltr, $ltm"
181 if [ x"$ltr" = x"$ltm" ]; then
188 if [ -n "$to" ]; then
191 if [ -n "$cc" ]; then
194 if [ -n "$to" ]; then
196 echo "Send mail? [y/n]"
201 if [ $ne -gt 0 ]; then
202 attach="$attach $X.errors"
204 if [ $nu -gt 0 ]; then
205 attach="$attach $X.untranslated"
207 if [ $nf -gt 0 ]; then
208 attach="$attach $X.fuzzy"
214 as you provided us with translations in the past, we kindly ask you
215 to update the translation to match changes in the Xonotic source. Can
216 you please work on them and provide updates to us?
218 For reference, the current version of the translation file is at:
219 http://git.xonotic.org/?p=xonotic/xonotic-data.pk3dir.git;a=blob;f=$X
221 If you do not wish to be contacted for translation updates any more,
222 please tell us in a reply to this message.
225 if [ $nu -gt 0 ]; then
227 Attached to this message is a file
229 with $nu yet to be translated messages. Please translate them and reply
230 with the file containing the translations in the "msgstr" fields.
234 if [ $nf -gt 0 ]; then
236 Attached to this message is a file
238 with $nf automatically generated translations. Please verify and/or fix
239 them and reply with the file having been verified by you.
249 -e "set from=\"divVerent@xonotic.org\"" \
250 -e "set use_from=yes" \
251 -e "set use_envelope_from=yes" \
252 -s "Need update for translations: $X" \
254 -b "admin@xonotic.org" \
266 echo "$X is complete!"
270 for X in common.*.po.disabled; do
271 [ -f "$X" ] || continue
272 if [ -n "$language" ]; then
273 if [ x"${X#common.}" != x"$language.po" ]; then
277 # Note: no -N here, this is the point where we allow fuzzy matching.
278 msgmerge -F -U "$X" common.pot >/dev/null 2>&1