Skip to content

Commit

Permalink
update translation strings
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Mar 5, 2017
1 parent 5a543e4 commit f00a87c
Show file tree
Hide file tree
Showing 77 changed files with 275 additions and 288 deletions.
32 changes: 16 additions & 16 deletions python/plugins/MetaSearch/dialogs/maindialog.py
Expand Up @@ -80,7 +80,7 @@ def __init__(self, iface):
self.context = StaticContext()

version = self.context.metadata.get('general', 'version')
self.setWindowTitle('MetaSearch %s' % version)
self.setWindowTitle(self.tr('MetaSearch {0}').format(version))

self.rubber_band = QgsRubberBand(self.map, True) # True = a polygon
self.rubber_band.setColor(QColor(255, 0, 0, 75))
Expand Down Expand Up @@ -311,7 +311,7 @@ def delete_connection(self):

key = '/MetaSearch/%s' % current_text

msg = self.tr('Remove service %s?') % current_text
msg = self.tr('Remove service {0}?').format(current_text)

result = QMessageBox.information(self, self.tr('Confirm delete'), msg,
QMessageBox.Ok | QMessageBox.Cancel)
Expand Down Expand Up @@ -345,7 +345,7 @@ def add_default_connections(self):
name = server.attrib.get('name')
# check for duplicates
if name in keys:
msg = self.tr('%s exists. Overwrite?') % name
msg = self.tr('{0} exists. Overwrite?').format(name)
res = QMessageBox.warning(self,
self.tr('Loading connections'), msg,
QMessageBox.Yes | QMessageBox.No)
Expand Down Expand Up @@ -475,12 +475,12 @@ def search(self):
except ExceptionReport as err:
QApplication.restoreOverrideCursor()
QMessageBox.warning(self, self.tr('Search error'),
self.tr('Search error: %s') % err)
self.tr('Search error: {0}').format(err))
return
except Exception as err:
QApplication.restoreOverrideCursor()
QMessageBox.warning(self, self.tr('Connection error'),
self.tr('Connection error: %s') % err)
self.tr('Connection error: {0}').format(err))
return

if self.catalog.results['matches'] == 0:
Expand All @@ -498,9 +498,9 @@ def display_results(self):

position = self.catalog.results['returned'] + self.startfrom

msg = self.tr('Showing %d - %d of %n result(s)', 'number of results',
self.catalog.results['matches']) % (self.startfrom + 1,
position)
msg = self.tr('Showing {0} - {1} of %n result(s)', 'number of results',
self.catalog.results['matches']).format(self.startfrom + 1,
position)

self.lblResults.setText(msg)

Expand Down Expand Up @@ -655,12 +655,12 @@ def navigate(self):
except ExceptionReport as err:
QApplication.restoreOverrideCursor()
QMessageBox.warning(self, self.tr('Search error'),
self.tr('Search error: %s') % err)
self.tr('Search error: {0}').format(err))
return
except Exception as err:
QApplication.restoreOverrideCursor()
QMessageBox.warning(self, self.tr('Connection error'),
self.tr('Connection error: %s') % err)
self.tr('Connection error: {0}').format(err))
return

QApplication.restoreOverrideCursor()
Expand Down Expand Up @@ -711,7 +711,7 @@ def add_to_ows(self):
# check for duplicates
if sname in keys: # duplicate found
if self.radioTitleAsk.isChecked(): # ask to overwrite
msg = self.tr('Connection %s exists. Overwrite?') % sname
msg = self.tr('Connection {0} exists. Overwrite?').format(sname)
res = QMessageBox.warning(self, self.tr('Saving server'), msg,
QMessageBox.Yes | QMessageBox.No)
if res != QMessageBox.Yes: # assign new name with serial
Expand Down Expand Up @@ -777,12 +777,12 @@ def show_metadata(self):
except ExceptionReport as err:
QApplication.restoreOverrideCursor()
QMessageBox.warning(self, self.tr('GetRecords error'),
self.tr('Error getting response: %s') % err)
self.tr('Error getting response: {0}').format(err))
return
except KeyError as err:
QMessageBox.warning(self,
self.tr('Record parsing error'),
'Unable to locate record identifier')
self.tr('Unable to locate record identifier'))
QApplication.restoreOverrideCursor()
return

Expand Down Expand Up @@ -853,11 +853,11 @@ def _get_csw(self):
timeout=self.timeout)
return True
except ExceptionReport as err:
msg = self.tr('Error connecting to service: %s') % err
msg = self.tr('Error connecting to service: {0}').format(err)
except ValueError as err:
msg = self.tr('Value Error: %s') % err
msg = self.tr('Value Error: {0}').format(err)
except Exception as err:
msg = self.tr('Unknown Error: %s') % err
msg = self.tr('Unknown Error: {0}').format(err)

