1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-15 12:19:02 +00:00

Update translatable strings: use named placeholders

This commit is contained in:
dmiller
2025-05-20 15:25:12 +00:00
parent 3591d0d970
commit f84f4b9879
11 changed files with 143 additions and 136 deletions

View File

@@ -83,7 +83,7 @@ UNKNOWN_SERVICE_COLOR = '#d5d5d5'
TRACE_HEADER = ['TTL', 'RTT', 'IP', _('Hostname')] TRACE_HEADER = ['TTL', 'RTT', 'IP', _('Hostname')]
TRACE_TEXT = _( TRACE_TEXT = _(
"Traceroute on port <b>%s/%s</b> totalized <b>%d</b> known hops.") "Traceroute on port <b>%(port)s/%(proto)s</b> took <b>%(hops)d</b> known hops.")
NO_TRACE_TEXT = _("No traceroute information available.") NO_TRACE_TEXT = _("No traceroute information available.")
@@ -98,7 +98,7 @@ OSCLASS_HEADER = ['%', _('Vendor'), _('Type'), _('Family'), _('Version')]
USED_PORTS_TEXT = "%d/%s %s" USED_PORTS_TEXT = "%d/%s %s"
TCP_SEQ_NOTE = _("""\ TCP_SEQ_NOTE = _("""\
<b>*</b> TCP sequence <i>index</i> equal to %d and <i>difficulty</i> is "%s".\ <b>*</b> TCP sequence <i>index</i> equal to %(index)d and <i>difficulty</i> is "%(difficulty)s".\
""") """)
@@ -220,7 +220,7 @@ class ServicesPage(Gtk.Notebook):
if key in ['servicefp']: if key in ['servicefp']:
text = _('[%d] service: %s') % (port['id'], key) text = _('[%(port)d] service: %(servicefp)s') % (port['id'], key)
self.__select_combobox.append_text(text) self.__select_combobox.append_text(text)
self.__text.append(port['service'][key]) self.__text.append(port['service'][key])
@@ -420,10 +420,7 @@ class SystemPage(BWScrolledWindow):
self.__uptime_label = BWSectionLabel(_('Last boot:')) self.__uptime_label = BWSectionLabel(_('Last boot:'))
seconds = self.__node.get_info('uptime')['seconds'] text = _('%(lastboot)s (%(seconds)s seconds).') % self.__node.get_info('uptime')
lastboot = self.__node.get_info('uptime')['lastboot']
text = _('%s (%s seconds).') % (lastboot, seconds)
self.__uptime_value = BWLabel(text) self.__uptime_value = BWLabel(text)
self.__uptime_value.set_selectable(True) self.__uptime_value.set_selectable(True)
@@ -732,9 +729,9 @@ class TraceroutePage(BWVBox):
self.__trace_scroll.add_with_viewport(self.__trace_treeview) self.__trace_scroll.add_with_viewport(self.__trace_treeview)
self.__trace_info = (self.__node.get_info('trace')['port'], self.__trace_info = {port = self.__node.get_info('trace')['port'],
self.__node.get_info('trace')['protocol'], proto = self.__node.get_info('trace')['protocol'],
len(self.__node.get_info('trace')['hops'])) hops = len(self.__node.get_info('trace')['hops'])}
self.__trace_label = BWLabel(TRACE_TEXT % self.__trace_info) self.__trace_label = BWLabel(TRACE_TEXT % self.__trace_info)
self.__trace_label.set_use_markup(True) self.__trace_label.set_use_markup(True)

View File

@@ -347,13 +347,13 @@ class HostInfo(object):
services = [] services = []
for p in self.ports: for p in self.ports:
services.append({ services.append({
"service_name": p.get("service_name", _("unknown")), "service_name": p.get("service_name", "unknown"),
"portid": p.get("portid", ""), "portid": p.get("portid", ""),
"service_version": p.get("service_version", "service_version": p.get("service_version",
_("Unknown version")), _("Unknown version")),
"service_product": p.get("service_product", ""), "service_product": p.get("service_product", ""),
"service_extrainfo": p.get("service_extrainfo", ""), "service_extrainfo": p.get("service_extrainfo", ""),
"port_state": p.get("port_state", _("unknown")), "port_state": p.get("port_state", "unknown"),
"protocol": p.get("protocol", "") "protocol": p.get("protocol", "")
}) })
return services return services
@@ -639,8 +639,10 @@ in epoch format!")
if scan_name: if scan_name:
return scan_name return scan_name
if self.profile_name and self.get_targets(): if self.profile_name and self.get_targets():
return _("%s on %s") % (self.profile_name, return _("%(profile_name)s on %(targets)s") % {
join_quoted(self.get_targets())) profile_name = self.profile_name,
targets = join_quoted(self.get_targets())
}
return self.get_nmap_command() return self.get_nmap_command()
def set_scan_name(self, scan_name): def set_scan_name(self, scan_name):

