Skip to content
Permalink
Browse files

more translatable strings in OSM plugin

  • Loading branch information
alexbruy authored and timlinux committed Sep 25, 2011
1 parent 59225ad commit d6171aa4d35de953356ad6c33f444cd941cc3411
@@ -61,8 +61,8 @@ def __init__(self, plugin, newRelationFirstMember=None, relationToEdit=None):
# we are editing existing relation
self.editing = True
self.relId = relationToEdit
self.createRelButton.setText("Save")
self.setWindowTitle("Edit OSM relation")
self.createRelButton.setText( self.tr("Save") )
self.setWindowTitle( self.tr("Edit OSM relation") )
else:
self.editing = False
# we are adding new relation
@@ -790,18 +790,14 @@ def __showTypeInfo(self):
info = ""

if typeName=="boundary":
info = "for grouping boundaries and marking enclaves / exclaves"
info = QCoreApplication.translate( "OsmAddRelationDlg", "for grouping boundaries and marking enclaves / exclaves" )
elif typeName=="multipolygon":
info = "to put holes into areas (might have to be renamed, see article)"
info = QCoreApplication.translate( "OsmAddRelationDlg", "to put holes into areas (might have to be renamed, see article)" )
elif typeName=="restriction":
info = "any kind of turn restriction"
info = QCoreApplication.translate( "OsmAddRelationDlg", "any kind of turn restriction" )
elif typeName=="route":
info = "like bus routes, cycle routes and numbered highways"
info = QCoreApplication.translate( "OsmAddRelationDlg", "like bus routes, cycle routes and numbered highways" )
elif typeName=="enforcement":
info = "traffic enforcement devices; speed cameras, redlight cameras, weight checks, ..."

QMessageBox.information(self, self.tr("OSM Information")
,self.tr(info))


info = QCoreApplication.translate( "OsmAddRelationDlg", "traffic enforcement devices; speed cameras, redlight cameras, weight checks, ..." )

