txpull.sh 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/bin/bash
  2. #------------------------------------------------------
  3. # Script to pull language files to Transifex
  4. #
  5. # Laurent Destailleur - eldy@users.sourceforge.net
  6. #------------------------------------------------------
  7. # Usage: txpull.sh (all|xx_XX) [-r dolibarr.file] [-f]
  8. #------------------------------------------------------
  9. DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
  10. cd $DIR/../..
  11. # Syntax
  12. if [ "x$1" = "x" ]
  13. then
  14. echo "This pull remote transifex files to local dir."
  15. echo "Note: If you pull a language file (not source), file will be skipped if local file is newer."
  16. echo " Using -f will overwrite local file (does not work with 'all')."
  17. echo " Using -s will force fetching of source file (avoid it, use en_US as language instead)."
  18. echo " Using en_US as language parameter will update source language from transifex (en_US is excluded from 'all')."
  19. echo "Usage: ./dev/translation/txpull.sh (all|en_US|xx_XX) [-r dolibarr.file] [-f] [-s]"
  20. exit
  21. fi
  22. if [ ! -d ".tx" ]
  23. then
  24. echo "Script must be ran from root directory of project with command ./dev/translation/txpull.sh"
  25. exit
  26. fi
  27. if [ "x$1" = "xall" ]
  28. then
  29. if [ "x$2" = "x" ]
  30. then
  31. echo "tx pull -a"
  32. tx pull -a
  33. echo "Remove some language directories (not enough translated) like ach, br_FR, en, frp, fy_NL, ..."
  34. rm -fr htdocs/langs/ach
  35. rm -fr htdocs/langs/br_FR
  36. rm -fr htdocs/langs/en
  37. rm -fr htdocs/langs/frp
  38. rm -fr htdocs/langs/fy_NL
  39. else
  40. for dir in `find htdocs/langs/* -type d`
  41. do
  42. fic=`basename $dir`
  43. if [ $fic != "en_US" ]
  44. then
  45. echo "tx pull -l $fic $2 $3"
  46. tx pull -l $fic $2 $3
  47. fi
  48. done
  49. fi
  50. cd -
  51. else
  52. echo "tx pull -l $1 $2 $3 $4 $5"
  53. tx pull -l $1 $2 $3 $4 $5
  54. fi
  55. echo Think to launch also:
  56. echo "> dev/tools/fixaltlanguages.sh fix all"
  57. echo "For v11: Replace also regex \(.*(sponge|cornas|eratosthene|cyan).*\) with '' on *.lang files"