Skip to content

Commit 3ccbb98

Browse files
author
jef
committed
fix create_new_ts.sh
git-svn-id: http://svn.osgeo.org/qgis/trunk@14081 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent b425ab2 commit 3ccbb98

File tree

2 files changed

+36
-28
lines changed

2 files changed

+36
-28
lines changed

scripts/create_new_ts.sh

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,4 @@ if [ -z "$1" ] ; then
99
exit 0
1010
fi
1111

12-
# Create a new .ts file for a new translation in qgis
13-
# 1. create a clean Qt .pro file for the project
14-
# 2. run lupdate using the .pro file from step 1
15-
# 3. remove the .pro
16-
# update_ts_files.sh,v 1.3 2004/07/14 18:16:24 gsherman Exp
17-
18-
#first tar the qt_xx.ts files in i18n folder such that lupdate does not
19-
#merge the qgis strings to them
20-
QTDIR=/usr/
21-
echo Creating qt_ts.tar
22-
tar -cvf i18n/qt_ts.tar i18n/qt_*.ts
23-
rm i18n/qt_*.ts
24-
echo Creating qmake project file
25-
$QTDIR/bin/qmake -project -o qgis_ts.pro
26-
#add our new translation to the pro file
27-
echo "Creating new translation entry for $1 in the pro file"
28-
echo "TRANSLATIONS += i18n/qgis_${1}.ts" >> qgis_ts.pro
29-
echo Updating translation files
30-
$QTDIR/bin/lupdate -verbose qgis_ts.pro
31-
echo Removing qmake project file
32-
rm qgis_ts.pro
33-
echo Unpacking qt_ts.tar
34-
tar -xvf i18n/qt_ts.tar
12+
$(dirname $0)/update_ts_files.sh -a $1

scripts/update_ts_files.sh

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,27 @@ echo Saving Qt translations
5151
tar --remove-files -cf i18n/qt_ts.tar i18n/qt_*.ts
5252
exclude=
5353
opts=
54-
for i in "$@"; do
55-
if [ -f "i18n/qgis_$i.ts" ]; then
56-
exclude="$exclude --exclude i18n/qgis_$i.ts"
54+
while (( $# > 0 )); do
55+
arg=$1
56+
shift
57+
58+
if [ "$arg" = "-a" ]; then
59+
arg=$1
60+
shift
61+
if [ -f "i18n/qgis_$arg.ts" ]; then
62+
echo "cannot add existing tranlation $arg"
63+
exit 1
64+
else
65+
add="$add $arg"
66+
fi
67+
elif [ -f "i18n/qgis_$arg.ts" ]; then
68+
exclude="$exclude --exclude i18n/qgis_$arg.ts"
5769
else
58-
opts=" $i"
70+
opts="$opts $arg"
5971
fi
6072
done
61-
if [ -n "$exclude" ]; then
73+
74+
if [ -n "$exclude" -o -n "$add" ]; then
6275
echo Saving excluded translations
6376
tar --remove-files -cf i18n/qgis_ts.tar i18n/qgis_*.ts$exclude
6477
fi
@@ -86,5 +99,22 @@ do
8699
[ -f "$i" ] && mv "$i" "$i.save"
87100
done
88101
qmake -project -o qgis_ts.pro -nopwd src python i18n
102+
if [ -n "$add" ]; then
103+
for i in $add; do
104+
echo "Adding translation for $i"
105+
echo "TRANSLATIONS += i18n/qgis_$i.ts" >> qgis_ts.pro
106+
done
107+
fi
89108
echo Updating translations
90109
lupdate$opts -verbose qgis_ts.pro
110+
111+
if [ -n "$add" ]; then
112+
for i in $add; do
113+
if [ -f i18n/qgis_$i.ts ]; then
114+
svn add i18n/qgis_$i.ts
115+
else
116+
echo "Translaiton for $i was not added"
117+
exit 1
118+
fi
119+
done
120+
fi

0 commit comments

Comments
 (0)