QMessageBox.warning(self, self.tr('CSW Connection error'), msg)
QApplication.restoreOverrideCursor()
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/MetaSearch/dialogs/manageconnectionsdialog.py
Expand Up @@ -134,7 +134,7 @@ def save(self, connections):
with open(self.filename, 'w') as fileobj:
fileobj.write(prettify_xml(etree.tostring(doc)))
QMessageBox.information(self, self.tr('Save Connections'),
self.tr('Saved to %s') % self.filename)
self.tr('Saved to {0}').format(self.filename))
self.reject()

def load(self, items):
Expand All @@ -155,7 +155,7 @@ def load(self, items):

# check for duplicates
if conn_name in keys:
label = self.tr('File %s exists. Overwrite?') % conn_name
label = self.tr('File {0} exists. Overwrite?').format(conn_name)
res = QMessageBox.warning(self, self.tr('Loading Connections'),
label,
QMessageBox.Yes | QMessageBox.No)
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/MetaSearch/dialogs/newconnectiondialog.py
Expand Up @@ -73,7 +73,7 @@ def accept(self):
if all([self.conn_name_orig != conn_name,
self.settings.contains(keyurl)]):
res = QMessageBox.warning(self, self.tr('Save connection'),
self.tr('Overwrite %s?') % conn_name,
self.tr('Overwrite {0}?').format(conn_name),
QMessageBox.Ok | QMessageBox.Cancel)
if res == QMessageBox.Cancel:
return
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/MetaSearch/util.py
Expand Up @@ -95,10 +95,10 @@ def get_connections_from_file(parent, filename):
msg = parent.tr('Invalid CSW connections XML.')
except etree.ParseError as err:
error = 1
msg = parent.tr('Cannot parse XML file: %s' % err)
msg = parent.tr('Cannot parse XML file: {0}').format(err)
except IOError as err:
error = 1
msg = parent.tr('Cannot open file: %s' % err)
msg = parent.tr('Cannot open file: {0}').format(err)

if error == 1:
QMessageBox.information(parent, parent.tr('Loading Connections'), msg)
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/db_manager/db_manager.py
Expand Up @@ -196,7 +196,7 @@ def runSqlWindow(self):

query = DlgSqlWindow(self.iface, db, self)
dbname = db.connection().connectionName()
tabname = self.tr("Query") + u" (%s)" % dbname
tabname = self.tr("Query ({0})").format(dbname)
index = self.tabs.addTab(query, tabname)
self.tabs.setTabIcon(index, db.connection().icon())
self.tabs.setCurrentIndex(index)
Expand All @@ -206,9 +206,9 @@ def runSqlLayerWindow(self, layer):
from .dlg_sql_layer_window import DlgSqlLayerWindow
query = DlgSqlLayerWindow(self.iface, layer, self)
lname = layer.name()
tabname = self.tr("Layer") + u" (%s)" % lname
tabname = self.tr("Layer ({0})").format(lname)
index = self.tabs.addTab(query, tabname)
#self.tabs.setTabIcon(index, db.connection().icon())
# self.tabs.setTabIcon(index, db.connection().icon())
self.tabs.setCurrentIndex(index)

def update_query_tab_name(self, index, dbname, queryname):
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/db_manager/db_model.py
Expand Up @@ -600,7 +600,7 @@ def importLayer(self, layerType, providerKey, layerName, uriString, parent):

if not inLayer.isValid():
# invalid layer
QMessageBox.warning(None, self.tr("Invalid layer"), self.tr("Unable to load the layer %s") % inLayer.name())
QMessageBox.warning(None, self.tr("Invalid layer"), self.tr("Unable to load the layer {0}").format(inLayer.name()))
return False

# retrieve information about the new table's db and schema
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/db_manager/db_plugins/__init__.py
Expand Up @@ -26,7 +26,7 @@ class NotSupportedDbType(Exception):

def __init__(self, dbtype):
from qgis.PyQt.QtWidgets import QApplication
self.msg = QApplication.translate("DBManagerPlugin", "%s is not supported yet" % dbtype)
self.msg = QApplication.translate("DBManagerPlugin", "{0} is not supported yet").format(dbtype)
Exception(self, self.msg)

def __str__(self):
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/db_manager/db_plugins/gpkg/plugin.py
Expand Up @@ -72,7 +72,7 @@ def connect(self, parent=None):
settings.beginGroup(u"/%s/%s" % (self.connectionSettingsKey(), conn_name))

if not settings.contains("gpkgpath"): # non-existent entry?
raise InvalidDataException(u'there is no defined database connection "%s".' % conn_name)
raise InvalidDataException(self.tr(u'There is no defined database connection "{0}".').format(conn_name))

