~ubuntu-branches/ubuntu/wily/qgis/wily

« back to all changes in this revision

Viewing changes to scripts/update_ts_files.sh

  • Committer: Bazaar Package Importer
  • Author(s): Johan Van de Wauw
  • Date: 2010-07-11 20:23:24 UTC
  • mfrom: (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100711202324-5ktghxa7hracohmr
Tags: 1.4.0+12730-3ubuntu1
* Merge from Debian unstable (LP: #540941).
* Fix compilation issues with QT 4.7
* Add build-depends on libqt4-webkit-dev 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
# Update the translation files with strings used in QGIS
 
3
# 1. create a clean Qt .pro file for the project
 
4
# 2. run lupdate using the .pro file from step 1
 
5
# 3. remove the .pro
 
6
# Note the .pro file must NOT be named qgis.pro as this
 
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
 
9
 
 
10
set -e
 
11
 
 
12
PATH=$QTDIR/bin:$PATH
 
13
 
 
14
#first tar the qt_xx.ts files in i18n folder such that lupdate does not 
 
15
#merge the qgis strings to them
 
16
echo Creating qt_ts.tar
 
17
tar --remove-files -cvf i18n/qt_ts.tar i18n/qt_*.ts
 
18
exclude=
 
19
opts=
 
20
for i in "$@"; do
 
21
  if [ -f "i18n/qgis_$i.ts" ]; then
 
22
    exclude="$exclude --exclude i18n/qgis_$i.ts"
 
23
  else
 
24
    opts=" $i"
 
25
  fi
 
26
done
 
27
if [ -n "$exclude" ]; then
 
28
  tar --remove-files -cvf i18n/qgis_ts.tar i18n/qgis_*.ts$exclude
 
29
fi
 
30
echo Updating python translations
 
31
cd python
 
32
pylupdate4 utils.py -ts python-i18n.ts
 
33
perl ../scripts/ts2cpp.pl python-i18n.ts python-i18n.cpp
 
34
rm python-i18n.ts
 
35
cd ..
 
36
for i in python/plugins/*/CMakeLists.txt; do
 
37
        cd ${i%/*}
 
38
        pylupdate4 $(find . -name "*.py" -o -name "*.ui") -ts python-i18n.ts
 
39
        perl ../../../scripts/ts2cpp.pl python-i18n.ts python-i18n.cpp
 
40
        rm python-i18n.ts
 
41
        cd ../../..
 
42
done
 
43
echo Creating qmake project file
 
44
qmake -project -o qgis_ts.pro -nopwd src python i18n
 
45
echo Updating translation files
 
46
lupdate$opts -verbose qgis_ts.pro
 
47
echo Removing temporary python translation files
 
48
perl -i.bak -ne 'print unless /^\s+<location.*python-i18n\.cpp.*$/;' i18n/qgis_*.ts
 
49
rm python/python-i18n.cpp python/plugins/*/python-i18n.cpp i18n/qgis_*.ts.bak
 
50
echo Removing qmake project file
 
51
rm qgis_ts.pro
 
52
echo Unpacking qt_ts.tar
 
53
tar -xvf i18n/qt_ts.tar 
 
54
rm i18n/qt_ts.tar
 
55
if [ -f i18n/qgis_ts.tar ]; then
 
56
  echo Unpacking i18n/qgis_ts.tar
 
57
  tar -xvf i18n/qgis_ts.tar 
 
58
  rm i18n/qgis_ts.tar
 
59
fi