Translation helper scripts
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.

init-po-files 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/bin/bash
  2. # Copyright (C) 2009 Andrius Štikonas <andrius@stikonas.eu>
  3. #
  4. # This program is free software: you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation, either version 3 of the License, or
  7. # (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. source "`dirname $0`/ths-variables"
  17. source ".ths"
  18. if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
  19. echo "Usage `basename $0` <messages-tree> <pot-tree>"
  20. exit 1
  21. fi
  22. if [ $# -eq 2 ]; then
  23. messages="$1"
  24. pot="$2"
  25. else
  26. messages="trunk-kf5/$lcode/messages"
  27. pot="trunk-kf5/templates/messages"
  28. fi
  29. wdir="`pwd`"
  30. cd "$pot"
  31. for dir in `ls`; do
  32. cd "$dir"
  33. podir="$wdir/$messages/$dir"
  34. if [ ! -e "$podir" ]; then
  35. mkdir "$podir"
  36. svn add "$podir"
  37. fi
  38. for file in `find . -name '*.pot'`; do
  39. po=`echo $file | sed 's/.\{1\}$//'`
  40. if [ ! -e "$podir/$po" ]; then
  41. echo -e $RED"$dir/$po"$ENDCOLOR
  42. msginit -i "$file" -o "$podir/$po" --no-translator
  43. cd "$podir"
  44. svn add "$po"
  45. cd "$wdir/$pot/$dir"
  46. sed -ie 's/\"Plural-Forms: nplurals=3; plural=(n%10==1 \&\& n%100!=11 ? 0 : n%10>=2 \&\& (n"/"Plural-Forms: nplurals=4; plural=(n==1 ? 0 : n%10>=2 \&\& (n%100<10 || n"/
  47. s/\"%100<10 || n%100>=20) ? 1 : 2);\\n\"/"%100>=20) ? 1 : n%10==0 || (n%100>10 \&\& n%100<20) ? 2 : 3);\\n"/
  48. /\"Language: lt\\n\"/d' "$podir/$po"
  49. rm "$podir/$po"e
  50. fi
  51. done
  52. cd ..
  53. done