X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=po%2Fpull-from-transifex.sh;h=a0fc017ed44ad063ddabe1443239ce06dfc81567;hp=e5dd6b19f6959b1b7831eadb914d2d698a069657;hb=d68e9d67200abc51123b357bcdbbc816d4a70791;hpb=37112539ef48c17968eb2d55fb8fc76b20329040 diff --git a/po/pull-from-transifex.sh b/po/pull-from-transifex.sh index e5dd6b19..a0fc017e 100755 --- a/po/pull-from-transifex.sh +++ b/po/pull-from-transifex.sh @@ -1,9 +1,21 @@ #!/bin/bash -tx pull $* && -git add po/*.po && ( +tx pull -a $* > /dev/null && +for po in po/*.po; do + basename "${po%.po}" +done | sort > po/LINGUAS && +git add po/*.po po/LINGUAS && ( translators=$(while read mode pofile; do - translator=$(git diff --cached -- ${pofile} | perl -le 'while (<>) { if (/^\+(?:#|.*?:) *(.*?)(<[^@>]+@[^>]+>)/p) { $xltrs{$2} = $1 unless $xltrs{$2}; } last if /^\+"Last-Translator: /; }; push(@out, $n.$e) while (($e, $n) = each %xltrs); print(join(", ", @out));') + translator=$(git diff --cached -- ${pofile} | perl -le ' + while (<>) { + if (/^(?:\+(?:#|.*?:)|[ +]"Last-Translator:) *(.*?)(<[^@>]+@[^>]+>)/p) { + $xltrs{$2} = $1 unless $xltrs{$2}; + last if $& =~ /Last-Translator:/; + } + } + push(@out, $n.$e) while (($e, $n) = each %xltrs); + print(join(", ", @out)); + ') lang=${pofile%.po} lang=${lang#po/} echo " - ${lang}: ${translator}" @@ -11,6 +23,13 @@ git add po/*.po && ( git commit -em "Update translations from Transifex + $(for i in po/*.po; do + msgfmt --statistics $i + done |& + perl -ne '/([0-9]+) translated/ and $translated+=$1; + END { printf("%d translated messages", $translated); }' + ) + Many thanks to: -${translators}" po/*.po +${translators}" )