Wesnoth localization tools
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pack 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/bin/bash
  2. # Pack translations
  3. # Copyright (C) 2007-2008 Andrius Štikonas <stikonas@gmail.com>
  4. #
  5. # This program is free software: you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation, either version 3 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. source "`dirname $0`/variables"
  18. counter=0
  19. for BRANCH in $BRANCHES; do
  20. echo -e "Checking out files from $BLUE$BRANCH"$ENDCOLOR
  21. $GIT archive --remote $REPO --prefix=$BRANCH-temp/ --format=tar $BRANCH:po | tar x
  22. mkdir "$LCODE-temp"
  23. counter=0
  24. for file in `find $BRANCH -follow -name "*.$LCODE.po"`; do
  25. bfile=`basename $file`
  26. echo -n "Processing catalog $bfile... ";
  27. d=`echo "$bfile" | sed "s/.$LCODE.po//"`
  28. dirdomain=`echo wesnoth-$d | sed "s/wesnoth-wesnoth/wesnoth/"`
  29. if [ -f "$BRANCH-temp/$dirdomain/$LCODE.po" ]; then
  30. if ! $DIFF -q "$file" "$BRANCH-temp/$dirdomain/$LCODE.po" > /dev/null ; then
  31. mkdir "$LCODE-temp/$dirdomain"
  32. cp "$file" "$LCODE-temp/$dirdomain/$LCODE.po"
  33. echo -e $GREEN"OK"$ENDCOLOR
  34. counter=$(($counter+1))
  35. else
  36. echo -e $BLUE"Skipping"$ENDCOLOR
  37. fi
  38. else
  39. mkdir -p "$LCODE-temp/$dirdomain"
  40. cp "$file" "$LCODE-temp/$dirdomain/$LCODE.po"
  41. echo -e $GREEN"OK"$ENDCOLOR
  42. counter=$(($counter+1))
  43. fi
  44. done
  45. if [ -f "$LCODE-$BRANCH.tar.bz2" ]; then
  46. echo "Removing old archive."
  47. rm -f "$LCODE-$BRANCH.tar.bz2"
  48. fi
  49. if [ ! $counter -eq 0 ]; then
  50. cd $LCODE-temp
  51. $TAR --remove-files -cf ../$LCODE-$BRANCH.tar wesnoth*
  52. cd ..
  53. $BZIP -9 $LCODE-$BRANCH.tar
  54. echo "New archive created."
  55. fi
  56. rm -rf $BRANCH-temp
  57. rmdir $LCODE-temp
  58. done
  59. echo -e $GREEN"Finished."$ENDCOLOR