QMessageBox.information(self, self.tr("OSM Information"), info)
@@ -262,7 +262,7 @@ def httpDone(self,error):
# and tell user (if the download wasn't cancelled by user)
if self.errMessage != "__cancel__":
if self.errMessage==None:
self.errMessage="Check your internet connection"
self.errMessage=QCoreApplication.translate( "OsmDownloadDlg", "Check your internet connection" )
QMessageBox.information(self, self.tr("OSM Download Error")
,self.tr("Download failed: %1.").arg(self.errMessage))
return
@@ -302,7 +302,7 @@ def showChooseDirectoryDialog(self):
"""

# display file open dialog and get absolute path to selected directory
fileSelected = QFileDialog.getSaveFileName(self, "Choose file to save","download.osm", "OSM Files (*.osm)");
fileSelected = QFileDialog.getSaveFileName(self, self.tr("Choose file to save"),"download.osm", self.tr("OSM Files (*.osm)") );
# insert selected directory path into line edit control
if not fileSelected.isNull():
self.destdirLineEdit.setText(fileSelected)
@@ -339,7 +339,7 @@ def autoLoadClicked(self):

def showExtentHelp(self):
"""Function is called after clicking on Help button.
It shows basic information on downloading.
It shows basic information on downloading.
"""

mb=QMessageBox()
@@ -464,6 +464,3 @@ def disconnectDlgSignals(self):
self.disconnect(self.downloadButton, SIGNAL("clicked()"), self.downloadFile)
self.disconnect(self.choosedirButton, SIGNAL("clicked()"), self.showChooseDirectoryDialog)
self.disconnect(self.autoLoadCheckBox, SIGNAL("clicked()"), self.autoLoadClicked)



@@ -622,7 +622,7 @@ def __startMovingFeature(self):

# clear dockwidget
self.clear()
self.plugin.iface.mainWindow().statusBar().showMessage("Snapping ON. Hold Ctrl to disable it.")
self.plugin.iface.mainWindow().statusBar().showMessage(self.tr("Snapping ON. Hold Ctrl to disable it."))

self.mapTool=OsmMoveMT(self.plugin)
self.plugin.canvas.setMapTool(self.mapTool)
@@ -639,7 +639,7 @@ def __startPointCreation(self):
if self.activeEditButton==self.createPointButton:
return

self.plugin.iface.mainWindow().statusBar().showMessage("Snapping ON. Hold Ctrl to disable it.")
self.plugin.iface.mainWindow().statusBar().showMessage(self.tr("Snapping ON. Hold Ctrl to disable it."))

self.mapTool=OsmCreatePointMT(self.plugin)
self.plugin.canvas.setMapTool(self.mapTool)
@@ -656,7 +656,7 @@ def __startLineCreation(self):
if self.activeEditButton==self.createLineButton:
return

self.plugin.iface.mainWindow().statusBar().showMessage("Snapping ON. Hold Ctrl to disable it.")
self.plugin.iface.mainWindow().statusBar().showMessage(self.tr("Snapping ON. Hold Ctrl to disable it."))

self.mapTool=OsmCreateLineMT(self.plugin)
self.plugin.canvas.setMapTool(self.mapTool)
@@ -673,7 +673,7 @@ def __startPolygonCreation(self):
if self.activeEditButton==self.createPolygonButton:
return

self.plugin.iface.mainWindow().statusBar().showMessage("Snapping ON. Hold Ctrl to disable it.")
self.plugin.iface.mainWindow().statusBar().showMessage(self.tr("Snapping ON. Hold Ctrl to disable it."))

self.mapTool=OsmCreatePolygonMT(self.plugin)
self.plugin.canvas.setMapTool(self.mapTool)
@@ -770,7 +770,7 @@ def removeSelectedTags(self):
elif self.featureType=='Relation':
self.plugin.dbm.changeRelationStatus(self.feature.id(),'N','U')

# perform tag removing
# perform tag removing
self.plugin.dbm.removeTag(self.feature.id(),self.featureType,key.toAscii().data())

self.tagTable.removeRow(ix)
@@ -1254,9 +1254,7 @@ def __urDetailsChecked(self):

if self.urDetailsButton.isChecked():
self.plugin.undoredo.show()
self.urDetailsButton.setToolTip("Hide OSM Edit History")
self.urDetailsButton.setToolTip(self.tr("Hide OSM Edit History"))
else:
self.plugin.undoredo.hide()
self.urDetailsButton.setToolTip("Show OSM Edit History")


self.urDetailsButton.setToolTip(self.tr("Show OSM Edit History"))
@@ -101,10 +101,10 @@ def onOK(self):

layer = QgsMapLayerRegistry.instance().mapLayer(layerId)
if layer is None:
QMessageBox.warning(self, "Layer doesn't exist", "The selected layer doesn't exist anymore!")
QMessageBox.warning(self, self.tr("Layer doesn't exist"), self.tr("The selected layer doesn't exist anymore!"))
return

self.progress = QProgressDialog("Importing features...", "Cancel", 0, 100, self)
self.progress = QProgressDialog(self.tr("Importing features..."), self.tr("Cancel"), 0, 100, self)
self.progress.setWindowModality(Qt.WindowModal)

self.nodes = { }
@@ -135,7 +135,7 @@ def onOK(self):
self.dbm.recacheAffectedNow(self.affected)
self.plugin.canvas.refresh()

QMessageBox.information(self, "Import", "Import has been completed.")
QMessageBox.information(self, self.tr("Import"), self.tr("Import has been completed."))
self.accept()


@@ -249,4 +249,3 @@ def extractPolygon(self, polygon):
dp = dummyPoint(p[0])
self.nodes[dp] = dummyFeat(nodeId)
nodeId -= 1

@@ -85,7 +85,7 @@ def showOpenFileDialog(self):
lastDir=settings.value("/OSM_Plugin/lastDir", QVariant(QString())).toString()

# display file open dialog and get absolute path to selected file
fileSelected=QFileDialog.getOpenFileName(self,"Choose an Open Street Map file",lastDir,"OSM Files (*.osm)");
fileSelected=QFileDialog.getOpenFileName(self,self.tr("Choose an Open Street Map file"),lastDir,self.tr("OSM Files (*.osm)"));
# insert OSM file path into line edit control
if not fileSelected.isNull():
self.OSMFileEdit.setText(fileSelected)
@@ -108,7 +108,7 @@ def onOK(self):
self.fname = self.OSMFileEdit.text()

if self.fname=='':
QMessageBox.information(self, "OSM Load", QString("Please enter path to OSM data file."))
QMessageBox.information(self, self.tr("OSM Load"),self.tr("Please enter path to OSM data file."))
self.buttonBox.setEnabled(True)
return

@@ -117,7 +117,7 @@ def onOK(self):
basename = osmfile.baseName()

if not osmfile.exists():
QMessageBox.information(self, "OSM Load", QString("Path to OSM file is invalid: %1.").arg(self.fname))
QMessageBox.information(self, self.tr("OSM Load"), self.tr("Path to OSM file is invalid: %1.").arg(self.fname))
return

fLoaded=self.filesLoaded()
@@ -126,11 +126,11 @@ def onOK(self):
curDB=self.dbm.currentKey

if basename in fLoaded and newDB<>curDB:
QMessageBox.information(self, "Error", QString("Layers of OSM file \"%1\" are loaded already.").arg(self.fname))
QMessageBox.information(self, self.tr("Error"), self.tr("Layers of OSM file \"%1\" are loaded already.").arg(self.fname))
return

if replacing:
# remove layers of current data first
if replacing:
# remove layers of current data first
QgsMapLayerRegistry.instance().removeMapLayer(self.canvas.currentLayer().id(),True)

if self.chkCustomRenderer.isChecked():
@@ -162,7 +162,7 @@ def onOK(self):
polygonLayer=None
return
if not polygonLayer.isValid():
QMessageBox.information(self,"Error",QString("Failed to load polygon layer."))
QMessageBox.information(self,self.tr("Error"),self.tr("Failed to load polygon layer."))
return

if self.chkCustomRenderer.isChecked():
@@ -176,7 +176,7 @@ def onOK(self):
lineLayer=None
return
if not lineLayer.isValid():
QMessageBox.information(self,"Error",QString("Failed to load line layer."))
QMessageBox.information(self,self.tr("Error"),self.tr("Failed to load line layer."))
return

if self.chkCustomRenderer.isChecked():
@@ -190,7 +190,7 @@ def onOK(self):
pointLayer=None
return
if not pointLayer.isValid():
QMessageBox.information(self,"Error",QString("Failed to load point layer."))
QMessageBox.information(self,self.tr("Error"),self.tr("Failed to load point layer."))
return

if self.chkCustomRenderer.isChecked():
@@ -231,7 +231,7 @@ def setCustomRenderer(self, layer):
self.emit( SIGNAL( "setRenderer(QgsVectorLayer *)" ), layer )
QObject.disconnect( self, SIGNAL( "setRenderer(QgsVectorLayer *)" ), layer.dataProvider(), SLOT( "setRenderer( QgsVectorLayer * )" ) )
else:
QMessageBox.information(self, "OSM Load", QString("Could not connect to setRenderer signal."))
QMessageBox.information(self, self.tr("OSM Load"), self.tr("Could not connect to setRenderer signal."))

def filesLoaded(self):
"""Function returns list of keys of all currently loaded vector layers.
@@ -303,11 +303,9 @@ def event(self, e):
QObject.disconnect(self.progress,SIGNAL("canceled()"),self.cancelLoading)
self.progress.close()
self.progress = None
QMessageBox.information(self,"Error",QString("Failed to load layers: %1")
QMessageBox.information(self,self.tr("Error"),self.tr("Failed to load layers: %1")
.arg(self.property("osm_failure").toString()))
self.buttonBox.setEnabled(True)

qApp.processEvents()
return QDialog.event(self,e)


@@ -73,28 +73,28 @@ def initGui(self):

# create action for loading OSM file
self.actionLoad=QAction(QIcon(":/plugins/osm_plugin/images/osm_load.png")
,"Load OSM from file", self.iface.mainWindow())
self.actionLoad.setWhatsThis("Load OpenStreetMap from file")
,QCoreApplication.translate( "OsmPlugin", "Load OSM from file"), self.iface.mainWindow())
self.actionLoad.setWhatsThis( QCoreApplication.translate( "OsmPlugin", "Load OpenStreetMap from file") )
# create action for import of a layer into OSM
self.actionImport=QAction(QIcon(":/plugins/osm_plugin/images/osm_import.png")
,"Import data from a layer", self.iface.mainWindow())
self.actionImport.setWhatsThis("Import data from a layer to OpenStreetMap")
,QCoreApplication.translate( "OsmPlugin", "Import data from a layer"), self.iface.mainWindow())
self.actionImport.setWhatsThis(QCoreApplication.translate( "OsmPlugin", "Import data from a layer to OpenStreetMap") )
# create action for saving OSM file
self.actionSave=QAction(QIcon(":/plugins/osm_plugin/images/osm_save.png")
,"Save OSM to file", self.iface.mainWindow())
self.actionSave.setWhatsThis("Save OpenStreetMap to file")
,QCoreApplication.translate( "OsmPlugin", "Save OSM to file"), self.iface.mainWindow())
self.actionSave.setWhatsThis(QCoreApplication.translate( "OsmPlugin", "Save OpenStreetMap to file") )
# create action for OSM data downloading
self.actionDownload=QAction(QIcon(":/plugins/osm_plugin/images/osm_download.png")
,"Download OSM data", self.iface.mainWindow())
self.actionDownload.setWhatsThis("Download OpenStreetMap data")
,QCoreApplication.translate( "OsmPlugin", "Download OSM data"), self.iface.mainWindow())
self.actionDownload.setWhatsThis(QCoreApplication.translate( "OsmPlugin", "Download OpenStreetMap data") )
# create action for OSM data downloading
self.actionUpload=QAction(QIcon(":/plugins/osm_plugin/images/osm_upload.png")
,"Upload OSM data", self.iface.mainWindow())
self.actionUpload.setWhatsThis("Upload OpenStreetMap data")
,QCoreApplication.translate( "OsmPlugin", "Upload OSM data"), self.iface.mainWindow())
self.actionUpload.setWhatsThis(QCoreApplication.translate( "OsmPlugin", "Upload OpenStreetMap data") )
# create action for OSM dockable window
self.actionDockWidget=QAction(QIcon(":/plugins/osm_plugin/images/osm_featureManager.png")
,"Show/Hide OSM Feature Manager",self.iface.mainWindow())
self.actionDockWidget.setWhatsThis("Show/Hide OpenStreetMap Feature Manager")
,QCoreApplication.translate( "OsmPlugin", "Show/Hide OSM Feature Manager"),self.iface.mainWindow())
self.actionDockWidget.setWhatsThis(QCoreApplication.translate( "OsmPlugin", "Show/Hide OpenStreetMap Feature Manager") )
self.actionDockWidget.setCheckable(True)

