Skip to content

Commit

Permalink
fix translation string again and improve translation scripts (followup
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Aug 5, 2017
1 parent 4497c03 commit 6ed389c
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 26 deletions.
5 changes: 2 additions & 3 deletions python/console/console_compile_apis.py
Expand Up @@ -61,7 +61,7 @@ def _preparationFinished(self):
os.remove(self._pap_file)
self.ui.label.setText(QCoreApplication.translate("PythonConsole", "Saving prepared file..."))
prepd = self._api.savePrepared(self._pap_file)
rslt = self.trUtf8("Error")
rslt = self.tr("Error")
if prepd:
rslt = QCoreApplication.translate("PythonConsole", "Saved")
self.ui.label.setText(u'{0} {1}'.format(self.ui.label.text(), rslt))
Expand All @@ -88,6 +88,5 @@ def prepareAPI(self):
self.ui.progressBar.setVisible(False)
self.ui.plainTextEdit.setVisible(True)
self.ui.plainTextEdit.insertPlainText(err)
self.ui.buttonBox.button(QDialogButtonBox.Cancel).setText(
self.trUtf8("Done"))
self.ui.buttonBox.button(QDialogButtonBox.Cancel).setText(self.tr("Done"))
self.adjustSize()
3 changes: 2 additions & 1 deletion python/plugins/processing/algs/gdal/GdalAlgorithmDialog.py
Expand Up @@ -25,6 +25,7 @@

__revision__ = '$Format:%H$'

from qgis.PyQt.QtCore import QCoreApplication
from qgis.PyQt.QtWidgets import (QWidget,
QVBoxLayout,
QPushButton,
Expand Down Expand Up @@ -58,7 +59,7 @@ def __init__(self, alg):

self.setMainWidget(GdalParametersPanel(self, alg))

self.runAsBatchButton = QPushButton(self.tr("Run as Batch Process…"))
self.runAsBatchButton = QPushButton(QCoreApplication.translate("AlgorithmDialog", "Run as Batch Process…"))
self.runAsBatchButton.clicked.connect(self.runAsBatch)
self.buttonBox.addButton(self.runAsBatchButton, QDialogButtonBox.ResetRole) # reset role to ensure left alignment

Expand Down
18 changes: 6 additions & 12 deletions python/plugins/processing/gui/AlgorithmDialog.py
Expand Up @@ -29,17 +29,14 @@
from pprint import pformat
import time

from qgis.PyQt.QtCore import Qt
from qgis.PyQt.QtWidgets import QMessageBox, QApplication, QPushButton, QWidget, QVBoxLayout, QSizePolicy, QDialogButtonBox
from qgis.PyQt.QtGui import QCursor, QColor, QPalette
from qgis.PyQt.QtCore import QCoreApplication
from qgis.PyQt.QtWidgets import QMessageBox, QPushButton, QSizePolicy, QDialogButtonBox
from qgis.PyQt.QtGui import QColor, QPalette

from qgis.core import (QgsProject,
QgsApplication,
QgsProcessingUtils,
QgsMessageLog,
QgsProcessingParameterDefinition,
QgsProcessingOutputRasterLayer,
QgsProcessingOutputVectorLayer,
QgsProcessingAlgRunnerTask,
QgsProcessingOutputHtml,
QgsProcessingParameterVectorDestination,
Expand All @@ -56,16 +53,13 @@
from processing.gui.ParametersPanel import ParametersPanel
from processing.gui.BatchAlgorithmDialog import BatchAlgorithmDialog
from processing.gui.AlgorithmDialogBase import AlgorithmDialogBase
from processing.gui.AlgorithmExecutor import execute, executeIterating
from processing.gui.AlgorithmExecutor import executeIterating
from processing.gui.Postprocessing import handleAlgorithmResults

from processing.core.parameters import ParameterRaster
from processing.core.parameters import ParameterVector
from processing.core.parameters import ParameterExtent
from processing.core.parameters import ParameterMultipleInput
from processing.core.GeoAlgorithm import executeAlgorithm

from processing.core.outputs import OutputTable

from processing.tools import dataobjects

Expand All @@ -83,7 +77,7 @@ def __init__(self, alg):
self.bar.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
self.layout().insertWidget(0, self.bar)

self.runAsBatchButton = QPushButton(self.tr("Run as Batch Process…"))
self.runAsBatchButton = QPushButton(QCoreTranslation.translate("AlgorithmDialog", "Run as Batch Process…"))
self.runAsBatchButton.clicked.connect(self.runAsBatch)
self.buttonBox.addButton(self.runAsBatchButton, QDialogButtonBox.ResetRole) # reset role to ensure left alignment

Expand Down Expand Up @@ -179,7 +173,7 @@ def accept(self):
if reply == QMessageBox.No:
return
checkExtentCRS = ProcessingConfig.getSetting(ProcessingConfig.WARN_UNMATCHING_EXTENT_CRS)
#TODO
# TODO
if False and checkExtentCRS and self.checkExtentCRS():
reply = QMessageBox.question(self, self.tr("Extent CRS"),
self.tr('Extent parameters must use the same CRS as the input layers.\n'
Expand Down
1 change: 1 addition & 0 deletions scripts/processing2cpp.pl
Expand Up @@ -20,6 +20,7 @@
die "usage: $0 dest.cpp\n" unless @ARGV==1;

open F, ">$ARGV[0]";
binmode(F, ":utf8");

print F <<EOF;
/*
Expand Down
40 changes: 30 additions & 10 deletions scripts/update_ts.sh
Expand Up @@ -16,12 +16,14 @@

set -e

case "$1" in
action=$1

case "$action" in
pull|push|update)
;;

*)
echo "usage: $(basename $0) {pull|{push|update} builddirectory}"
echo "usage: $(basename $0) {pull|{push|update} builddirectory [lang...]}"
exit 1
esac

Expand Down Expand Up @@ -72,41 +74,59 @@ if ! type tx >/dev/null 2>&1; then
exit 1
fi

files=
if [ -d "$2" ]; then
builddir=$(realpath $2)
textcpp=
for i in $builddir/src/core/qgsexpression_texts.cpp $builddir/src/core/qgscontexthelp_texts.cpp; do
if [ -f $i ]; then
textcpp="$textcpp $i"
elif [ "$1" != "pull" ]; then
elif [ "$action" != "pull" ]; then
echo Generated help file $i not found
exit 1
fi
done
elif [ "$1" != "pull" ]; then
shift
shift
for t in i18n/qgis_*.ts; do
for l in "$@"; do
if [ "i18n/qgis_$l.ts" = "$t" ]; then
continue 2
fi
done
files="$files $t"
done

elif [ "$action" != "pull" ]; then
echo Build directory not found
exit 1
fi

trap cleanup EXIT

echo Saving translations
files="$(find python -name "*.ts") src/plugins/plugin_template/plugingui.cpp src/plugins/plugin_template/plugin.cpp"
[ $1 = push ] && files="$files i18n/qgis_*.ts"
files="$files $(find python -name "*.ts") src/plugins/plugin_template/plugingui.cpp src/plugins/plugin_template/plugin.cpp"
[ $action = push ] && files="$files i18n/qgis_*.ts"
tar --remove-files -cf i18n/backup.tar $files

if [ $1 = push ]; then
if [ $action = push ]; then
echo Pulling source from transifex...
tx pull -s -l none
if ! [ -f "i18n/qgis_en.ts" ]; then
echo Download of source translation failed
exit
fi
elif [ $1 = pull ]; then
elif [ $action = pull ]; then
rm i18n/qgis_*.ts

echo Pulling new translations...
tx pull -a -s --minimum-perc=35
shift
if [ "$#" -gt 0 ]; then
o="-l $@"
else
o="-a"
fi
tx pull $o -s --minimum-perc=35
fi

echo Updating python translations
Expand Down Expand Up @@ -147,7 +167,7 @@ $LUPDATE -locations absolute -verbose qgis_ts.pro

perl -i.bak -ne 'print unless /^\s+<location.*qgs(expression|contexthelp)_texts\.cpp.*$/;' i18n/qgis_*.ts

if [ $1 = push ]; then
if [ $action = push ]; then
echo Pushing translation...
tx push -s
else
Expand Down

2 comments on commit 6ed389c

@3nids
Copy link
Member

@3nids 3nids commented on 6ed389c Aug 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems this is still failing dialog algorithm test
see https://travis-ci.org/qgis/QGIS/jobs/261396037#L797
ping @jef-n @nyalldawson

@3nids
Copy link
Member

@3nids 3nids commented on 6ed389c Aug 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry did not see it was fixed. trying to see why Travis is failing.

Please sign in to comment.