mirror of
https://github.com/nmap/nmap.git
synced 2026-02-14 09:26:35 +00:00
Update translatable strings: use named placeholders
This commit is contained in:
@@ -129,8 +129,8 @@ class About(HIGDialog):
|
||||
have roughly the same feel as Gtk.AboutDialog."""
|
||||
def __init__(self):
|
||||
HIGDialog.__init__(self)
|
||||
self.set_title(_("About %s and %s") % (
|
||||
NMAP_DISPLAY_NAME, APP_DISPLAY_NAME))
|
||||
self.set_title(_("About %(nmap)s and %(zenmap)s") % {
|
||||
nmap = NMAP_DISPLAY_NAME, zenmap = APP_DISPLAY_NAME })
|
||||
|
||||
self.vbox.set_border_width(12)
|
||||
self.vbox.set_spacing(12)
|
||||
@@ -153,14 +153,16 @@ class About(HIGDialog):
|
||||
self.vbox.pack_start(entry, True, True, 0)
|
||||
|
||||
entry = _program_entry(APP_DISPLAY_NAME, APP_WEB_SITE, _(
|
||||
"%s is a multi-platform graphical %s frontend and results viewer. "
|
||||
"It was originally derived from %s.") % (
|
||||
APP_DISPLAY_NAME, NMAP_DISPLAY_NAME, UMIT_DISPLAY_NAME))
|
||||
"%(zenmap)s is a multi-platform graphical %(nmap)s frontend and results viewer. "
|
||||
"It was originally derived from %(umit)s.") % {
|
||||
zenmap = APP_DISPLAY_NAME,
|
||||
nmap = NMAP_DISPLAY_NAME,
|
||||
umit = UMIT_DISPLAY_NAME})
|
||||
self.vbox.pack_start(entry, True, True, 0)
|
||||
|
||||
entry = _program_entry(UMIT_DISPLAY_NAME, UMIT_WEB_SITE, _(
|
||||
"%s is an %s GUI created as part of the Nmap/Google Summer "
|
||||
"of Code program.") % (UMIT_DISPLAY_NAME, NMAP_DISPLAY_NAME))
|
||||
"%(umit)s is a %(nmap)s GUI created as part of the Nmap/Google Summer "
|
||||
"of Code program.") % {umit = UMIT_DISPLAY_NAME, nmap = NMAP_DISPLAY_NAME})
|
||||
button = Gtk.Button.new_with_label(_("%s credits") % UMIT_DISPLAY_NAME)
|
||||
button.connect("clicked", self._show_umit_credits)
|
||||
entry.hbox.pack_start(button, False, True, 0)
|
||||
|
||||
@@ -219,17 +219,18 @@ def run():
|
||||
message_format=_(
|
||||
"Error creating the per-user configuration directory"),
|
||||
secondary_text=_("""\
|
||||
There was an error creating the directory %s or one of the files in it. \
|
||||
The directory is created by copying the contents of %s. \
|
||||
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 %(configdir)s. \
|
||||
The specific error was
|
||||
|
||||
%s
|
||||
%(error)s
|
||||
|
||||
%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.""") % (
|
||||
repr(Path.user_config_dir), repr(Path.config_dir),
|
||||
repr(str(e)), APP_DISPLAY_NAME
|
||||
)
|
||||
%(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.""") % {
|
||||
dirname = repr(Path.user_config_dir),
|
||||
configdir = repr(Path.config_dir),
|
||||
error = repr(str(e)), zenmap = APP_DISPLAY_NAME
|
||||
}
|
||||
)
|
||||
error_dialog.run()
|
||||
error_dialog.destroy()
|
||||
@@ -245,13 +246,14 @@ scan profiles. Check for access to the directory and try again.""") % (
|
||||
error_dialog = HIGAlertDialog(
|
||||
message_format=_("Error parsing the configuration file"),
|
||||
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
|
||||
|
||||
%s
|
||||
%(error)s
|
||||
|
||||
%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)
|
||||
%(zenmap)s can continue without this file but any information in it will be ignored \
|
||||
until it is repaired.""") % {
|
||||
filename = Path.user_config_file, error = str(e), zenmap = APP_DISPLAY_NAME}
|
||||
)
|
||||
error_dialog.run()
|
||||
error_dialog.destroy()
|
||||
@@ -260,11 +262,11 @@ until it is repaired.""") % (Path.user_config_file, str(e), APP_DISPLAY_NAME)
|
||||
type=Gtk.MessageType.QUESTION,
|
||||
message_format=_("Restore default configuration?"),
|
||||
secondary_text=_("""\
|
||||
To avoid further errors parsing the configuration file %s, \
|
||||
you can copy the default configuration from %s.
|
||||
To avoid further errors parsing the configuration file %(filename)s, \
|
||||
you can copy the default configuration from %(dirname)s.
|
||||
|
||||
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.set_default_response(Gtk.ResponseType.CANCEL)
|
||||
@@ -318,10 +320,10 @@ Do this now? \
|
||||
|
||||
class NonRootWarning (HIGAlertDialog):
|
||||
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.''') % (
|
||||
APP_DISPLAY_NAME, NMAP_DISPLAY_NAME)
|
||||
Some %(nmap)s options need root privileges to work.''') % {
|
||||
zenmap = APP_DISPLAY_NAME, nmap = NMAP_DISPLAY_NAME}
|
||||
|
||||
HIGAlertDialog.__init__(self, message_format=_('Non-root user'),
|
||||
secondary_text=warning_text)
|
||||
|
||||
@@ -205,9 +205,9 @@ class ScanChooser(HIGVBox):
|
||||
alert = HIGAlertDialog(
|
||||
message_format='<b>%s</b>' % _(
|
||||
'Cannot open selected file'),
|
||||
secondary_text=_("""\
|
||||
This error occurred while trying to open the file:
|
||||
%s""") % str(e))
|
||||
secondary_text=_(
|
||||
"This error occurred while trying to open the file:\n%s"
|
||||
) % str(e))
|
||||
alert.run()
|
||||
alert.destroy()
|
||||
return False
|
||||
|
||||
@@ -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"),
|
||||
# newline before path to help avoid weird line wrapping
|
||||
secondary_text=_(
|
||||
'An error occurred when saving to\n%s'
|
||||
'\nThe error was: %s.'
|
||||
) % (Path.user_config_file, config_parser.failed))
|
||||
'An error occurred when saving to\n%(configfile)s'
|
||||
'\nThe error was: %(error)s.'
|
||||
) % {
|
||||
configfile = Path.user_config_file,
|
||||
error = config_parser.failed
|
||||
})
|
||||
alert.run()
|
||||
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,
|
||||
message_format=_("Can't find documentation files"),
|
||||
secondary_text=_("""\
|
||||
There was an error loading the documentation file %s (%s). See the \
|
||||
online documentation at %s.\
|
||||
""") % (doc_path, str(e), APP_DOCUMENTATION_SITE))
|
||||
There was an error loading the documentation file %(helpfile)s (%(error)s). See the \
|
||||
online documentation at %(url)s.\
|
||||
""") % {
|
||||
helpfile = doc_path, error = str(e), url = APP_DOCUMENTATION_SITE})
|
||||
d.run()
|
||||
d.destroy()
|
||||
|
||||
|
||||
@@ -684,9 +684,11 @@ class ScanInterface(HIGVBox):
|
||||
self.host_view_selection.select_iter(
|
||||
self.scan_result.scan_host_view.host_list.get_iter_first())
|
||||
|
||||
self.filter_bar.set_information_text(_("%d/%d hosts shown") %
|
||||
(len(self.inventory.get_hosts_up()),
|
||||
len(NetworkInventory.get_hosts_up(self.inventory))))
|
||||
self.filter_bar.set_information_text(
|
||||
_("%(num_shown)d/%(total)d hosts shown") % {
|
||||
num_shown = len(self.inventory.get_hosts_up()),
|
||||
total = len(NetworkInventory.get_hosts_up(self.inventory))
|
||||
})
|
||||
|
||||
mode = self.scan_result.scan_host_view.mode
|
||||
if mode == ScanHostsView.HOST_MODE:
|
||||
|
||||
@@ -397,7 +397,7 @@ class HostOpenPorts(HIGVBox):
|
||||
p["host"].get_hostname(),
|
||||
int(p.get('portid', "0")),
|
||||
p.get('protocol', ""),
|
||||
p.get('port_state', _("unknown")),
|
||||
p.get('port_state', "unknown"),
|
||||
get_version_string(p)
|
||||
]
|
||||
)
|
||||
|
||||
@@ -139,8 +139,8 @@ class TopologyPage(HIGVBox):
|
||||
|
||||
self.slow_label.set_text(_("""\
|
||||
Topology is disabled because too many hosts can cause it
|
||||
to run slowly. The limit is %d hosts and there are %d.\
|
||||
""" % (SLOW_LIMIT, len(hosts_up))))
|
||||
to run slowly. The limit is %(limit)d hosts and there are %(num)d.\
|
||||
""" % {limit = SLOW_LIMIT, num = len(hosts_up)}))
|
||||
|
||||
if len(hosts_up) <= SLOW_LIMIT:
|
||||
self.radialnet.show()
|
||||
|
||||
Reference in New Issue
Block a user