silence po/pull-from-transifex.sh
[quassel.git] / po / pull-from-transifex.sh
1 #!/bin/bash
2
3 tx pull $* > /dev/null &&
4 git add po/*.po && (
5   translators=$(while read mode pofile; do
6     translator=$(git diff --cached -- ${pofile} | perl -le '
7       while (<>) {
8         if (/^(?:\+(?:#|.*?:)|[ +]"Last-Translator:) *(.*?)(<[^@>]+@[^>]+>)/p) {
9           $xltrs{$2} = $1 unless $xltrs{$2};
10           last if $& =~ /Last-Translator:/;
11         }
12       }
13       push(@out, $n.$e) while (($e, $n) = each %xltrs);
14       print(join(", ", @out));
15     ')
16     lang=${pofile%.po}
17     lang=${lang#po/}
18     echo " - ${lang}: ${translator}"
19   done < <(git status --porcelain po/*.po | egrep '^[AM]  '))
20
21   git commit -em "Update translations from Transifex
22
23 Many thanks to:
24 ${translators}" po/*.po
25 )