Skip to content

Commit

Permalink
dbmanager: add i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Jun 9, 2013
1 parent d6fa765 commit f0c605e
Show file tree
Hide file tree
Showing 38 changed files with 255 additions and 259 deletions.
2 changes: 1 addition & 1 deletion python/plugins/db_manager/CREDITS
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CREDITS: 2011/10/13

DB Manager plugin for QuantumGIS
DB Manager plugin for QGIS

Author and maintainer:
Giuseppe Sucameli <brush.tyler@gmail.com>
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/db_manager/README
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
DB Manager * Copyright (c) 2011 Giuseppe Sucameli

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

In this moment DB Manager supports the following DBMS backends:
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/db_manager/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
/***************************************************************************
Name : DB Manager
Description : Database manager plugin for QuantumGIS
Description : Database manager plugin for QGIS
Date : May 23, 2011
copyright : (C) 2011 by Giuseppe Sucameli
email : brush.tyler@gmail.com
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/db_manager/completer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
/***************************************************************************
Name : DB Manager
Description : Database manager plugin for QuantumGIS
Description : Database manager plugin for QGIS
Date : May 23, 2011
copyright : (C) 2011 by Giuseppe Sucameli
email : brush.tyler@gmail.com
Expand Down
41 changes: 20 additions & 21 deletions python/plugins/db_manager/db_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
/***************************************************************************
Name : DB Manager
Description : Database manager plugin for QuantumGIS
Description : Database manager plugin for QGIS
Date : May 23, 2011
copyright : (C) 2011 by Giuseppe Sucameli
email : brush.tyler@gmail.com
Expand Down Expand Up @@ -45,8 +45,8 @@ def __init__(self, iface, parent=None):

# restore the window state
settings = QSettings()
self.restoreGeometry( settings.value("/DB_Manager/mainWindow/geometry") )
self.restoreState( settings.value("/DB_Manager/mainWindow/windowState") )
self.restoreGeometry( settings.value("/DB_Manager/mainWindow/geometry", QByteArray(), type=QByteArray ) )
self.restoreState( settings.value("/DB_Manager/mainWindow/windowState", QByteArray(), type=QByteArray ) )

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

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

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

from dlg_sql_window import DlgSqlWindow
Expand Down Expand Up @@ -333,18 +333,18 @@ def unregisterAllActions(self):
del self._registeredDbActions

def setupUi(self):
self.setWindowTitle("DB Manager")
self.setWindowTitle(self.tr("DB Manager"))
self.setWindowIcon(QIcon(":/db_manager/icon"))
self.resize(QSize(700,500).expandedTo(self.minimumSizeHint()))

# create central tab widget
self.tabs = QTabWidget()
self.info = InfoViewer(self)
self.tabs.addTab(self.info, "Info")
self.tabs.addTab(self.info, self.tr("Info"))
self.table = TableViewer(self)
self.tabs.addTab(self.table, "Table")
self.tabs.addTab(self.table, self.tr("Table"))
self.preview = LayerPreview(self)
self.tabs.addTab(self.preview, "Preview")
self.tabs.addTab(self.preview, self.tr("Preview"))
self.setCentralWidget(self.tabs)

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

# create menus
self.menuBar = QMenuBar(self)
self.menuDb = QMenu("&Database", self)
self.menuDb = QMenu(self.tr("&Database"), self)
actionMenuDb = self.menuBar.addMenu(self.menuDb)
self.menuSchema = QMenu("&Schema", self)
self.menuSchema = QMenu(self.tr("&Schema"), self)
actionMenuSchema = self.menuBar.addMenu(self.menuSchema)
self.menuTable = QMenu("&Table", self)
self.menuTable = QMenu(self.tr("&Table"), self)
actionMenuTable = self.menuBar.addMenu(self.menuTable)
self.menuHelp = None#QMenu("&Help", self)
self.menuHelp = None # QMenu(self.tr("&Help"), self)
#actionMenuHelp = self.menuBar.addMenu(self.menuHelp)

self.setMenuBar(self.menuBar)
Expand All @@ -382,21 +382,21 @@ def setupUi(self):

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

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

# menu TABLE
sep = self.menuTable.addSeparator(); sep.setObjectName("DB_Manager_TableMenu_placeholder"); sep.setVisible(False)
self.actionImport = self.menuTable.addAction( QIcon(":/db_manager/actions/import"), "&Import layer/file", self.importActionSlot )
self.actionExport = self.menuTable.addAction( QIcon(":/db_manager/actions/export"), "&Export to file", self.exportActionSlot )
self.actionImport = self.menuTable.addAction( QIcon(":/db_manager/actions/import"), self.tr("&Import layer/file"), self.importActionSlot )
self.actionExport = self.menuTable.addAction( QIcon(":/db_manager/actions/export"), self.tr("&Export to file"), self.exportActionSlot )
self.menuTable.addSeparator()
#self.actionShowSystemTables = self.menuTable.addAction("Show system tables/views", self.showSystemTables)
#self.actionShowSystemTables = self.menuTable.addAction(self.tr("Show system tables/views"), self.showSystemTables)
#self.actionShowSystemTables.setCheckable(True)
#self.actionShowSystemTables.setChecked(True)
actionMenuTable.setVisible(False)
Expand All @@ -406,4 +406,3 @@ def setupUi(self):
self.toolBar.addAction( self.actionSqlWindow )
self.toolBar.addAction( self.actionImport )
self.toolBar.addAction( self.actionExport )

13 changes: 6 additions & 7 deletions python/plugins/db_manager/db_manager_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
/***************************************************************************
Name : DB Manager
Description : Database manager plugin for QuantumGIS
Description : Database manager plugin for QGIS
Date : May 23, 2011
copyright : (C) 2011 by Giuseppe Sucameli
email : brush.tyler@gmail.com
Expand Down Expand Up @@ -34,24 +34,24 @@ def __init__(self, iface):
self.dlg = None

def initGui(self):
self.action = QAction( QIcon(":/db_manager/icon"), u"DB Manager", self.iface.mainWindow() )
self.action = QAction( QIcon(":/db_manager/icon"), QApplication.translate("DBManagerPlugin","DB Manager"), self.iface.mainWindow() )
QObject.connect( self.action, SIGNAL( "triggered()" ), self.run )
# Add toolbar button and menu item
if hasattr( self.iface, 'addDatabaseToolBarIcon' ):
self.iface.addDatabaseToolBarIcon(self.action)
else:
self.iface.addToolBarIcon(self.action)
if hasattr( self.iface, 'addPluginToDatabaseMenu' ):
self.iface.addPluginToDatabaseMenu( u"DB Manager", self.action )
self.iface.addPluginToDatabaseMenu( QApplication.translate("DBManagerPlugin","DB Manager"), self.action )
else:
self.iface.addPluginToMenu( u"DB Manager", self.action )
self.iface.addPluginToMenu( QApplication.translate("DBManagerPlugin","DB Manager"), self.action )

def unload(self):
# Remove the plugin menu item and icon
if hasattr( self.iface, 'removePluginDatabaseMenu' ):
self.iface.removePluginDatabaseMenu( u"DB Manager", self.action )
self.iface.removePluginDatabaseMenu( QApplication.translate("DBManagerPlugin","DB Manager"), self.action )
else:
self.iface.removePluginMenu( u"DB Manager", self.action )
self.iface.removePluginMenu( QApplication.translate("DBManagerPlugin","DB Manager"), self.action )
if hasattr( self.iface, 'removeDatabaseToolBarIcon' ):
self.iface.removeDatabaseToolBarIcon(self.action)
else:
Expand All @@ -72,4 +72,3 @@ def run(self):

def onDestroyed(self, obj):
self.dlg = None

10 changes: 5 additions & 5 deletions python/plugins/db_manager/db_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
/***************************************************************************
Name : DB Manager
Description : Database manager plugin for QuantumGIS
Description : Database manager plugin for QGIS
Date : May 23, 2011
copyright : (C) 2011 by Giuseppe Sucameli
email : brush.tyler@gmail.com
Expand Down Expand Up @@ -152,7 +152,7 @@ def populate(self):
return False

except BaseError, e:
QMessageBox.warning( None, u"Unable to connect", unicode(e) )
QMessageBox.warning( None, self.tr("Unable to connect"), unicode(e) )
return False

database = connection.database()
Expand Down Expand Up @@ -267,7 +267,7 @@ class DBModel(QAbstractItemModel):
def __init__(self, parent=None):
QAbstractItemModel.__init__(self, parent)
self.treeView = parent
self.header = ['Databases']
self.header = [self.tr('Databases')]

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

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

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

# retrieve information about the new table's db and schema
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/db_manager/db_plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
/***************************************************************************
Name : DB Manager
Description : Database manager plugin for QuantumGIS
Description : Database manager plugin for QGIS
Date : May 23, 2011
copyright : (C) 2011 by Giuseppe Sucameli
email : brush.tyler@gmail.com
Expand All @@ -25,7 +25,7 @@

class NotSupportedDbType(Exception):
def __init__(self, dbtype):
self.msg = u"%s is not supported yet" % dbtype
self.msg = self.tr("%s is not supported yet") % dbtype
Exception(self, self.msg)

def __str__(self):
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/db_manager/db_plugins/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
/***************************************************************************
Name : DB Manager
Description : Database manager plugin for QuantumGIS
Description : Database manager plugin for QGIS
Date : May 23, 2011
copyright : (C) 2011 by Giuseppe Sucameli
email : brush.tyler@gmail.com
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/db_manager/db_plugins/data_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
/***************************************************************************
Name : DB Manager
Description : Database manager plugin for QuantumGIS
Description : Database manager plugin for QGIS
Date : May 23, 2011
copyright : (C) 2011 by Giuseppe Sucameli
email : brush.tyler@gmail.com
Expand Down Expand Up @@ -243,7 +243,7 @@ def getFields(self):

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

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

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

def append(self, idx):
field_names = map( lambda (k,v): unicode(v.name), idx.fields().iteritems() )
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/db_manager/db_plugins/html_elems.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
/***************************************************************************
Name : DB Manager
Description : Database manager plugin for QuantumGIS
Description : Database manager plugin for QGIS
Date : May 23, 2011
copyright : (C) 2011 by Giuseppe Sucameli
email : brush.tyler@gmail.com
Expand Down
Loading

0 comments on commit f0c605e

Please sign in to comment.