Drop useless check: location is unsigned and, thus, always >= 0
[TortoiseGit.git] / Languages / po-update.sh
blobd2f461bf9b3f25187996eb63ddc8daa1921b81af
1 #!/bin/sh
3 # Usage:
4 # ./po-update.sh
5 # - to update all locales
6 # ./po-update.sh LL
7 # - to update one the LL locale
9 set -e
11 MSGMERGE=${MSGMERGE:-msgmerge}
13 tsvn_base=
14 for i in . .. ../..; do
15 if [ -d "$i/tortoisesvn/Languages" ]; then
16 tsvn_base="$i"
17 break
19 done
20 if [ -z "$tsvn_base" ]; then
21 echo "E: You must run po-update.sh from within a TortoiseSVN source tree." >&2
22 exit 1
25 update_po()
27 (cd $tsvn_base/tortoisesvn/Languages &&
28 for i in $1.po; do
29 echo "Updating $i..."
30 msgmerge --no-wrap -o tmp.po $i Tortoise.pot
31 mv -f tmp.po $i
32 done )
35 if [ $# -eq 0 ]; then
36 update_po \*
37 else
38 langs=
39 while [ $# -ge 1 ]; do
40 case $1 in
41 pot) ;;
43 if [ -e $tsvn_base/tortoisesvn/Languages/Tortoise_$1.po ]; then
44 langs="$langs Tortoise_$1"
45 else
46 echo "E: No such .po file 'Tortoise_$1.po'" >&2
47 exit 1
49 esac
50 shift
51 done
52 for lang in $langs; do
53 update_po $lang
54 done