Skip to content

Commit 278ffa1

Browse files
committedNov 12, 2014
i18n: move to transifex
* deprecate update_ts_files.sh * use pull_ts.sh to pull updates from transifex * use push_ts.sh to pull qgis_en.ts from transifex, update it and push it back
1 parent f1fb5fb commit 278ffa1

File tree

2 files changed

+205
-0
lines changed

2 files changed

+205
-0
lines changed
 

‎scripts/pull_ts.sh

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
#!/bin/bash
2+
###########################################################################
3+
# pull_ts.sh
4+
# ---------------------
5+
# Date : November 2014
6+
# Copyright : (C) 2014 by Tim Sutton
7+
# Email : jef at norbit dot de
8+
###########################################################################
9+
# #
10+
# This program is free software; you can redistribute it and/or modify #
11+
# it under the terms of the GNU General Public License as published by #
12+
# the Free Software Foundation; either version 2 of the License, or #
13+
# (at your option) any later version. #
14+
# #
15+
###########################################################################
16+
17+
# Pull the translations from transifex and update TRANSLATORS
18+
19+
set -e
20+
21+
cleanup() {
22+
if [ -f i18n/python_ts.tar ]; then
23+
tar -xf i18n/python_ts.tar
24+
fi
25+
if [ -f i18n/qgis_ts.tar ]; then
26+
echo Restoring excluded translations
27+
tar -xf i18n/qgis_ts.tar
28+
fi
29+
30+
echo Removing temporary files
31+
perl -i.bak -ne 'print unless /^\s+<location.*python-i18n\.cpp.*$/;' i18n/qgis_*.ts
32+
for i in \
33+
python/python-i18n.{ts,cpp} \
34+
python/plugins/*/python-i18n.{ts,cpp} \
35+
i18n/qgis_*.ts.bak \
36+
src/plugins/grass/grasslabels-i18n.cpp \
37+
i18n/qgis_ts.tar \
38+
i18n/python_ts.tar \
39+
qgis_ts.pro
40+
do
41+
[ -f "$i" ] && rm "$i"
42+
done
43+
44+
for i in \
45+
src/plugins/plugin_template/plugingui.cpp \
46+
src/plugins/plugin_template/plugin.cpp
47+
do
48+
[ -f "$i.save" ] && mv "$i.save" "$i"
49+
done
50+
51+
trap "" EXIT
52+
}
53+
54+
PATH=$QTDIR/bin:$PATH
55+
56+
if type qmake-qt4 >/dev/null 2>&1; then
57+
QMAKE=qmake-qt4
58+
else
59+
QMAKE=qmake
60+
fi
61+
62+
if ! type pylupdate4 >/dev/null 2>&1; then
63+
echo "pylupdate4 not found"
64+
exit 1
65+
fi
66+
67+
if ! type tx >/dev/null 2>&1; then
68+
echo "tx not found"
69+
exit 1
70+
fi
71+
72+
if type lupdate-qt4 >/dev/null 2>&1; then
73+
LUPDATE=lupdate-qt4
74+
else
75+
LUPDATE=lupdate
76+
fi
77+
78+
trap cleanup EXIT
79+
80+
tar --remove-files -cf i18n/python_ts.tar $(find python -name "*.ts")
81+
82+
echo Saving translations
83+
tar --remove-files -cf i18n/qgis_ts.tar i18n/qgis_*.ts
84+
85+
tx pull -a -s
86+
87+
echo Updating TRANSLATORS File
88+
./scripts/tsstat.pl >doc/TRANSLATORS

‎scripts/push_ts.sh

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
#!/bin/bash
2+
###########################################################################
3+
# push_ts.sh
4+
# ---------------------
5+
# Date : November 2014
6+
# Copyright : (C) 2014 by Juergen E. Fischer
7+
# Email : jef at norbit dot de
8+
###########################################################################
9+
# #
10+
# This program is free software; you can redistribute it and/or modify #
11+
# it under the terms of the GNU General Public License as published by #
12+
# the Free Software Foundation; either version 2 of the License, or #
13+
# (at your option) any later version. #
14+
# #
15+
###########################################################################
16+
17+
# Update the english translation and push it to transifex
18+
19+
set -e
20+
21+
cleanup() {
22+
if [ -f i18n/python_ts.tar ]; then
23+
tar -xf i18n/python_ts.tar
24+
fi
25+
if [ -f i18n/qgis_ts.tar ]; then
26+
echo Restoring excluded translations
27+
tar -xf i18n/qgis_ts.tar
28+
fi
29+
30+
echo Removing temporary files
31+
perl -i.bak -ne 'print unless /^\s+<location.*python-i18n\.cpp.*$/;' i18n/qgis_*.ts
32+
for i in \
33+
python/python-i18n.{ts,cpp} \
34+
python/plugins/*/python-i18n.{ts,cpp} \
35+
i18n/qgis_*.ts.bak \
36+
src/plugins/grass/grasslabels-i18n.cpp \
37+
i18n/qgis_ts.tar \
38+
i18n/python_ts.tar \
39+
qgis_ts.pro
40+
do
41+
[ -f "$i" ] && rm "$i"
42+
done
43+
44+
for i in \
45+
src/plugins/plugin_template/plugingui.cpp \
46+
src/plugins/plugin_template/plugin.cpp
47+
do
48+
[ -f "$i.save" ] && mv "$i.save" "$i"
49+
done
50+
51+
trap "" EXIT
52+
}
53+
54+
PATH=$QTDIR/bin:$PATH
55+
56+
if type qmake-qt4 >/dev/null 2>&1; then
57+
QMAKE=qmake-qt4
58+
else
59+
QMAKE=qmake
60+
fi
61+
62+
if ! type pylupdate4 >/dev/null 2>&1; then
63+
echo "pylupdate4 not found"
64+
exit 1
65+
fi
66+
67+
if ! type tx >/dev/null 2>&1; then
68+
echo "tx not found"
69+
exit 1
70+
fi
71+
72+
if type lupdate-qt4 >/dev/null 2>&1; then
73+
LUPDATE=lupdate-qt4
74+
else
75+
LUPDATE=lupdate
76+
fi
77+
78+
trap cleanup EXIT
79+
80+
tar --remove-files -cf i18n/python_ts.tar $(find python -name "*.ts")
81+
echo Saving translations
82+
tar --remove-files -cf i18n/qgis_ts.tar i18n/qgis_*.ts
83+
84+
echo Pulling source from transifex...
85+
tx pull -s
86+
87+
echo Updating python translations
88+
cd python
89+
pylupdate4 utils.py {console,pyplugin_installer}/*.{py,ui} -ts python-i18n.ts
90+
perl ../scripts/ts2cpp.pl python-i18n.ts python-i18n.cpp
91+
rm python-i18n.ts
92+
cd ..
93+
for i in python/plugins/*/CMakeLists.txt; do
94+
cd ${i%/*}
95+
pylupdate4 $(find . -name "*.py" -o -name "*.ui") -ts python-i18n.ts
96+
perl ../../../scripts/ts2cpp.pl python-i18n.ts python-i18n.cpp
97+
rm python-i18n.ts
98+
cd ../../..
99+
done
100+
echo Updating GRASS module translations
101+
perl scripts/qgm2cpp.pl >src/plugins/grass/grasslabels-i18n.cpp
102+
mv src/plugins/plugin_template/plugingui.cpp src/plugins/plugin_template/plugingui.cpp.save
103+
echo Creating qmake project file
104+
for i in \
105+
src/plugins/plugin_template/plugingui.cpp \
106+
src/plugins/plugin_template/plugin.cpp
107+
do
108+
[ -f "$i" ] && mv "$i" "$i.save"
109+
done
110+
$QMAKE -project -o qgis_ts.pro -nopwd src python i18n
111+
112+
echo Updating translations
113+
$LUPDATE -locations none -verbose qgis_ts.pro
114+
115+
echo tx push -s
116+
117+
cleanup

0 commit comments

Comments
 (0)
Please sign in to comment.