2009-04-23 13:43:45 +00:00
|
|
|
#!/bin/bash
|
2004-02-13 17:50:50 +00:00
|
|
|
# Update the translation files with strings used in QGIS
|
|
|
|
# 1. create a clean Qt .pro file for the project
|
|
|
|
# 2. run lupdate using the .pro file from step 1
|
|
|
|
# 3. remove the .pro
|
2004-07-14 18:16:24 +00:00
|
|
|
# Note the .pro file must NOT be named qgis.pro as this
|
|
|
|
# name is reserved for the Windows qmake project file
|
|
|
|
# update_ts_files.sh,v 1.3 2004/07/14 18:16:24 gsherman Exp
|
|
|
|
|
2009-07-01 19:30:20 +00:00
|
|
|
set -e
|
|
|
|
|
2008-11-24 09:34:57 +00:00
|
|
|
PATH=$QTDIR/bin:$PATH
|
|
|
|
|
2007-12-07 07:59:18 +00:00
|
|
|
#first tar the qt_xx.ts files in i18n folder such that lupdate does not
|
|
|
|
#merge the qgis strings to them
|
|
|
|
echo Creating qt_ts.tar
|
2009-08-01 19:20:09 +00:00
|
|
|
tar --remove-files -cvf i18n/qt_ts.tar i18n/qt_*.ts
|
|
|
|
exclude=
|
|
|
|
for i in "$@"; do
|
|
|
|
exclude="$exclude --exclude i18n/qgis_$i.ts"
|
|
|
|
done
|
|
|
|
if [ -n "$exclude" ]; then
|
|
|
|
tar --remove-files -cvf i18n/qgis_ts.tar i18n/qgis_*.ts$exclude
|
|
|
|
fi
|
2009-04-23 13:43:45 +00:00
|
|
|
echo Updating python plugin translations
|
|
|
|
for i in python/plugins/*/.; do
|
|
|
|
cd $i
|
2009-07-01 19:30:20 +00:00
|
|
|
pylupdate4 $(find . -name "*.py") -ts python-i18n.ts
|
|
|
|
perl ../../../scripts/ts2cpp.pl python-i18n.ts python-i18n.cpp
|
|
|
|
rm python-i18n.ts
|
2009-04-23 13:43:45 +00:00
|
|
|
cd ../../..
|
|
|
|
done
|
2004-02-13 17:50:50 +00:00
|
|
|
echo Creating qmake project file
|
2009-05-18 09:34:29 +00:00
|
|
|
qmake -project -o qgis_ts.pro -nopwd src python i18n
|
2004-02-13 17:50:50 +00:00
|
|
|
echo Updating translation files
|
2008-11-24 09:34:57 +00:00
|
|
|
lupdate -verbose qgis_ts.pro
|
2009-04-23 13:43:45 +00:00
|
|
|
echo Removing temporary python plugin translation files
|
2009-07-31 16:21:56 +00:00
|
|
|
perl -i.bak -ne 'print unless /^\s+<location.*python-i18n\.cpp.*$/;' i18n/qgis_*.ts
|
2009-07-01 19:30:20 +00:00
|
|
|
rm python/plugins/*/python-i18n.cpp i18n/qgis_*.ts.bak
|
2004-02-13 17:50:50 +00:00
|
|
|
echo Removing qmake project file
|
2004-07-14 18:16:24 +00:00
|
|
|
rm qgis_ts.pro
|
2007-12-07 07:59:18 +00:00
|
|
|
echo Unpacking qt_ts.tar
|
2009-08-01 19:20:09 +00:00
|
|
|
tar -xvf i18n/qt_ts.tar
|
|
|
|
rm i18n/qt_ts.tar
|
|
|
|
if [ -f i18n/qgis_ts.tar ]; then
|
|
|
|
echo Unpacking i18n/qgis_ts.tar
|
2009-08-02 15:16:17 +00:00
|
|
|
tar -xvf i18n/qgis_ts.tar
|
2009-08-01 19:20:09 +00:00
|
|
|
rm i18n/qgis_ts.tar
|
|
|
|
fi
|