5
5
# 3. remove the .pro
6
6
# Note the .pro file must NOT be named qgis.pro as this
7
7
# name is reserved for the Windows qmake project file
8
- # update_ts_files.sh,v 1.3 2004/07/14 18:16:24 gsherman Exp
8
+ # $Id$
9
9
10
10
set -e
11
11
12
+ cleanup () {
13
+ if [ -f i18n/qt_ts.tar ]; then
14
+ echo Restoring Qt translations
15
+ tar -xf i18n/qt_ts.tar
16
+ fi
17
+ if [ -f i18n/qgis_ts.tar ]; then
18
+ echo Restoring excluded translations
19
+ tar -xf i18n/qgis_ts.tar
20
+ fi
21
+
22
+ echo Removing temporary files
23
+ perl -i.bak -ne ' print unless /^\s+<location.*python-i18n\.cpp.*$/;' i18n/qgis_* .ts
24
+ for i in \
25
+ python/python-i18n.{ts,cpp} \
26
+ python/plugins/* /python-i18n.{ts,cpp} \
27
+ i18n/qgis_* .ts.bak \
28
+ src/plugins/grass/grasslabels-i18n.cpp \
29
+ i18n/qt_ts.tar \
30
+ i18n/qgis_ts.tar \
31
+ qgis_ts.pro
32
+ do
33
+ [ -f " $i " ] && rm " $i "
34
+ done
35
+
36
+ for i in \
37
+ src/plugins/plugin_template/plugingui.cpp \
38
+ src/plugins/plugin_template/plugin.cpp
39
+ do
40
+ [ -f " $i .save" ] && mv " $i .save" " $i "
41
+ done
42
+ }
43
+
44
+ trap cleanup EXIT
45
+
12
46
PATH=$QTDIR /bin:$PATH
13
47
14
48
# first tar the qt_xx.ts files in i18n folder such that lupdate does not
15
49
# merge the qgis strings to them
16
- echo Creating qt_ts.tar
17
- tar --remove-files -cvf i18n/qt_ts.tar i18n/qt_* .ts
50
+ echo Saving Qt translations
51
+ tar --remove-files -cf i18n/qt_ts.tar i18n/qt_* .ts
18
52
exclude=
19
53
opts=
20
54
for i in " $@ " ; do
@@ -25,7 +59,8 @@ for i in "$@"; do
25
59
fi
26
60
done
27
61
if [ -n " $exclude " ]; then
28
- tar --remove-files -cvf i18n/qgis_ts.tar i18n/qgis_* .ts$exclude
62
+ echo Saving excluded translations
63
+ tar --remove-files -cf i18n/qgis_ts.tar i18n/qgis_* .ts$exclude
29
64
fi
30
65
echo Updating python translations
31
66
cd python
@@ -40,21 +75,16 @@ for i in python/plugins/*/CMakeLists.txt; do
40
75
rm python-i18n.ts
41
76
cd ../../..
42
77
done
78
+ echo Updating GRASS module translations
43
79
perl scripts/qgm2cpp.pl > src/plugins/grass/grasslabels-i18n.cpp
80
+ mv src/plugins/plugin_template/plugingui.cpp src/plugins/plugin_template/plugingui.cpp.save
44
81
echo Creating qmake project file
82
+ for i in \
83
+ src/plugins/plugin_template/plugingui.cpp \
84
+ src/plugins/plugin_template/plugin.cpp
85
+ do
86
+ [ -f " $i " ] && mv " $i " " $i .save"
87
+ done
45
88
qmake -project -o qgis_ts.pro -nopwd src python i18n
46
- echo Updating translation files
89
+ echo Updating translations
47
90
lupdate$opts -verbose qgis_ts.pro
48
- echo Removing temporary python translation files
49
- perl -i.bak -ne ' print unless /^\s+<location.*python-i18n\.cpp.*$/;' i18n/qgis_* .ts
50
- rm python/python-i18n.cpp python/plugins/* /python-i18n.cpp i18n/qgis_* .ts.bak src/plugins/grass/grasslabels-i18n.cpp
51
- echo Removing qmake project file
52
- rm qgis_ts.pro
53
- echo Unpacking qt_ts.tar
54
- tar -xvf i18n/qt_ts.tar
55
- rm i18n/qt_ts.tar
56
- if [ -f i18n/qgis_ts.tar ]; then
57
- echo Unpacking i18n/qgis_ts.tar
58
- tar -xvf i18n/qgis_ts.tar
59
- rm i18n/qgis_ts.tar
60
- fi
0 commit comments