diff options
author | Thomas Bruederli <thomas@roundcube.net> | 2013-10-10 23:03:01 +0200 |
---|---|---|
committer | Thomas Bruederli <thomas@roundcube.net> | 2013-10-10 23:03:01 +0200 |
commit | a01f3b959abd9720ec1b33624cbd31bee4838c2b (patch) | |
tree | 1ad5812457031f386a335d2c7b13f1a646c4eb5d /bin/transifexpull.sh | |
parent | e480ca00ba507ea1575bad7ffb824d8d72b666d4 (diff) | |
parent | 4136174517d426dcec74304ce004b4c845f075f5 (diff) |
Merge branch 'master' of github.com:roundcube/roundcubemail
Diffstat (limited to 'bin/transifexpull.sh')
-rwxr-xr-x | bin/transifexpull.sh | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/bin/transifexpull.sh b/bin/transifexpull.sh new file mode 100755 index 000000000..ce25f6fc1 --- /dev/null +++ b/bin/transifexpull.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +# In 'translator' mode files will contain empty translated texts +# where translation is not available, we'll remove these later + +tx --debug pull -a --mode translator + +PWD=`dirname "$0"` + +do_clean() +{ + # do not cleanup en_US files + echo "$1" | grep -v en_US > /dev/null || return + + echo "Cleaning $1" + + # remove untranslated/empty texts + perl -pi -e "s/^\\\$labels\[[^]]+\]\s+=\s+'';\n//" $1 + perl -pi -e "s/^\\\$messages\[[^]]+\]\s+=\s+'';\n//" $1 + # remove variable initialization + perl -pi -e "s/^\\\$(labels|messages)\s*=\s*array\(\);\n//" $1 + # remove (one-line) comments + perl -pi -e "s/^\\/\\/.*//" $1 + # remove empty lines (but not in file header) + perl -ne 'print if ($. < 18 || length($_) > 1)' $1 > $1.tmp + mv $1.tmp $1 +} + +# clean up translation files +for file in $PWD/../program/localization/*/*.inc; do + do_clean $file +done +for file in $PWD/../plugins/*/localization/*.inc; do + do_clean $file +done |