Skip to content

Commit

Permalink
fix create_new_ts.sh
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@14081 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Aug 14, 2010
1 parent b425ab2 commit 3ccbb98
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 28 deletions.
24 changes: 1 addition & 23 deletions scripts/create_new_ts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,4 @@ if [ -z "$1" ] ; then
exit 0
fi

# Create a new .ts file for a new translation 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
# update_ts_files.sh,v 1.3 2004/07/14 18:16:24 gsherman Exp

#first tar the qt_xx.ts files in i18n folder such that lupdate does not
#merge the qgis strings to them
QTDIR=/usr/
echo Creating qt_ts.tar
tar -cvf i18n/qt_ts.tar i18n/qt_*.ts
rm i18n/qt_*.ts
echo Creating qmake project file
$QTDIR/bin/qmake -project -o qgis_ts.pro
#add our new translation to the pro file
echo "Creating new translation entry for $1 in the pro file"
echo "TRANSLATIONS += i18n/qgis_${1}.ts" >> qgis_ts.pro
echo Updating translation files
$QTDIR/bin/lupdate -verbose qgis_ts.pro
echo Removing qmake project file
rm qgis_ts.pro
echo Unpacking qt_ts.tar
tar -xvf i18n/qt_ts.tar
$(dirname $0)/update_ts_files.sh -a $1
40 changes: 35 additions & 5 deletions scripts/update_ts_files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,27 @@ echo Saving Qt translations
tar --remove-files -cf i18n/qt_ts.tar i18n/qt_*.ts
exclude=
opts=
for i in "$@"; do
if [ -f "i18n/qgis_$i.ts" ]; then
exclude="$exclude --exclude i18n/qgis_$i.ts"
while (( $# > 0 )); do
arg=$1
shift

if [ "$arg" = "-a" ]; then
arg=$1
shift
if [ -f "i18n/qgis_$arg.ts" ]; then
echo "cannot add existing tranlation $arg"
exit 1
else
add="$add $arg"
fi
elif [ -f "i18n/qgis_$arg.ts" ]; then
exclude="$exclude --exclude i18n/qgis_$arg.ts"
else
opts=" $i"
opts="$opts $arg"
fi
done
if [ -n "$exclude" ]; then

if [ -n "$exclude" -o -n "$add" ]; then
echo Saving excluded translations
tar --remove-files -cf i18n/qgis_ts.tar i18n/qgis_*.ts$exclude
fi
Expand Down Expand Up @@ -86,5 +99,22 @@ do
[ -f "$i" ] && mv "$i" "$i.save"
done
qmake -project -o qgis_ts.pro -nopwd src python i18n
if [ -n "$add" ]; then
for i in $add; do
echo "Adding translation for $i"
echo "TRANSLATIONS += i18n/qgis_$i.ts" >> qgis_ts.pro
done
fi
echo Updating translations
lupdate$opts -verbose qgis_ts.pro

if [ -n "$add" ]; then
for i in $add; do
if [ -f i18n/qgis_$i.ts ]; then
svn add i18n/qgis_$i.ts
else
echo "Translaiton for $i was not added"
exit 1
fi
done
fi

0 comments on commit 3ccbb98

Please sign in to comment.