txpush.sh 1.5 KB

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