txpush.sh 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/bin/bash
  2. #------------------------------------------------------
  3. # Script to push language files to Transifex
  4. #
  5. # Laurent Destailleur (eldy) - eldy@users.sourceforge.net
  6. #------------------------------------------------------
  7. # Usage: txpush.sh (source|xx_XX) [-r dolibarr.file] [-f]
  8. #------------------------------------------------------
  9. export project='dolibarr'
  10. DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
  11. cd $DIR/../..
  12. # Syntax
  13. if [ "x$1" = "x" ]
  14. then
  15. echo "This push local files to transifex for project $project."
  16. echo "Note: If you push a language file (not source), file will be skipped if transifex file is newer."
  17. echo " Using -f will overwrite translation but not memory."
  18. echo "Usage: ./dev/translation/txpush.sh (source|xx_XX|all) [-r $project.file] [-f] [--no-interactive]"
  19. exit
  20. fi
  21. if [ ! -d ".tx" ]
  22. then
  23. echo "Script must be ran from root directory of project with command ./dev/translation/txpush.sh"
  24. exit
  25. fi
  26. if [ "x$1" = "xsource" ]
  27. then
  28. echo "tx push -s $2 $3"
  29. tx push -s $2 $3
  30. else
  31. if [ "x$1" = "xall" ]
  32. then
  33. for dir in `find htdocs/langs/* -type d`
  34. do
  35. shortdir=`basename $dir`
  36. file=$3
  37. echo $file
  38. export basefile=`basename $file | sed -s s/\.lang//g`
  39. echo "tx push --skip -t -l $shortdir $2 $3 $4"
  40. tx push --skip -t -l $shortdir $2 $3 $4
  41. done
  42. else
  43. for file in `find htdocs/langs/$1/*.lang -type f`
  44. do
  45. echo $file
  46. export basefile=`basename $file | sed -s s/\.lang//g`
  47. echo "tx push --skip -r $project.$basefile -t -l $1 $2 $3 $4"
  48. tx push --skip -r $project.$basefile -t -l $1 $2 $3 $4
  49. done
  50. fi
  51. fi