View File

@@ -195,7 +195,7 @@ class Profile(UmitConfigParser, object):
self.read(user_profile) self.read(user_profile)
except ConfigParser_Error as e: except ConfigParser_Error as e:
# No scan profiles found is not a reason to crash. # No scan profiles found is not a reason to crash.
self.add_profile(_("Profiles not found"), self.add_profile(_("No profiles found"),
command="nmap", command="nmap",
description=_("The {} file is missing or corrupted" description=_("The {} file is missing or corrupted"
).format(user_profile)) ).format(user_profile))

View File

@@ -6,7 +6,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Zenmap\n" "Project-Id-Version: Zenmap\n"
"Report-Msgid-Bugs-To: dev@nmap.org\n" "Report-Msgid-Bugs-To: dev@nmap.org\n"
"POT-Creation-Date: 2025-05-16 19:56+0000\n" "POT-Creation-Date: 2025-05-19 16:32+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
@@ -16,18 +16,13 @@ msgstr ""
msgid "Unknown Host" msgid "Unknown Host"
msgstr "" msgstr ""
#: zenmapCore/NmapParser.py:350 zenmapCore/NmapParser.py:356
#: zenmapGUI/ScanOpenPortsPage.py:400
msgid "unknown"
msgstr ""
#: zenmapCore/NmapParser.py:353 #: zenmapCore/NmapParser.py:353
msgid "Unknown version" msgid "Unknown version"
msgstr "" msgstr ""
#: zenmapCore/NmapParser.py:642 #: zenmapCore/NmapParser.py:642
#, python-format #, python-format
msgid "%s on %s" msgid "%(profile_name)s on %(targets)s"
msgstr "" msgstr ""
#: zenmapCore/UmitOptionParser.py:77 #: zenmapCore/UmitOptionParser.py:77
@@ -65,7 +60,7 @@ msgid ""
msgstr "" msgstr ""
#: zenmapCore/UmitConf.py:198 #: zenmapCore/UmitConf.py:198
msgid "Profiles not found" msgid "No profiles found"
msgstr "" msgstr ""
#: zenmapCore/UmitConf.py:200 #: zenmapCore/UmitConf.py:200
@@ -187,11 +182,11 @@ msgstr ""
msgid "Cannot open selected file" msgid "Cannot open selected file"
msgstr "" msgstr ""
#: zenmapGUI/DiffCompare.py:208 #: zenmapGUI/DiffCompare.py:209
#, python-format #, python-format
msgid "" msgid ""
" This error occurred while trying to open the file:\n" "This error occurred while trying to open the file:\n"
" %s" "%s"
msgstr "" msgstr ""
#: zenmapGUI/DiffCompare.py:256 zenmapGUI/MainWindow.py:289 #: zenmapGUI/DiffCompare.py:256 zenmapGUI/MainWindow.py:289
@@ -334,7 +329,7 @@ msgstr ""
msgid "Search for a scan result" msgid "Search for a scan result"
msgstr "" msgstr ""
#: zenmapGUI/MainWindow.py:272 zenmapGUI/ScanInterface.py:874 #: zenmapGUI/MainWindow.py:272 zenmapGUI/ScanInterface.py:876
msgid "Filter Hosts" msgid "Filter Hosts"
msgstr "" msgstr ""
@@ -487,19 +482,19 @@ msgstr ""
#, python-format #, python-format
msgid "" msgid ""
"An error occurred when saving to\n" "An error occurred when saving to\n"
"%s\n" "%(configfile)s\n"
"The error was: %s." "The error was: %(error)s."
msgstr "" msgstr ""
#: zenmapGUI/MainWindow.py:944 #: zenmapGUI/MainWindow.py:947
msgid "Can't find documentation files" msgid "Can't find documentation files"
msgstr "" msgstr ""
#: zenmapGUI/MainWindow.py:945 #: zenmapGUI/MainWindow.py:948
#, python-format #, python-format
msgid "" msgid ""
"There was an error loading the documentation file %s (%s). See the online " "There was an error loading the documentation file %(helpfile)s (%(error)s). "
"documentation at %s." "See the online documentation at %(url)s."
msgstr "" msgstr ""
#: zenmapGUI/ScanInterface.py:379 #: zenmapGUI/ScanInterface.py:379
@@ -568,32 +563,32 @@ msgid ""
"%s" "%s"
msgstr "" msgstr ""
#: zenmapGUI/ScanInterface.py:687 #: zenmapGUI/ScanInterface.py:688
#, python-format #, python-format
msgid "%d/%d hosts shown" msgid "%(num_shown)d/%(total)d hosts shown"
msgstr ""
#: zenmapGUI/ScanInterface.py:924
msgid "Nmap Output"
msgstr ""
#: zenmapGUI/ScanInterface.py:925
msgid "Ports / Hosts"
msgstr "" msgstr ""
#: zenmapGUI/ScanInterface.py:926 #: zenmapGUI/ScanInterface.py:926
msgid "Topology" msgid "Nmap Output"
msgstr "" msgstr ""
#: zenmapGUI/ScanInterface.py:927 #: zenmapGUI/ScanInterface.py:927
msgid "Host Details" msgid "Ports / Hosts"
msgstr "" msgstr ""
#: zenmapGUI/ScanInterface.py:928 #: zenmapGUI/ScanInterface.py:928
msgid "Topology"
msgstr ""
#: zenmapGUI/ScanInterface.py:929
msgid "Host Details"
msgstr ""
#: zenmapGUI/ScanInterface.py:930
msgid "Scans" msgid "Scans"
msgstr "" msgstr ""
#: zenmapGUI/ScanInterface.py:949 #: zenmapGUI/ScanInterface.py:951
msgid "No host selected." msgid "No host selected."
msgstr "" msgstr ""
@@ -894,7 +889,7 @@ msgstr ""
#: zenmapGUI/About.py:132 #: zenmapGUI/About.py:132
#, python-format #, python-format
msgid "About %s and %s" msgid "About %(nmap)s and %(zenmap)s"
msgstr "" msgstr ""
#: zenmapGUI/About.py:151 #: zenmapGUI/About.py:151
@@ -907,34 +902,35 @@ msgstr ""
#: zenmapGUI/About.py:156 #: zenmapGUI/About.py:156
#, python-format #, python-format
msgid "" msgid ""
"%s is a multi-platform graphical %s frontend and results viewer. It was " "%(zenmap)s is a multi-platform graphical %(nmap)s frontend and results "
"originally derived from %s." "viewer. It was originally derived from %(umit)s."
msgstr "" msgstr ""
#: zenmapGUI/About.py:162 #: zenmapGUI/About.py:164
#, python-format #, python-format
msgid "" msgid ""
"%s is an %s GUI created as part of the Nmap/Google Summer of Code program." "%(umit)s is a %(nmap)s GUI created as part of the Nmap/Google Summer of Code "
"program."
msgstr "" msgstr ""
#: zenmapGUI/About.py:164 zenmapGUI/About.py:206 #: zenmapGUI/About.py:166 zenmapGUI/About.py:208
#, python-format #, python-format
msgid "%s credits" msgid "%s credits"
msgstr "" msgstr ""
#: zenmapGUI/About.py:248 #: zenmapGUI/About.py:250
msgid "Written by" msgid "Written by"
msgstr "" msgstr ""
#: zenmapGUI/About.py:250 #: zenmapGUI/About.py:252
msgid "Design" msgid "Design"
msgstr "" msgstr ""
#: zenmapGUI/About.py:254 #: zenmapGUI/About.py:256
msgid "Contributors" msgid "Contributors"
msgstr "" msgstr ""
#: zenmapGUI/About.py:256 #: zenmapGUI/About.py:258
msgid "Translation" msgid "Translation"
msgstr "" msgstr ""
@@ -982,7 +978,7 @@ msgstr ""
#, python-format #, python-format
msgid "" msgid ""
"Topology is disabled because too many hosts can cause it\n" "Topology is disabled because too many hosts can cause it\n"
"to run slowly. The limit is %d hosts and there are %d." "to run slowly. The limit is %(limit)d hosts and there are %(num)d."
msgstr "" msgstr ""
#: zenmapGUI/FileChoosers.py:78 #: zenmapGUI/FileChoosers.py:78
@@ -1103,53 +1099,54 @@ msgstr ""
#: zenmapGUI/App.py:221 #: zenmapGUI/App.py:221
#, python-format #, python-format
msgid "" msgid ""
"There was an error creating the directory %s or one of the files in it. The " "There was an error creating the directory %(dirname)s or one of the files in "
"directory is created by copying the contents of %s. The specific error was\n" "it. The directory is created by copying the contents of %(configdir)s. The "
"specific error was\n"
"\n" "\n"
"%s\n" "%(error)s\n"
"\n" "\n"
"%s needs to create this directory to store information such as the list of " "%(zenmap)s needs to create this directory to store information such as the "
"scan profiles. Check for access to the directory and try again." "list of scan profiles. Check for access to the directory and try again."
msgstr ""
#: zenmapGUI/App.py:246
msgid "Error parsing the configuration file"
msgstr "" msgstr ""
#: zenmapGUI/App.py:247 #: zenmapGUI/App.py:247
#, python-format msgid "Error parsing the configuration file"
msgid ""
"There was an error parsing the configuration file %s. The specific error "
"was\n"
"\n"
"%s\n"
"\n"
"%s can continue without this file but any information in it will be ignored "
"until it is repaired."
msgstr "" msgstr ""
#: zenmapGUI/App.py:261 #: zenmapGUI/App.py:248
#, python-format
msgid ""
"There was an error parsing the configuration file %(filename)s. The specific "
"error was\n"
"\n"
"%(error)s\n"
"\n"
"%(zenmap)s can continue without this file but any information in it will be "
"ignored until it is repaired."
msgstr ""
#: zenmapGUI/App.py:263
msgid "Restore default configuration?" msgid "Restore default configuration?"
msgstr "" msgstr ""
#: zenmapGUI/App.py:262 #: zenmapGUI/App.py:264
#, python-format #, python-format
msgid "" msgid ""
"To avoid further errors parsing the configuration file %s, you can copy the " "To avoid further errors parsing the configuration file %(filename)s, you can "
"default configuration from %s.\n" "copy the default configuration from %(dirname)s.\n"
"\n" "\n"
"Do this now? " "Do this now? "
msgstr "" msgstr ""
#: zenmapGUI/App.py:321 #: zenmapGUI/App.py:323
#, python-format #, python-format
msgid "" msgid ""
"You are trying to run %s with a non-root user!\n" "You are trying to run %(zenmap)s with a non-root user!\n"
"\n" "\n"
"Some %s options need root privileges to work." "Some %(nmap)s options need root privileges to work."
msgstr "" msgstr ""
#: zenmapGUI/App.py:326 #: zenmapGUI/App.py:328
msgid "Non-root user" msgid "Non-root user"
msgstr "" msgstr ""
@@ -1312,7 +1309,8 @@ msgstr ""
#: radialnet/gui/NodeNotebook.py:86 #: radialnet/gui/NodeNotebook.py:86
#, python-format #, python-format
msgid "Traceroute on port <b>%s/%s</b> totalized <b>%d</b> known hops." msgid ""
"Traceroute on port <b>%(port)s/%(proto)s</b> took <b>%(hops)d</b> known hops."
msgstr "" msgstr ""
#: radialnet/gui/NodeNotebook.py:88 #: radialnet/gui/NodeNotebook.py:88
@@ -1334,8 +1332,8 @@ msgstr ""
#: radialnet/gui/NodeNotebook.py:100 #: radialnet/gui/NodeNotebook.py:100
#, python-format #, python-format
msgid "" msgid ""
"<b>*</b> TCP sequence <i>index</i> equal to %d and <i>difficulty</i> is \"%s" "<b>*</b> TCP sequence <i>index</i> equal to %(index)d and <i>difficulty</i> "
"\"." "is \"%(difficulty)s\"."
msgstr "" msgstr ""
#: radialnet/gui/NodeNotebook.py:134 #: radialnet/gui/NodeNotebook.py:134
@@ -1351,7 +1349,7 @@ msgstr ""
msgid "Ports (%s)" msgid "Ports (%s)"
msgstr "" msgstr ""
#: radialnet/gui/NodeNotebook.py:196 radialnet/gui/NodeNotebook.py:707 #: radialnet/gui/NodeNotebook.py:196 radialnet/gui/NodeNotebook.py:704
msgid "<unknown>" msgid "<unknown>"
msgstr "" msgstr ""
@@ -1361,7 +1359,7 @@ msgstr ""
#: radialnet/gui/NodeNotebook.py:223 #: radialnet/gui/NodeNotebook.py:223
#, python-format #, python-format
msgid "[%d] service: %s" msgid "[%(port)d] service: %(servicefp)s"
msgstr "" msgstr ""
#: radialnet/gui/NodeNotebook.py:228 #: radialnet/gui/NodeNotebook.py:228
@@ -1401,32 +1399,32 @@ msgstr ""
msgid "Hostname:" msgid "Hostname:"
msgstr "" msgstr ""
#: radialnet/gui/NodeNotebook.py:426 #: radialnet/gui/NodeNotebook.py:423
#, python-format #, python-format
msgid "%s (%s seconds)." msgid "%(lastboot)s (%(seconds)s seconds)."
msgstr "" msgstr ""
#: radialnet/gui/NodeNotebook.py:489 #: radialnet/gui/NodeNotebook.py:486
msgid "Match" msgid "Match"
msgstr "" msgstr ""
#: radialnet/gui/NodeNotebook.py:530 radialnet/gui/NodeNotebook.py:580 #: radialnet/gui/NodeNotebook.py:527 radialnet/gui/NodeNotebook.py:577
msgid "Class" msgid "Class"
msgstr "" msgstr ""
#: radialnet/gui/NodeNotebook.py:538 #: radialnet/gui/NodeNotebook.py:535
msgid "Used ports:" msgid "Used ports:"
msgstr "" msgstr ""
#: radialnet/gui/NodeNotebook.py:561 #: radialnet/gui/NodeNotebook.py:558
msgid "Fingerprint" msgid "Fingerprint"
msgstr "" msgstr ""
#: radialnet/gui/NodeNotebook.py:581 #: radialnet/gui/NodeNotebook.py:578
msgid "Values" msgid "Values"
msgstr "" msgstr ""
#: radialnet/gui/NodeNotebook.py:585 #: radialnet/gui/NodeNotebook.py:582
msgid "TCP Timestamp" msgid "TCP Timestamp"
msgstr "" msgstr ""

