[QGIS Commit] r14081 - trunk/qgis/scripts

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sat Aug 14 10:47:48 EDT 2010


Author: jef
Date: 2010-08-14 14:47:48 +0000 (Sat, 14 Aug 2010)
New Revision: 14081

Modified:
   trunk/qgis/scripts/create_new_ts.sh
   trunk/qgis/scripts/update_ts_files.sh
Log:
fix create_new_ts.sh

Modified: trunk/qgis/scripts/create_new_ts.sh
===================================================================
--- trunk/qgis/scripts/create_new_ts.sh	2010-08-14 12:24:19 UTC (rev 14080)
+++ trunk/qgis/scripts/create_new_ts.sh	2010-08-14 14:47:48 UTC (rev 14081)
@@ -9,26 +9,4 @@
   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

Modified: trunk/qgis/scripts/update_ts_files.sh
===================================================================
--- trunk/qgis/scripts/update_ts_files.sh	2010-08-14 12:24:19 UTC (rev 14080)
+++ trunk/qgis/scripts/update_ts_files.sh	2010-08-14 14:47:48 UTC (rev 14081)
@@ -51,14 +51,27 @@
 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
@@ -86,5 +99,22 @@
 	[ -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



More information about the QGIS-commit mailing list