if cmd is invalid, NULL it
[claws.git] / po / merge-po-from-plugin.sh
blob66fc7da79af211afc53d809123577873e42be05b
1 #!/bin/bash
2 if [ "$1" = "" -o "$2" = "" ]; then
3 echo usage: $0 path/to/oldplugin/po/ ../src/plugins/newplugin
4 exit 1
5 fi
7 #Check if new files are in POTFILES
9 sources=`find $2 -name '*.[ch]'`
10 translatedfiles=`grep -rwl '_(' $sources`
11 for file in $translatedfiles; do
12 file=`echo $file|sed "s/^\.\.\///"`
13 inPOTFILESin=`grep $file POTFILES.in`
14 inPOTFILES=`grep $file POTFILES`
15 if [ "$inPOTFILESin" = "" ]; then
16 echo "$file not in POTFILES.in, please add it"
17 err=1
18 elif [ "$inPOTFILES" = "" ]; then
19 echo "$file not in POTFILES, please autogen.sh"
20 err=1
22 done
23 if [ "$err" = "1" ]; then
24 exit 1
27 #update all with new files
28 make update-po
30 #Merge with old plugin po files
31 for pluginpo in $1/*.po; do
32 corepo=`basename $pluginpo`
33 msgcat --use-first $corepo $pluginpo > $corepo.new && mv $corepo.new $corepo
34 done;