View File

@@ -129,8 +129,8 @@ class About(HIGDialog):
have roughly the same feel as Gtk.AboutDialog.""" have roughly the same feel as Gtk.AboutDialog."""
def __init__(self): def __init__(self):
HIGDialog.__init__(self) HIGDialog.__init__(self)
self.set_title(_("About %s and %s") % ( self.set_title(_("About %(nmap)s and %(zenmap)s") % {
NMAP_DISPLAY_NAME, APP_DISPLAY_NAME)) nmap = NMAP_DISPLAY_NAME, zenmap = APP_DISPLAY_NAME })
self.vbox.set_border_width(12) self.vbox.set_border_width(12)
self.vbox.set_spacing(12) self.vbox.set_spacing(12)
@@ -153,14 +153,16 @@ class About(HIGDialog):
self.vbox.pack_start(entry, True, True, 0) self.vbox.pack_start(entry, True, True, 0)
entry = _program_entry(APP_DISPLAY_NAME, APP_WEB_SITE, _( entry = _program_entry(APP_DISPLAY_NAME, APP_WEB_SITE, _(
"%s is a multi-platform graphical %s frontend and results viewer. " "%(zenmap)s is a multi-platform graphical %(nmap)s frontend and results viewer. "
"It was originally derived from %s.") % ( "It was originally derived from %(umit)s.") % {
APP_DISPLAY_NAME, NMAP_DISPLAY_NAME, UMIT_DISPLAY_NAME)) zenmap = APP_DISPLAY_NAME,
nmap = NMAP_DISPLAY_NAME,
umit = UMIT_DISPLAY_NAME})
self.vbox.pack_start(entry, True, True, 0) self.vbox.pack_start(entry, True, True, 0)
entry = _program_entry(UMIT_DISPLAY_NAME, UMIT_WEB_SITE, _( entry = _program_entry(UMIT_DISPLAY_NAME, UMIT_WEB_SITE, _(
"%s is an %s GUI created as part of the Nmap/Google Summer " "%(umit)s is a %(nmap)s GUI created as part of the Nmap/Google Summer "
"of Code program.") % (UMIT_DISPLAY_NAME, NMAP_DISPLAY_NAME)) "of Code program.") % {umit = UMIT_DISPLAY_NAME, nmap = NMAP_DISPLAY_NAME})
button = Gtk.Button.new_with_label(_("%s credits") % UMIT_DISPLAY_NAME) button = Gtk.Button.new_with_label(_("%s credits") % UMIT_DISPLAY_NAME)
button.connect("clicked", self._show_umit_credits) button.connect("clicked", self._show_umit_credits)
entry.hbox.pack_start(button, False, True, 0) entry.hbox.pack_start(button, False, True, 0)