database = settings.value("gpkgpath")

Expand Down
2 changes: 1 addition & 1 deletion python/plugins/db_manager/db_plugins/info_model.py
Expand Up @@ -106,7 +106,7 @@ def toHtml(self):
typename = self.db.connection().typeNameString()
spatial_info = HtmlContent(spatial_info)
if not spatial_info.hasContents():
spatial_info = QApplication.translate("DBManagerPlugin", '<warning> %s support not enabled!') % typename
spatial_info = QApplication.translate("DBManagerPlugin", '<warning> {0} support not enabled!').format(typename)
ret.append(HtmlSection(typename, spatial_info))

# privileges
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/db_manager/db_plugins/oracle/plugin.py
Expand Up @@ -86,7 +86,7 @@ def connect(self, parent=None):

if not settings.contains("database"): # non-existent entry?
raise InvalidDataException(
self.tr('There is no defined database connection "{}".'.format(
self.tr('There is no defined database connection "{0}".'.format(
conn_name)))

from qgis.core import QgsDataSourceUri
Expand Down
18 changes: 9 additions & 9 deletions python/plugins/db_manager/db_plugins/plugin.py
Expand Up @@ -72,9 +72,9 @@ def __unicode__(self):
if self.query is None:
return BaseError.__unicode__(self)

msg = QApplication.translate("DBManagerPlugin", "Error:\n%s") % BaseError.__unicode__(self)
msg = QApplication.translate("DBManagerPlugin", "Error:\n{0}").format(BaseError.__unicode__(self))
if self.query:
msg += QApplication.translate("DBManagerPlugin", "\n\nQuery:\n%s") % self.query
msg += QApplication.translate("DBManagerPlugin", "\n\nQuery:\n{0}").format(self.query)
return msg


Expand Down Expand Up @@ -177,7 +177,7 @@ def removeActionSlot(self, item, action, parent):
try:
res = QMessageBox.question(parent, QApplication.translate("DBManagerPlugin", "hey!"),
QApplication.translate("DBManagerPlugin",
"Really remove connection to %s?") % item.connectionName(),
"Really remove connection to {0}?").format(item.connectionName()),
QMessageBox.Yes | QMessageBox.No)
if res != QMessageBox.Yes:
return
Expand Down Expand Up @@ -387,7 +387,7 @@ def deleteSchemaActionSlot(self, item, action, parent):
return
res = QMessageBox.question(parent, QApplication.translate("DBManagerPlugin", "hey!"),
QApplication.translate("DBManagerPlugin",
"Really delete schema %s?") % item.name,
"Really delete schema {0}?").format(item.name),
QMessageBox.Yes | QMessageBox.No)
if res != QMessageBox.Yes:
return
Expand Down Expand Up @@ -444,7 +444,7 @@ def deleteTableActionSlot(self, item, action, parent):
return
res = QMessageBox.question(parent, QApplication.translate("DBManagerPlugin", "hey!"),
QApplication.translate("DBManagerPlugin",
"Really delete table/view %s?") % item.name,
"Really delete table/view {0}?").format(item.name),
QMessageBox.Yes | QMessageBox.No)
if res != QMessageBox.Yes:
return
Expand All @@ -462,7 +462,7 @@ def emptyTableActionSlot(self, item, action, parent):
return
res = QMessageBox.question(parent, QApplication.translate("DBManagerPlugin", "hey!"),
QApplication.translate("DBManagerPlugin",
"Really delete all items from table %s?") % item.name,
"Really delete all items from table {0}?").format(item.name),
QMessageBox.Yes | QMessageBox.No)
if res != QMessageBox.Yes:
return
Expand Down Expand Up @@ -887,7 +887,7 @@ def runAction(self, action):
parts = action.split('/')
trigger_action = parts[1]

