Rework how icons are handled in the build system
[quassel.git] / po / pull-from-transifex.sh
1 #!/bin/bash
2
3 tx pull -a $* > /dev/null &&
4 for po in po/*.po; do
5   basename "${po%.po}"
6 done | sort > po/LINGUAS &&
7 git add po/*.po po/LINGUAS && (
8   translators=$(while read mode pofile; do
9     translator=$(git diff --cached -- ${pofile} | perl -le '
10       while (<>) {
11         if (/^(?:\+(?:#|.*?:)|[ +]"Last-Translator:) *(.*?)(<[^@>]+@[^>]+>)/p) {
12           $xltrs{$2} = $1 unless $xltrs{$2};
13           last if $& =~ /Last-Translator:/;
14         }
15       }
16       push(@out, $n.$e) while (($e, $n) = each %xltrs);
17       print(join(", ", @out));
18     ')
19     lang=${pofile%.po}
20     lang=${lang#po/}
21     echo " - ${lang}: ${translator}"
22   done < <(git status --porcelain po/*.po | egrep '^[AM]  '))
23
24   git commit -em "Update translations from Transifex
25
26   $(for i in po/*.po; do
27       msgfmt --statistics $i
28     done |&
29     perl -ne '/([0-9]+) translated/ and $translated+=$1;
30               END { printf("%d translated messages", $translated); }'
31   )
32
33 Many thanks to:
34 ${translators}"
35 )