View File

@@ -219,17 +219,18 @@ def run():
message_format=_( message_format=_(
"Error creating the per-user configuration directory"), "Error creating the per-user configuration directory"),
secondary_text=_("""\ secondary_text=_("""\
There was an error creating the directory %s or one of the files in it. \ There was an error creating the directory %(dirname)s or one of the files in it. \
The directory is created by copying the contents of %s. \ The directory is created by copying the contents of %(configdir)s. \
The specific error was The specific error was
%s %(error)s
%s needs to create this directory to store information such as the list of \ %(zenmap)s needs to create this directory to store information such as the list of \
scan profiles. Check for access to the directory and try again.""") % ( scan profiles. Check for access to the directory and try again.""") % {
repr(Path.user_config_dir), repr(Path.config_dir), dirname = repr(Path.user_config_dir),
repr(str(e)), APP_DISPLAY_NAME configdir = repr(Path.config_dir),
) error = repr(str(e)), zenmap = APP_DISPLAY_NAME
}
) )
error_dialog.run() error_dialog.run()
error_dialog.destroy() error_dialog.destroy()
@@ -245,13 +246,14 @@ scan profiles. Check for access to the directory and try again.""") % (
error_dialog = HIGAlertDialog( error_dialog = HIGAlertDialog(
message_format=_("Error parsing the configuration file"), message_format=_("Error parsing the configuration file"),
secondary_text=_("""\ secondary_text=_("""\
There was an error parsing the configuration file %s. \ There was an error parsing the configuration file %(filename)s. \
The specific error was The specific error was
%s %(error)s
%s can continue without this file but any information in it will be ignored \ %(zenmap)s can continue without this file but any information in it will be ignored \
until it is repaired.""") % (Path.user_config_file, str(e), APP_DISPLAY_NAME) until it is repaired.""") % {
filename = Path.user_config_file, error = str(e), zenmap = APP_DISPLAY_NAME}
) )
error_dialog.run() error_dialog.run()
error_dialog.destroy() error_dialog.destroy()
@@ -260,11 +262,11 @@ until it is repaired.""") % (Path.user_config_file, str(e), APP_DISPLAY_NAME)
type=Gtk.MessageType.QUESTION, type=Gtk.MessageType.QUESTION,
message_format=_("Restore default configuration?"), message_format=_("Restore default configuration?"),
secondary_text=_("""\ secondary_text=_("""\
To avoid further errors parsing the configuration file %s, \ To avoid further errors parsing the configuration file %(filename)s, \
you can copy the default configuration from %s. you can copy the default configuration from %(dirname)s.
Do this now? \ Do this now? \
""") % (Path.user_config_file, global_config_path), """) % {filename = Path.user_config_file, dirname = global_config_path},
) )
repair_dialog.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL) repair_dialog.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL)
repair_dialog.set_default_response(Gtk.ResponseType.CANCEL) repair_dialog.set_default_response(Gtk.ResponseType.CANCEL)
@@ -318,10 +320,10 @@ Do this now? \
class NonRootWarning (HIGAlertDialog): class NonRootWarning (HIGAlertDialog):
def __init__(self): def __init__(self):
warning_text = _('''You are trying to run %s with a non-root user! warning_text = _('''You are trying to run %(zenmap)s with a non-root user!
Some %s options need root privileges to work.''') % ( Some %(nmap)s options need root privileges to work.''') % {
APP_DISPLAY_NAME, NMAP_DISPLAY_NAME) zenmap = APP_DISPLAY_NAME, nmap = NMAP_DISPLAY_NAME}
HIGAlertDialog.__init__(self, message_format=_('Non-root user'), HIGAlertDialog.__init__(self, message_format=_('Non-root user'),
secondary_text=warning_text) secondary_text=warning_text)

