Skip to content

Commit f0c605e

Browse files
committed
dbmanager: add i18n
1 parent d6fa765 commit f0c605e

38 files changed

+255
-259
lines changed

python/plugins/db_manager/CREDITS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CREDITS: 2011/10/13
22

3-
DB Manager plugin for QuantumGIS
3+
DB Manager plugin for QGIS
44

55
Author and maintainer:
66
Giuseppe Sucameli <brush.tyler@gmail.com>

python/plugins/db_manager/README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
DB Manager * Copyright (c) 2011 Giuseppe Sucameli
22

3-
DB Manager is a database manager plugin for QuantumGIS.
3+
DB Manager is a database manager plugin for QGIS.
44
It allows to you to show the DBs contents and run query on them.
55

66
In this moment DB Manager supports the following DBMS backends:

python/plugins/db_manager/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44
/***************************************************************************
55
Name : DB Manager
6-
Description : Database manager plugin for QuantumGIS
6+
Description : Database manager plugin for QGIS
77
Date : May 23, 2011
88
copyright : (C) 2011 by Giuseppe Sucameli
99
email : brush.tyler@gmail.com

python/plugins/db_manager/completer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44
/***************************************************************************
55
Name : DB Manager
6-
Description : Database manager plugin for QuantumGIS
6+
Description : Database manager plugin for QGIS
77
Date : May 23, 2011
88
copyright : (C) 2011 by Giuseppe Sucameli
99
email : brush.tyler@gmail.com

python/plugins/db_manager/db_manager.py

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44
/***************************************************************************
55
Name : DB Manager
6-
Description : Database manager plugin for QuantumGIS
6+
Description : Database manager plugin for QGIS
77
Date : May 23, 2011
88
copyright : (C) 2011 by Giuseppe Sucameli
99
email : brush.tyler@gmail.com
@@ -45,8 +45,8 @@ def __init__(self, iface, parent=None):
4545

4646
# restore the window state
4747
settings = QSettings()
48-
self.restoreGeometry( settings.value("/DB_Manager/mainWindow/geometry") )
49-
self.restoreState( settings.value("/DB_Manager/mainWindow/windowState") )
48+
self.restoreGeometry( settings.value("/DB_Manager/mainWindow/geometry", QByteArray(), type=QByteArray ) )
49+
self.restoreState( settings.value("/DB_Manager/mainWindow/windowState", QByteArray(), type=QByteArray ) )
5050

5151
self.connect(self.tabs, SIGNAL("currentChanged(int)"), self.tabChanged)
5252
self.connect(self.tree, SIGNAL("selectedItemChanged"), self.itemChanged)
@@ -147,7 +147,7 @@ def refreshActionSlot(self):
147147
def importActionSlot(self):
148148
db = self.tree.currentDatabase()
149149
if db is None:
150-
QMessageBox.information(self, "Sorry", "No database selected or you are not connected to it.")
150+
QMessageBox.information(self, self.tr("Sorry"), self.tr("No database selected or you are not connected to it."))
151151
return
152152

153153
outUri = db.uri()
@@ -162,7 +162,7 @@ def importActionSlot(self):
162162
def exportActionSlot(self):
163163
table = self.tree.currentTable()
164164
if table is None:
165-
QMessageBox.information(self, "Sorry", "Select the table you want export to file.")
165+
QMessageBox.information(self, self.tr("Sorry"), self.tr("Select the table you want export to file."))
166166
return
167167

168168
inLayer = table.toMapLayer()
@@ -176,7 +176,7 @@ def exportActionSlot(self):
176176
def runSqlWindow(self):
177177
db = self.tree.currentDatabase()
178178
if db == None:
179-
QMessageBox.information(self, "Sorry", "No database selected or you are not connected to it.")
179+
QMessageBox.information(self, self.tr("Sorry"), self.tr("No database selected or you are not connected to it."))
180180
return
181181

182182
from dlg_sql_window import DlgSqlWindow
@@ -333,18 +333,18 @@ def unregisterAllActions(self):
333333
del self._registeredDbActions
334334

335335
def setupUi(self):
336-
self.setWindowTitle("DB Manager")
336+
self.setWindowTitle(self.tr("DB Manager"))
337337
self.setWindowIcon(QIcon(":/db_manager/icon"))
338338
self.resize(QSize(700,500).expandedTo(self.minimumSizeHint()))
339339

340340
# create central tab widget
341341
self.tabs = QTabWidget()
342342
self.info = InfoViewer(self)
343-
self.tabs.addTab(self.info, "Info")
343+
self.tabs.addTab(self.info, self.tr("Info"))
344344
self.table = TableViewer(self)
345-
self.tabs.addTab(self.table, "Table")
345+
self.tabs.addTab(self.table, self.tr("Table"))
346346
self.preview = LayerPreview(self)
347-
self.tabs.addTab(self.preview, "Preview")
347+
self.tabs.addTab(self.preview, self.tr("Preview"))
348348
self.setCentralWidget(self.tabs)
349349

350350
# create database tree
@@ -361,13 +361,13 @@ def setupUi(self):
361361

362362
# create menus
363363
self.menuBar = QMenuBar(self)
364-
self.menuDb = QMenu("&Database", self)
364+
self.menuDb = QMenu(self.tr("&Database"), self)
365365
actionMenuDb = self.menuBar.addMenu(self.menuDb)
366-
self.menuSchema = QMenu("&Schema", self)
366+
self.menuSchema = QMenu(self.tr("&Schema"), self)
367367
actionMenuSchema = self.menuBar.addMenu(self.menuSchema)
368-
self.menuTable = QMenu("&Table", self)
368+
self.menuTable = QMenu(self.tr("&Table"), self)
369369
actionMenuTable = self.menuBar.addMenu(self.menuTable)
370-
self.menuHelp = None#QMenu("&Help", self)
370+
self.menuHelp = None # QMenu(self.tr("&Help"), self)
371371
#actionMenuHelp = self.menuBar.addMenu(self.menuHelp)
372372

373373
self.setMenuBar(self.menuBar)
@@ -382,21 +382,21 @@ def setupUi(self):
382382

383383
# menu DATABASE
384384
sep = self.menuDb.addSeparator(); sep.setObjectName("DB_Manager_DbMenu_placeholder"); sep.setVisible(False)
385-
self.actionRefresh = self.menuDb.addAction( QIcon(":/db_manager/actions/refresh"), "&Refresh", self.refreshActionSlot, QKeySequence("F5") )
386-
self.actionSqlWindow = self.menuDb.addAction( QIcon(":/db_manager/actions/sql_window"), "&SQL window", self.runSqlWindow, QKeySequence("F2") )
385+
self.actionRefresh = self.menuDb.addAction( QIcon(":/db_manager/actions/refresh"), self.tr("&Refresh"), self.refreshActionSlot, QKeySequence("F5") )
386+
self.actionSqlWindow = self.menuDb.addAction( QIcon(":/db_manager/actions/sql_window"), self.tr("&SQL window"), self.runSqlWindow, QKeySequence("F2") )
387387
self.menuDb.addSeparator()
388-
self.actionClose = self.menuDb.addAction( QIcon(), "&Exit", self.close, QKeySequence("CTRL+Q") )
388+
self.actionClose = self.menuDb.addAction( QIcon(), self.tr("&Exit"), self.close, QKeySequence("CTRL+Q") )
389389

390390
# menu SCHEMA
391391
sep = self.menuSchema.addSeparator(); sep.setObjectName("DB_Manager_SchemaMenu_placeholder"); sep.setVisible(False)
392392
actionMenuSchema.setVisible(False)
393393

394394
# menu TABLE
395395
sep = self.menuTable.addSeparator(); sep.setObjectName("DB_Manager_TableMenu_placeholder"); sep.setVisible(False)
396-
self.actionImport = self.menuTable.addAction( QIcon(":/db_manager/actions/import"), "&Import layer/file", self.importActionSlot )
397-
self.actionExport = self.menuTable.addAction( QIcon(":/db_manager/actions/export"), "&Export to file", self.exportActionSlot )
396+
self.actionImport = self.menuTable.addAction( QIcon(":/db_manager/actions/import"), self.tr("&Import layer/file"), self.importActionSlot )
397+
self.actionExport = self.menuTable.addAction( QIcon(":/db_manager/actions/export"), self.tr("&Export to file"), self.exportActionSlot )
398398
self.menuTable.addSeparator()
399-
#self.actionShowSystemTables = self.menuTable.addAction("Show system tables/views", self.showSystemTables)
399+
#self.actionShowSystemTables = self.menuTable.addAction(self.tr("Show system tables/views"), self.showSystemTables)
400400
#self.actionShowSystemTables.setCheckable(True)
401401
#self.actionShowSystemTables.setChecked(True)
402402
actionMenuTable.setVisible(False)
@@ -406,4 +406,3 @@ def setupUi(self):
406406
self.toolBar.addAction( self.actionSqlWindow )
407407
self.toolBar.addAction( self.actionImport )
408408
self.toolBar.addAction( self.actionExport )
409-

python/plugins/db_manager/db_manager_plugin.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44
/***************************************************************************
55
Name : DB Manager
6-
Description : Database manager plugin for QuantumGIS
6+
Description : Database manager plugin for QGIS
77
Date : May 23, 2011
88
copyright : (C) 2011 by Giuseppe Sucameli
99
email : brush.tyler@gmail.com
@@ -34,24 +34,24 @@ def __init__(self, iface):
3434
self.dlg = None
3535

3636
def initGui(self):
37-
self.action = QAction( QIcon(":/db_manager/icon"), u"DB Manager", self.iface.mainWindow() )
37+
self.action = QAction( QIcon(":/db_manager/icon"), QApplication.translate("DBManagerPlugin","DB Manager"), self.iface.mainWindow() )
3838
QObject.connect( self.action, SIGNAL( "triggered()" ), self.run )
3939
# Add toolbar button and menu item
4040
if hasattr( self.iface, 'addDatabaseToolBarIcon' ):
4141
self.iface.addDatabaseToolBarIcon(self.action)
4242
else:
4343
self.iface.addToolBarIcon(self.action)
4444
if hasattr( self.iface, 'addPluginToDatabaseMenu' ):
45-
self.iface.addPluginToDatabaseMenu( u"DB Manager", self.action )
45+
self.iface.addPluginToDatabaseMenu( QApplication.translate("DBManagerPlugin","DB Manager"), self.action )
4646
else:
47-
self.iface.addPluginToMenu( u"DB Manager", self.action )
47+
self.iface.addPluginToMenu( QApplication.translate("DBManagerPlugin","DB Manager"), self.action )
4848

4949
def unload(self):
5050
# Remove the plugin menu item and icon
5151
if hasattr( self.iface, 'removePluginDatabaseMenu' ):
52-
self.iface.removePluginDatabaseMenu( u"DB Manager", self.action )
52+
self.iface.removePluginDatabaseMenu( QApplication.translate("DBManagerPlugin","DB Manager"), self.action )
5353
else:
54-
self.iface.removePluginMenu( u"DB Manager", self.action )
54+
self.iface.removePluginMenu( QApplication.translate("DBManagerPlugin","DB Manager"), self.action )
5555
if hasattr( self.iface, 'removeDatabaseToolBarIcon' ):
5656
self.iface.removeDatabaseToolBarIcon(self.action)
5757
else:
@@ -72,4 +72,3 @@ def run(self):
7272

7373
def onDestroyed(self, obj):
7474
self.dlg = None
75-

python/plugins/db_manager/db_model.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44
/***************************************************************************
55
Name : DB Manager
6-
Description : Database manager plugin for QuantumGIS
6+
Description : Database manager plugin for QGIS
77
Date : May 23, 2011
88
copyright : (C) 2011 by Giuseppe Sucameli
99
email : brush.tyler@gmail.com
@@ -152,7 +152,7 @@ def populate(self):
152152
return False
153153

154154
except BaseError, e:
155-
QMessageBox.warning( None, u"Unable to connect", unicode(e) )
155+
QMessageBox.warning( None, self.tr("Unable to connect"), unicode(e) )
156156
return False
157157

158158
database = connection.database()
@@ -267,7 +267,7 @@ class DBModel(QAbstractItemModel):
267267
def __init__(self, parent=None):
268268
QAbstractItemModel.__init__(self, parent)
269269
self.treeView = parent
270-
self.header = ['Databases']
270+
self.header = [self.tr('Databases')]
271271

272272
self.isImportVectorAvail = hasattr(qgis.core, 'QgsVectorLayerImport')
273273
if self.isImportVectorAvail:
@@ -530,7 +530,7 @@ def dropMimeData(self, data, action, row, column, parent):
530530
parts = mimeUri.split(":", 3)
531531
if len(parts) != 4:
532532
# invalid qgis mime uri
533-
QMessageBox.warning(None, "Invalid MIME uri", "The dropped object is not a valid QGis layer")
533+
QMessageBox.warning(None, self.tr("Invalid MIME uri"), self.tr("The dropped object is not a valid QGis layer"))
534534
continue
535535

536536
layerType, providerKey, layerName, uriString = parts
@@ -553,7 +553,7 @@ def importLayer(self, layerType, providerKey, layerName, uriString, parent):
553553

554554
if not inLayer.isValid():
555555
# invalid layer
556-
QMessageBox.warning(None, "Invalid layer", u"QGis was unable to load the layer %s" % inLayer.name())
556+
QMessageBox.warning(None, self.tr("Invalid layer"), self.tr("QGis was unable to load the layer %s") % inLayer.name)
557557
return False
558558

559559
# retrieve information about the new table's db and schema

python/plugins/db_manager/db_plugins/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44
/***************************************************************************
55
Name : DB Manager
6-
Description : Database manager plugin for QuantumGIS
6+
Description : Database manager plugin for QGIS
77
Date : May 23, 2011
88
copyright : (C) 2011 by Giuseppe Sucameli
99
email : brush.tyler@gmail.com
@@ -25,7 +25,7 @@
2525

2626
class NotSupportedDbType(Exception):
2727
def __init__(self, dbtype):
28-
self.msg = u"%s is not supported yet" % dbtype
28+
self.msg = self.tr("%s is not supported yet") % dbtype
2929
Exception(self, self.msg)
3030

3131
def __str__(self):

python/plugins/db_manager/db_plugins/connector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44
/***************************************************************************
55
Name : DB Manager
6-
Description : Database manager plugin for QuantumGIS
6+
Description : Database manager plugin for QGIS
77
Date : May 23, 2011
88
copyright : (C) 2011 by Giuseppe Sucameli
99
email : brush.tyler@gmail.com

python/plugins/db_manager/db_plugins/data_model.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44
/***************************************************************************
55
Name : DB Manager
6-
Description : Database manager plugin for QuantumGIS
6+
Description : Database manager plugin for QGIS
77
Date : May 23, 2011
88
copyright : (C) 2011 by Giuseppe Sucameli
99
email : brush.tyler@gmail.com
@@ -243,7 +243,7 @@ def getFields(self):
243243

244244
class TableConstraintsModel(SimpleTableModel):
245245
def __init__(self, parent, editable=False):
246-
SimpleTableModel.__init__(self, ['Name', 'Type', 'Column(s)'], editable, parent)
246+
SimpleTableModel.__init__(self, [QApplication.translate("DBManagerPlugin", 'Name'), QApplication.translate("DBManagerPlugin", 'Type'), QApplication.translate("DBManagerPlugin", 'Column(s)')], editable, parent)
247247

248248
def append(self, constr):
249249
field_names = map( lambda (k,v): unicode(v.name), constr.fields().iteritems() )
@@ -275,7 +275,7 @@ def getConstraints(self):
275275

276276
class TableIndexesModel(SimpleTableModel):
277277
def __init__(self, parent, editable=False):
278-
SimpleTableModel.__init__(self, ['Name', 'Column(s)'], editable, parent)
278+
SimpleTableModel.__init__(self, [QApplication.translate("DBManagerPlugin", 'Name'), QApplication.translate("DBManagerPlugin", 'Column(s)')], editable, parent)
279279

280280
def append(self, idx):
281281
field_names = map( lambda (k,v): unicode(v.name), idx.fields().iteritems() )

python/plugins/db_manager/db_plugins/html_elems.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44
/***************************************************************************
55
Name : DB Manager
6-
Description : Database manager plugin for QuantumGIS
6+
Description : Database manager plugin for QGIS
77
Date : May 23, 2011
88
copyright : (C) 2011 by Giuseppe Sucameli
99
email : brush.tyler@gmail.com

0 commit comments

Comments
 (0)