# connect new action to plugin function - when action is triggered
@@ -193,7 +193,8 @@ def loadOsmFromFile(self):

# sanity check whether we're able to load osm data
if 'osm' not in QgsProviderRegistry.instance().providerList():
QMessageBox.critical(None, "Sorry", "You don't have OSM provider installed!")
QMessageBox.critical(None, QCoreApplication.translate( "OsmPlugin", "Sorry" ),
QCoreApplication.translate( "OsmPlugin", "You don't have OSM provider installed!") )
return

# show modal dialog with OSM file selection
@@ -222,13 +223,14 @@ def saveOsmToFile(self):
"""

if 'osm' not in QgsProviderRegistry.instance().providerList():
QMessageBox.critical(None, "Sorry", "You don't have OSM provider installed!")
QMessageBox.critical(None, QCoreApplication.translate( "OsmPlugin", "Sorry" ),
QCoreApplication.translate( "OsmPlugin", "You don't have OSM provider installed!") )
return

if not self.dbm.currentKey:
QMessageBox.information(QWidget(), QString("OSM Save to file")
,"No OSM data are loaded/downloaded or no OSM layer is selected in Layers panel. \
Please change this situation first, because OSM Plugin doesn't know what to save.")
QMessageBox.information(QWidget(), QCoreApplication.translate( "OsmPlugin", "OSM Save to file"),
QCoreApplication.translate( "OsmPlugin", "No OSM data are loaded/downloaded or no OSM layer is selected in Layers panel. \
Please change this situation first, because OSM Plugin doesn't know what to save.") )
return

# show modal dialog with OSM file selection
@@ -247,7 +249,8 @@ def downloadOsmData(self):
"""