View File

@@ -205,9 +205,9 @@ class ScanChooser(HIGVBox):
alert = HIGAlertDialog( alert = HIGAlertDialog(
message_format='<b>%s</b>' % _( message_format='<b>%s</b>' % _(
'Cannot open selected file'), 'Cannot open selected file'),
secondary_text=_("""\ secondary_text=_(
This error occurred while trying to open the file: "This error occurred while trying to open the file:\n%s"
%s""") % str(e)) ) % str(e))
alert.run() alert.run()
alert.destroy() alert.destroy()
return False return False

View File

@@ -896,9 +896,12 @@ This scan has not been run yet. Start the scan with the "Scan" button first.'))
message_format=_("Can't save Zenmap configuration"), message_format=_("Can't save Zenmap configuration"),
# newline before path to help avoid weird line wrapping # newline before path to help avoid weird line wrapping
secondary_text=_( secondary_text=_(
'An error occurred when saving to\n%s' 'An error occurred when saving to\n%(configfile)s'
'\nThe error was: %s.' '\nThe error was: %(error)s.'
) % (Path.user_config_file, config_parser.failed)) ) % {
configfile = Path.user_config_file,
error = config_parser.failed
})
alert.run() alert.run()
alert.destroy() alert.destroy()
@@ -943,9 +946,10 @@ This scan has not been run yet. Start the scan with the "Scan" button first.'))
d = HIGAlertDialog(parent=self, d = HIGAlertDialog(parent=self,
message_format=_("Can't find documentation files"), message_format=_("Can't find documentation files"),
secondary_text=_("""\ secondary_text=_("""\
There was an error loading the documentation file %s (%s). See the \ There was an error loading the documentation file %(helpfile)s (%(error)s). See the \
online documentation at %s.\ online documentation at %(url)s.\
""") % (doc_path, str(e), APP_DOCUMENTATION_SITE)) """) % {
helpfile = doc_path, error = str(e), url = APP_DOCUMENTATION_SITE})
d.run() d.run()
d.destroy() d.destroy()

View File

@@ -684,9 +684,11 @@ class ScanInterface(HIGVBox):
self.host_view_selection.select_iter( self.host_view_selection.select_iter(
self.scan_result.scan_host_view.host_list.get_iter_first()) self.scan_result.scan_host_view.host_list.get_iter_first())
self.filter_bar.set_information_text(_("%d/%d hosts shown") % self.filter_bar.set_information_text(
(len(self.inventory.get_hosts_up()), _("%(num_shown)d/%(total)d hosts shown") % {
len(NetworkInventory.get_hosts_up(self.inventory)))) num_shown = len(self.inventory.get_hosts_up()),
total = len(NetworkInventory.get_hosts_up(self.inventory))
})
mode = self.scan_result.scan_host_view.mode mode = self.scan_result.scan_host_view.mode
if mode == ScanHostsView.HOST_MODE: if mode == ScanHostsView.HOST_MODE:

View File

@@ -397,7 +397,7 @@ class HostOpenPorts(HIGVBox):
p["host"].get_hostname(), p["host"].get_hostname(),
int(p.get('portid', "0")), int(p.get('portid', "0")),
p.get('protocol', ""), p.get('protocol', ""),
p.get('port_state', _("unknown")), p.get('port_state', "unknown"),
get_version_string(p) get_version_string(p)
] ]
) )

View File

@@ -139,8 +139,8 @@ class TopologyPage(HIGVBox):
self.slow_label.set_text(_("""\ self.slow_label.set_text(_("""\
Topology is disabled because too many hosts can cause it Topology is disabled because too many hosts can cause it
to run slowly. The limit is %d hosts and there are %d.\ to run slowly. The limit is %(limit)d hosts and there are %(num)d.\
""" % (SLOW_LIMIT, len(hosts_up)))) """ % {limit = SLOW_LIMIT, num = len(hosts_up)}))
if len(hosts_up) <= SLOW_LIMIT: if len(hosts_up) <= SLOW_LIMIT:
self.radialnet.show() self.radialnet.show()