# HG changeset patch # User Andrey Skvortsov # Date 1538565581 -10800 # Node ID 68e7da937162932a166ed26ef915e005819da40d # Parent dc5554f0c12ca544bb5f24e6c0ba5e6e47c69cf2 Fix 'msgid' format string with unnamed arguments cannot be properly localized diff -r dc5554f0c12c -r 68e7da937162 bacnet/bacnet.py --- a/bacnet/bacnet.py Wed Oct 03 14:17:19 2018 +0300 +++ b/bacnet/bacnet.py Wed Oct 03 14:19:41 2018 +0300 @@ -570,14 +570,16 @@ # the GUI) are valid... if self.HasDuplicateObjectNames(): self.GetCTRoot().logger.write_warning( - _("Error: BACnet server '%s.x: %s' contains objects with duplicate object names.\n") % (locstr, self.CTNName())) + _("Error: BACnet server '{a1}.x:{a2}' contains objects with duplicate object names.\n"). + format(a1=locstr, a2=self.CTNName())) raise Exception(False) # TODO: return an error code instead of raising an exception # (currently unsupported by Beremiz) if self.HasDuplicateObjectIDs(): self.GetCTRoot().logger.write_warning( - _("Error: BACnet server '%s.x: %s' contains objects with duplicate object identifiers.\n") % (locstr, self.CTNName())) + _("Error: BACnet server '{a1}.x: {a2}' contains objects with duplicate object identifiers.\n"). + format(a1=locstr, a2=self.CTNName())) raise Exception(False) # TODO: return an error code instead of raising an exception # (currently unsupported by Beremiz) diff -r dc5554f0c12c -r 68e7da937162 etherlab/EthercatCFileGenerator.py --- a/etherlab/EthercatCFileGenerator.py Wed Oct 03 14:17:19 2018 +0300 +++ b/etherlab/EthercatCFileGenerator.py Wed Oct 03 14:19:41 2018 +0300 @@ -167,8 +167,8 @@ entry_infos["infos"][4].append(name) return entry_infos["infos"][2] else: - msg = _("Output variables can't be defined with different locations (%s and %s)") \ - % (entry_infos["infos"][2], name) + msg = _("Output variables can't be defined with different locations ({a1} and {a2})").\ + format(a1=entry_infos["infos"][2], a2=name) raise ValueError(msg) else: raise ValueError(_("Definition conflict for location \"%s\"") % name) @@ -467,8 +467,8 @@ if not entry_declaration["mapped"]: entry = device_entries.get((index, subindex), None) if entry is None: - msg = _("Unknown entry index 0x%4.4x, subindex 0x%2.2x for device %s") \ - % (index, subindex, type_infos["device_type"]) + msg = _("Unknown entry index 0x{a1:.4x}, subindex 0x{a2:.2x} for device {a3}").\ + format(a1=index, a2=subindex, a3=type_infos["device_type"]) raise ValueError(msg) entry_infos = { @@ -566,8 +566,8 @@ for (index, subindex), entry_declaration in slave_variables.iteritems(): if not entry_declaration["mapped"]: - message = _("Entry index 0x%4.4x, subindex 0x%2.2x not mapped for device %s") % \ - (index, subindex, type_infos["device_type"]) + message = _("Entry index 0x{a1:.4x}, subindex 0x{a2:.2x} not mapped for device {a3}").\ + format(a1=index, a2=subindex, a3=type_infos["device_type"]) self.Controler.GetCTRoot().logger.write_warning(_("Warning: ") + message + "\n") for element in ["used_pdo_entry_offset_variables_declaration", diff -r dc5554f0c12c -r 68e7da937162 etherlab/etherlab.py --- a/etherlab/etherlab.py Wed Oct 03 14:17:19 2018 +0300 +++ b/etherlab/etherlab.py Wed Oct 03 14:19:41 2018 +0300 @@ -261,7 +261,7 @@ else: self.GetCTRoot().logger.write_error( - _("Couldn't load %s XML file:\n%s") % (filepath, error)) + _("Couldn't load {a1} XML file:\n{a2}").format(a1=filepath, a2=error)) return self.Library