Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pr/115'
Browse files Browse the repository at this point in the history
* origin/pr/115:
  Improve language
  • Loading branch information
marmarek committed Nov 1, 2021
2 parents b408de6 + ca1bc35 commit ff9272a
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 53 deletions.
33 changes: 16 additions & 17 deletions qui/clipboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,18 @@ def _copy(self, vmname: str = None):

size = clipboard_formatted_size()

body = _("Qubes Clipboard fetched from qube: <b>'{0}'</b>\n"
"Copied <b>{1}</b> to the clipboard.\n"
"<small>Press Ctrl-Shift-v to copy this clipboard into "
"destination qube's clipboard.</small>").format(vmname, size)
body = _("Clipboard contents fetched from qube: <b>'{0}'</b>\n"
"Copied <b>{1}</b> to the global clipboard.\n"
"<small>Press Ctrl+Shift+V in qube to paste to local"
"clipboard.</small>").format(vmname, size)

self.gtk_app.update_clipboard_contents(vmname, size, message=body)

def _paste(self):
''' Sends Paste notification via Gio.Notification.
'''
body = _("Qubes Clipboard has been copied to the qube and wiped.<i/>\n"
"<small>Trigger a paste operation (e.g. Ctrl-v) to insert "
"it into an application.</small>")
body = _("Global clipboard contents copied to qube and wiped.<i/>\n"
"<small>Paste normally in qube (e.g. Ctrl+V).</small>")
self.gtk_app.update_clipboard_contents(message=body)

def process_IN_CLOSE_WRITE(self, _unused):
Expand Down Expand Up @@ -137,8 +136,8 @@ def __init__(self, wm, **properties):
self.icon = Gtk.StatusIcon()
self.icon.set_from_icon_name('edit-copy')
self.icon.set_tooltip_markup(
_('<b>Qubes Clipboard</b>\nInformation about current'
' state of Qubes Clipboard.'))
_('<b>Global Clipboard</b>\nInformation about the current'
' state of the global clipboard.'))
self.icon.connect('button-press-event', self.show_menu)

self.menu = Gtk.Menu()
Expand Down Expand Up @@ -175,13 +174,13 @@ def show_menu(self, _unused, event):
def update_clipboard_contents(self, vm=None, size=0, message=None):
if not vm or not size:
self.clipboard_label.set_markup(_(
"<i>Qubes clipboard is empty</i>"))
"<i>Global clipboard is empty</i>"))
self.icon.set_from_icon_name("edit-copy")
# todo the icon should be empty and full depending on state