msg = QApplication.translate("DBManagerPlugin", "Do you want to %s all triggers?") % trigger_action
msg = QApplication.translate("DBManagerPlugin", "Do you want to {0} all triggers?").format(trigger_action)
QApplication.restoreOverrideCursor()
try:
if QMessageBox.question(None, QApplication.translate("DBManagerPlugin", "Table triggers"), msg,
Expand All @@ -908,7 +908,7 @@ def runAction(self, action):
trigger_name = parts[1]
trigger_action = parts[2]

msg = QApplication.translate("DBManagerPlugin", "Do you want to %s trigger %s?") % (
msg = QApplication.translate("DBManagerPlugin", "Do you want to {0} trigger {1}?").format(
trigger_action, trigger_name)
QApplication.restoreOverrideCursor()
try:
Expand Down Expand Up @@ -1004,7 +1004,7 @@ def runAction(self, action):
parts = action.split('/')
spatialIndex_action = parts[1]

msg = QApplication.translate("DBManagerPlugin", "Do you want to %s spatial index for field %s?") % (
msg = QApplication.translate("DBManagerPlugin", "Do you want to {0} spatial index for field {1}?").format(
spatialIndex_action, self.geomColumn)
QApplication.restoreOverrideCursor()
try:
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/db_manager/db_plugins/postgis/plugin.py
Expand Up @@ -75,7 +75,7 @@ def connect(self, parent=None):
settings.beginGroup(u"/%s/%s" % (self.connectionSettingsKey(), conn_name))

if not settings.contains("database"): # non-existent entry?
raise InvalidDataException(self.tr('There is no defined database connection "%s".') % conn_name)
raise InvalidDataException(self.tr('There is no defined database connection "{0}".').format(conn_name))

from qgis.core import QgsDataSourceUri

Expand Down Expand Up @@ -216,7 +216,7 @@ def runAction(self, action):
rule_name = parts[1]
rule_action = parts[2]

msg = u"Do you want to %s rule %s?" % (rule_action, rule_name)
msg = self.tr(u"Do you want to {0} rule {1}?").format(rule_action, rule_name)

QApplication.restoreOverrideCursor()

Expand Down
2 changes: 1 addition & 1 deletion python/plugins/db_manager/db_plugins/spatialite/plugin.py
Expand Up @@ -71,7 +71,7 @@ def connect(self, parent=None):
settings.beginGroup(u"/%s/%s" % (self.connectionSettingsKey(), conn_name))

if not settings.contains("sqlitepath"): # non-existent entry?
raise InvalidDataException(u'there is no defined database connection "%s".' % conn_name)
raise InvalidDataException(self.tr(u'There is no defined database connection "{0}".').format(conn_name))

database = settings.value("sqlitepath")

Expand Down
2 changes: 1 addition & 1 deletion python/plugins/db_manager/dlg_export_vector.py
Expand Up @@ -188,7 +188,7 @@ def accept(self):
QApplication.restoreOverrideCursor()

if ret != 0:
QMessageBox.warning(self, self.tr("Export to file"), self.tr("Error %d\n%s") % (ret, errMsg))
QMessageBox.warning(self, self.tr("Export to file"), self.tr("Error {0}\n{1}").format(ret, errMsg))
return

# create spatial index
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/db_manager/dlg_import_vector.py
Expand Up @@ -361,7 +361,7 @@ def accept(self):
if ret != 0:
output = QgsMessageViewer()
output.setTitle(self.tr("Import to database"))
output.setMessageAsPlainText(self.tr("Error %d\n%s") % (ret, errMsg))
output.setMessageAsPlainText(self.tr("Error {0}\n{1}").format(ret, errMsg))
output.showMessage()
return

Expand Down
2 changes: 1 addition & 1 deletion python/plugins/db_manager/dlg_sql_layer_window.py
Expand Up @@ -238,7 +238,7 @@ def executeSql(self):
# set the new model
model = self.db.sqlResultModel(sql, self)
self.viewResult.setModel(model)
self.lblResult.setText(self.tr("%d rows, %.1f seconds") % (model.affectedRows(), model.secs()))
self.lblResult.setText(self.tr("{0} rows, {1:.1f} seconds").format(model.affectedRows(), model.secs()))
cols = self.viewResult.model().columnNames()
for col in cols:
quotedCols.append(self.db.connector.quoteId(col))
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/db_manager/dlg_sql_window.py
Expand Up @@ -62,7 +62,7 @@ def __init__(self, iface, db, parent=None):
self.aliasSubQuery = isinstance(db, PGDatabase) # only PostgreSQL requires subqueries to be aliases
self.setupUi(self)
self.setWindowTitle(
u"%s - %s [%s]" % (self.windowTitle(), db.connection().connectionName(), db.connection().typeNameString()))
self.tr(u"{0} - {1} [{2}]").format(self.windowTitle(), db.connection().connectionName(), db.connection().typeNameString()))

self.defaultLayerName = 'QueryLayer'

Expand Down Expand Up @@ -197,7 +197,7 @@ def executeSql(self):
# set the new model
model = self.db.sqlResultModel(sql, self)
self.viewResult.setModel(model)
self.lblResult.setText(self.tr("%d rows, %.1f seconds") % (model.affectedRows(), model.secs()))
self.lblResult.setText(self.tr("{0} rows, {1:.1f} seconds").format(model.affectedRows(), model.secs()))
cols = self.viewResult.model().columnNames()
for col in cols:
quotedCols.append(self.db.connector.quoteId(col))
Expand Down

0 comments on commit f00a87c

Please sign in to comment.