merge-po-from-plugin.sh 826 B

1234567891011121314151617181920212223242526272829303132333435
  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
  6. #Check if new files are in POTFILES
  7. sources=`find $2 -name '*.[ch]'`
  8. translatedfiles=`grep -rwl '_(' $sources`
  9. for file in $translatedfiles; do
  10. file=`echo $file|sed "s/^\.\.\///"`
  11. inPOTFILESin=`grep $file POTFILES.in`
  12. inPOTFILES=`grep $file POTFILES`
  13. if [ "$inPOTFILESin" = "" ]; then
  14. echo "$file not in POTFILES.in, please add it"
  15. err=1
  16. elif [ "$inPOTFILES" = "" ]; then
  17. echo "$file not in POTFILES, please autogen.sh"
  18. err=1
  19. fi
  20. done
  21. if [ "$err" = "1" ]; then
  22. exit 1
  23. fi
  24. #update all with new files
  25. make update-po
  26. #Merge with old plugin po files
  27. for pluginpo in $1/*.po; do
  28. corepo=`basename $pluginpo`
  29. msgcat --use-first $corepo $pluginpo > $corepo.new && mv $corepo.new $corepo
  30. done;