else:
self.clipboard_label.set_markup(
_("<i>Qubes clipboard contents: {0} from "
_("<i>Global clipboard contents: {0} from "
"<b>{1}</b></i>").format(size, vm))
self.icon.set_from_icon_name("edit-copy")

Expand All @@ -207,7 +206,7 @@ def prepare_menu(self):
self.menu.append(Gtk.SeparatorMenuItem())

help_label = Gtk.Label(xalign=0)
help_label.set_markup(_("<i>Use <b>Ctrl+Shift+C</b> to copy, "
help_label.set_markup(_("<i>Use <b>Ctrl+Shift+C</b> to copy and "
"<b>Ctrl+Shift+V</b> to paste.</i>"))
help_item = Gtk.MenuItem()
help_item.set_margin_left(10)
Expand All @@ -226,18 +225,18 @@ def copy_dom0_clipboard(self, *_args, **_kwargs):
text = clipboard.wait_for_text()

if not text:
self.send_notify(_("dom0 clipboard is empty!"))
self.send_notify(_("Dom0 clipboard is empty!"))
return

try:
fd = os.open(APPVIEWER_LOCK, os.O_RDWR | os.O_CREAT, 0o0666)
except Exception: # pylint: disable=broad-except
self.send_notify(_("Error while accessing Qubes clipboard!"))
self.send_notify(_("Error while accessing global clipboard!"))
else:
try:
fcntl.flock(fd, fcntl.LOCK_EX)
except Exception: # pylint: disable=broad-except
self.send_notify(_("Error while locking Qubes clipboard!"))
self.send_notify(_("Error while locking global clipboard!"))
os.close(fd)
else:
try:
Expand All @@ -249,13 +248,13 @@ def copy_dom0_clipboard(self, *_args, **_kwargs):
timestamp.write(str(Gtk.get_current_event_time()))
except Exception as ex: # pylint: disable=broad-except
self.send_notify(_("Error while writing to "
"Qubes clipboard!\n{0}").format(str(ex)))
"global clipboard!\n{0}").format(str(ex)))
fcntl.flock(fd, fcntl.LOCK_UN)
os.close(fd)

def send_notify(self, body):
# pylint: disable=attribute-defined-outside-init
notification = Gio.Notification.new(_("Qubes Clipboard"))
notification = Gio.Notification.new(_("Global Clipboard"))
notification.set_body(body)
notification.set_priority(Gio.NotificationPriority.NORMAL)
self.send_notification(self.get_application_id(), notification)
Expand Down
6 changes: 3 additions & 3 deletions qui/tray/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def device_list_update(self, vm, _event, **_kwargs):
self.devices[str(dev)] = dev
self.emit_notification(
_("Device available"),
_("Device {} is available").format(dev.description),
_("Device {} is available.").format(dev.description),
Gio.NotificationPriority.NORMAL,
notification_id=(dev.backend_domain +
dev.ident))
Expand All @@ -287,7 +287,7 @@ def device_list_update(self, vm, _event, **_kwargs):
for dev_name in dev_to_remove:
self.emit_notification(
_("Device removed"),
_("Device {} is removed").format(
_("Device {} has been removed.").format(
self.devices[dev_name].description),
Gio.NotificationPriority.NORMAL,
notification_id=(self.devices[dev_name].backend_domain +
Expand Down Expand Up @@ -454,7 +454,7 @@ def main():
None, 0, Gtk.MessageType.ERROR, Gtk.ButtonsType.OK)
dialog.set_title(_("Houston, we have a problem..."))
dialog.set_markup(_(
"<b>Whoops. A critical error in Domains Widget has occured.</b>"
"<b>Whoops. A critical error in Qubes Domains has occurred.</b>"
" This is most likely a bug in the widget. To restart the "
"widget, run 'qui-domains' in dom0."))
dialog.format_secondary_markup(
Expand Down
45 changes: 23 additions & 22 deletions qui/tray/domains.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ def perform_pause(self, *_args, **_kwargs):
self.vm.pause()
except exc.QubesException as ex:
show_error(_("Error pausing qube"),
_("The following error occurred on an "
"attempt to pause qube {0}:\n{1}").format(
_("The following error occurred while "
"attempting to pause qube {0}:\n{1}").format(
self.vm.name, str(ex)))


Expand All @@ -114,7 +114,7 @@ def perform_unpause(self, *_args, **_kwargs):
self.vm.unpause()
except exc.QubesException as ex:
show_error(_("Error unpausing qube"),
_("The following error occurred on an attempt "
_("The following error occurred while attempting "
"to unpause qube {0}:\n{1}").format(
self.vm.name, str(ex)))

Expand All @@ -139,8 +139,8 @@ def perform_shutdown(self, *_args, **_kwargs):
self.vm.shutdown()
except exc.QubesException as ex:
show_error(_("Error shutting down qube"),
_("The following error occurred on an attempt to "
"shutdown qube {0}:\n{1}").format(
_("The following error occurred while attempting to "
"shut down qube {0}:\n{1}").format(
self.vm.name, str(ex)))


Expand Down Expand Up @@ -176,7 +176,7 @@ async def perform_restart(self):
raise exc.QubesException(stderr)
except exc.QubesException as ex:
show_error(_("Error restarting qube"),
_("The following error occurred on an attempt to "
_("The following error occurred while attempting to "
"restart qube {0}:\n{1}").format(
self.vm.name, str(ex)))

Expand All @@ -200,8 +200,8 @@ def perform_kill(self, *_args, **_kwargs):
self.vm.kill()
except exc.QubesException as ex:
show_error(_("Error shutting down qube"),
_("The following error occurred on an attempt to "
"shutdown qube {0}:\n{1}").format(self.vm.name, str(ex)))
_("The following error occurred while attempting to shut"
"down qube {0}:\n{1}").format(self.vm.name, str(ex)))


class PreferencesItem(Gtk.ImageMenuItem):
Expand Down Expand Up @@ -257,13 +257,13 @@ def run_terminal(self, _item):
self.vm.run_service('qubes.StartApp+qubes-run-terminal')
except exc.QubesException as ex:
show_error(_("Error starting terminal"),
_("The following error occurred on an attempt to "
_("The following error occurred while attempting to "
"run terminal {0}:\n{1}").format(self.vm.name, str(ex)))


class OpenFileManagerItem(Gtk.ImageMenuItem):
"""Attempts to open a file manager in the VM. If failed, displayes an
error message"""
"""Attempts to open a file manager in the VM. If fails, displays an
error message."""

def __init__(self, vm, icon_cache):
super().__init__()
Expand All @@ -282,7 +282,7 @@ def open_file_manager(self, _item):
self.vm.run_service('qubes.StartApp+qubes-open-file-manager')
except exc.QubesException as ex:
show_error(_("Error opening file manager"),
_("The following error occurred on an attempt to "
_("The following error occurred while attempting to "
"open file manager {0}:\n{1}").format(
self.vm.name, str(ex)))

Expand Down Expand Up @@ -569,12 +569,12 @@ def emit_notification(self, vm, event, **kwargs):
notification.set_body(_('Qube {} has started.').format(vm.name))
elif event == 'domain-pre-shutdown':
notification.set_body(
_('Qube {} is attempting to shutdown.').format(vm.name))
_('Qube {} is attempting to shut down.').format(vm.name))
elif event == 'domain-shutdown':
notification.set_body(_('Qube {} has halted.').format(vm.name))
notification.set_body(_('Qube {} has shut down.').format(vm.name))
elif event == 'domain-shutdown-failed':
notification.set_body(
_('Qube {} has failed to shutdown: {}').format(
_('Qube {} failed to shut down: {}').format(
vm.name, kwargs['reason']))
notification.set_priority(Gio.NotificationPriority.HIGH)
notification.set_icon(
Expand All @@ -585,12 +585,13 @@ def emit_notification(self, vm, event, **kwargs):

def emit_paused_notification(self):
if not self.pause_notification_out:
notification = Gio.Notification.new(_("Your VMs have been paused!"))
notification = Gio.Notification.new(_("Your qubes have been "
"paused!"))
notification.set_body(_(
"All your VMs are currently paused. If this was an accident, "
"simply click \"Unpause All\" to un-pause them. Otherwise, "
"you can un-pause individual VMs via the Qubes Domains "
"tray menu."))
"All your qubes are currently paused. If this was an accident, "
"simply click \"Unpause All\" to unpause them. Otherwise, "
"you can unpause individual qubes via the Qubes Domains "
"tray widget."))
notification.set_icon(
Gio.ThemedIcon.new('dialog-warning'))
notification.add_button(_('Unpause All'), 'app.do-unpause-all')
Expand Down Expand Up @@ -884,8 +885,8 @@ def main():
None, 0, Gtk.MessageType.ERROR, Gtk.ButtonsType.OK)
dialog.set_title(_("Houston, we have a problem..."))
dialog.set_markup(_(
"<b>Whoops. A critical error in Domains Widget has occured.</b>"
" This is most likely a bug in the widget. The Domains Widget"
"<b>Whoops. A critical error in Qubes Domains has occurred.</b>"
" This is most likely a bug in the widget. Qubes Domains"
" will restart itself."))
exc_description = "\n<b>{}</b>: {}\n{}".format(
exc_type.__name__, exc_value, traceback.format_exc(limit=10)
Expand Down
6 changes: 3 additions & 3 deletions qui/tray/updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def run(self): # pylint: disable=arguments-differ

def setup_menu(self):
title_label = Gtk.Label(xalign=0)
title_label.set_markup(_("<b>Qube Updates Available</b>"))
title_label.set_markup(_("<b>Qube updates available</b>"))
title_menu_item = Gtk.MenuItem()
title_menu_item.add(title_label)
title_menu_item.set_sensitive(False)
Expand Down Expand Up @@ -145,7 +145,7 @@ def feature_set(self, vm, event, feature, value, **_kwargs):
self.vms_needing_update.add(vm)

notification = Gio.Notification.new(
_("New updates are available for {}").format(vm.name))
_("New updates are available for {}.").format(vm.name))
notification.set_priority(Gio.NotificationPriority.NORMAL)
self.send_notification(None, notification)
elif not value and vm in self.vms_needing_update:
Expand Down Expand Up @@ -183,7 +183,7 @@ def main():
None, 0, Gtk.MessageType.ERROR, Gtk.ButtonsType.OK)
dialog.set_title(_("Houston, we have a problem..."))
dialog.set_markup(_(
"<b>Whoops. A critical error in Updates Widget has occured.</b>"
"<b>Whoops. A critical error in Qubes Update has occurred.</b>"
" This is most likely a bug in the widget. To restart the "
"widget, run 'qui-updates' in dom0."))
dialog.format_secondary_markup(
Expand Down
8 changes: 4 additions & 4 deletions qui/updater.glade
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">False</property>
<property name="title" translatable="yes">Qubes Updater</property>
<property name="title" translatable="yes">Qubes Update</property>
<child type="titlebar">
<placeholder/>
</child>
Expand Down Expand Up @@ -56,7 +56,7 @@
<property name="valign">start</property>
<property name="margin_bottom">10</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Select templates and qubes to update:</property>
<property name="label" translatable="yes">Select qubes to update:</property>
</object>
<packing>
<property name="expand">False</property>
Expand Down Expand Up @@ -101,7 +101,7 @@
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="halign">start</property>
<property name="label" translatable="yes">No updates have been found.</property>
<property name="label" translatable="yes">No updates found.</property>
</object>
<packing>
<property name="expand">False</property>
Expand All @@ -111,7 +111,7 @@
</child>
<child>
<object class="GtkCheckButton" id="allow_update_unavailable">
<property name="label" translatable="yes">Enable updates for qubes without known available updates</property>
<property name="label" translatable="yes">Enable updates for qubes without known available updates.</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
Expand Down
8 changes: 4 additions & 4 deletions qui/updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def perform_update(self):
GObject.idle_add(row.set_status, 'failure')
GObject.idle_add(
self.append_text_view,
_("Cancelled update for {}\n").format(row.vm.name))
_("Canceled update for {}\n").format(row.vm.name))
continue

GObject.idle_add(
Expand Down Expand Up @@ -244,7 +244,7 @@ def cancel_updates(self, *_args, **_kwargs):
self.exit_triggered = True
dialog = Gtk.MessageDialog(
self.main_window, Gtk.DialogFlags.MODAL, Gtk.MessageType.OTHER,
Gtk.ButtonsType.NONE, _("Cancelling remaining updates..."))
Gtk.ButtonsType.NONE, _("Canceling remaining updates..."))
dialog.show()
while self.update_thread.is_alive():
while Gtk.events_pending():
Expand Down Expand Up @@ -313,7 +313,7 @@ def __init__(self, vm, updates_available, **properties):
'dialog-warning', 12, 0))
warn_icon.set_tooltip_text(
'This qube may have been restored from an older version of '
'Qubes and may not be able to update itself correctly. '
'Qubes OS and may not be able to update itself correctly. '
'Please check the documentation if problems occur.')
hbox.pack_start(warn_icon, False, False, 0)
except exc.QubesDaemonCommunicationError:
Expand Down Expand Up @@ -367,7 +367,7 @@ def set_status(self, status):
widget = Gtk.Image.new_from_icon_name("gtk-cancel",
Gtk.IconSize.BUTTON)
else:
raise ValueError(_("unknown status {}").format(status))
raise ValueError(_("Unknown status {}").format(status))

for child in self.progress_box.get_children():
self.progress_box.remove(child)
Expand Down

0 comments on commit ff9272a

Please sign in to comment.