if 'osm' not in QgsProviderRegistry.instance().providerList():
QMessageBox.critical(None, "Sorry", "You don't have OSM provider installed!")
QMessageBox.critical(None, QCoreApplication.translate( "OsmPlugin", "Sorry" ),
QCoreApplication.translate( "OsmPlugin", "You don't have OSM provider installed!") )
return

self.dlgDownload=OsmDownloadDlg(self)
@@ -299,9 +302,9 @@ def uploadOsmData(self):

# first check if there are some data; if not upload doesn't have sense
if not self.dbm.currentKey:
QMessageBox.information(QWidget(), QString("OSM Upload")
,"No OSM data are loaded/downloaded or no OSM layer is selected in Layers panel. \
Please change this situation first, because OSM Plugin doesn't know what to upload.")
QMessageBox.information(QWidget(), QCoreApplication.translate( "OsmPlugin", "OSM Upload"),
QCoreApplication.translate( "OsmPlugin", "No OSM data are loaded/downloaded or no OSM layer is selected in Layers panel. \
Please change this situation first, because OSM Plugin doesn't know what to upload.") )
return

self.dlgUpload=OsmUploadDlg(self)
@@ -316,18 +319,20 @@ def importData(self):
"""

if 'osm' not in QgsProviderRegistry.instance().providerList():
QMessageBox.critical(None, "Sorry", "You don't have OSM provider installed!")
QMessageBox.critical(None, QCoreApplication.translate( "OsmPlugin", "Sorry"),
QCoreApplication.translate( "OsmPlugin", "You don't have OSM provider installed!") )
return

if self.dbm.currentKey is None:
QMessageBox.information(self.iface.mainWindow(), "OSM Import"
,"No OSM data are loaded/downloaded or no OSM layer is selected in Layers panel. \
Please change this situation first, because OSM Plugin doesn't know what layer will be destination of the import.")
QMessageBox.information(self.iface.mainWindow(), QCoreApplication.translate( "OsmPlugin", "OSM Import"),
QCoreApplication.translate( "OsmPlugin", "No OSM data are loaded/downloaded or no OSM layer is selected in Layers panel. \
Please change this situation first, because OSM Plugin doesn't know what layer will be destination of the import.") )
return

dlg=OsmImportDlg(self)
if dlg.cboLayer.count()==0:
QMessageBox.information(self.iface.mainWindow(), "OSM Import", "There are currently no available vector layers.")
QMessageBox.information(self.iface.mainWindow(), QCoreApplication.translate( "OsmPlugin", "OSM Import"),
QCoreApplication.translate( "OsmPlugin", "There are currently no available vector layers.") )
return

dlg.exec_()
@@ -367,5 +372,3 @@ def __ofVisibilityChanged(self):
self.actionDockWidget.setChecked(True)
else:
self.actionDockWidget.setChecked(False)


0 comments on commit d6171aa

Please sign in to comment.
You can’t perform that action at this time.