Aleksander Machniak
2013-10-09 07e5d737b732882c6104f39604f0568ed531c6e3
commit | author | age
664710 1 #!/bin/sh
AM 2
3 # In 'translator' mode files will contain empty translated texts
4 # where translation is not available, we'll remove these later
5
07e5d7 6 #tx --debug pull -a --mode translator
664710 7
AM 8 PWD=`dirname "$0"`
9
10 do_clean()
11 {
915bac 12     # do not cleanup en_US files
AM 13     echo "$1" | grep -v en_US > /dev/null || return
14
664710 15     echo "Cleaning $1"
AM 16
17     # remove untranslated/empty texts
18     perl -pi -e "s/^\\\$labels\[[^]]+\]\s+=\s+'';\n//g" $1
19     perl -pi -e "s/^\\\$messages\[[^]]+\]\s+=\s+'';\n//g" $1
20     # remove (one-line) comments
07e5d7 21     perl -pi -e "s/^\\/\\/.*//g" $1
664710 22     # remove empty lines (but not in file header)
AM 23     perl -ne 'print if ($. < 21 || length($_) > 1)' $1 > $1.tmp
24     mv $1.tmp $1
25 }
26
27 # clean up translation files
28 for file in $PWD/../program/localization/*/*.inc; do
29     do_clean $file
30 done
915bac 31 exit
AM 32
664710 33 for file in $PWD/../plugins/*/localization/*.inc; do
AM 34     do_clean $file
35 done