From d408d372d2e1f378f52f52a46ec2f2089f46ced2 Mon Sep 17 00:00:00 2001 From: Sergey Cherevko Date: Thu, 24 Aug 2023 15:27:46 +0300 Subject: [PATCH] Fixed text in python files for translation --- applet.py | 43 ++++++++++----- authconn.py | 13 +++-- jobviewer.py | 116 ++++++++++++++++++++++++++------------- newprinter.py | 66 ++++++++++++---------- ppdsloader.py | 7 ++- printerproperties.py | 61 +++++++++++--------- pysmb.py | 24 +++++--- system-config-printer.py | 8 ++- 8 files changed, 214 insertions(+), 124 deletions(-) diff --git a/applet.py b/applet.py index 704249e..832ee6c 100644 --- a/applet.py +++ b/applet.py @@ -55,6 +55,21 @@ from gi.repository import Notify APPDIR="/usr/share/system-config-printer" ICON="printer" +# MSVSphere +TEXT_missing_drv = _("Missing printer driver") +TEXT_no_drv_for = _("No printer driver for %s.") +TEXT_no_drv = _("No driver for this printer.") +TEXT_search = _("Search") +TEXT_printer_added = _("Printer added") +TEXT_install_drv = _("Install printer driver") +TEXT_reg_drv_inst = _("`%s' requires driver installation: %s.") +TEXT_is_ready = _("`%s' is ready for printing.") +TEXT_test_page = _("Print Test Page") +TEXT_configure = _("Configure") +TEXT_has_been_added = _("`%s' has been added, using the `%s' driver.") +TEXT_find_drv = _("Find driver") + + # We need to call Notify.init before we can check the server for caps Notify.init('System Config Printer Notification') @@ -119,21 +134,21 @@ class NewPrinterNotification(dbus.service.Object): if name.find("/") >= 0: # name is a URI, no queue was generated, because no suitable # driver was found - title = _("Missing printer driver") + title = TEXT_missing_drv devid = "MFG:%s;MDL:%s;DES:%s;CMD:%s;" % (mfg, mdl, des, cmd) if (mfg and mdl) or des: if (mfg and mdl): device = "%s %s" % (mfg, mdl) else: device = des - text = _("No printer driver for %s.") % device + text = TEXT_no_drv_for % device else: - text = _("No driver for this printer.") + text = TEXT_no_drv n = Notify.Notification.new (title, text, 'printer') if "actions" in Notify.get_server_caps(): n.set_urgency (Notify.Urgency.CRITICAL) n.set_timeout (Notify.EXPIRES_NEVER) - n.add_action ("setup-printer", _("Search"), + n.add_action ("setup-printer", TEXT_search, lambda x, y: self.setup_printer (x, y, name, devid)) else: @@ -170,14 +185,14 @@ class NewPrinterNotification(dbus.service.Object): (make, model) = ppdMakeModelSplit (printer['printer-make-and-model']) driver = make + " " + model if status < self.STATUS_GENERIC_DRIVER: - title = _("Printer added") + title = TEXT_printer_added else: - title = _("Missing printer driver") + title = TEXT_missing_drv if len (missing_pkgs) > 0: pkgs = reduce (lambda x,y: x + ", " + y, missing_pkgs) - title = _("Install printer driver") - text = (_("`%s' requires driver installation: %s.") % + title = TEXT_install_drv + text = ( TEXT_reg_drv_inst % (name, pkgs)) n = Notify.Notification.new (title, text, 'printer') import installpackage @@ -201,26 +216,26 @@ class NewPrinterNotification(dbus.service.Object): elif status == self.STATUS_SUCCESS: devid = "MFG:%s;MDL:%s;DES:%s;CMD:%s;" % (mfg, mdl, des, cmd) - text = _("`%s' is ready for printing.") % name + text = TEXT_is_ready % name n = Notify.Notification.new (title, text, 'printer') if "actions" in Notify.get_server_caps(): n.set_urgency (Notify.Urgency.NORMAL) - n.add_action ("test-page", _("Print test page"), + n.add_action ("test-page", TEXT_test_page, lambda x, y: self.print_test_page (x, y, name)) - n.add_action ("configure", _("Configure"), + n.add_action ("configure", TEXT_configure, lambda x, y: self.configure (x, y, name)) else: # Model mismatch devid = "MFG:%s;MDL:%s;DES:%s;CMD:%s;" % (mfg, mdl, des, cmd) - text = (_("`%s' has been added, using the `%s' driver.") % + text = ( TEXT_has_been_added % (name, driver)) n = Notify.Notification.new (title, text, 'printer') if "actions" in Notify.get_server_caps(): n.set_urgency (Notify.Urgency.CRITICAL) - n.add_action ("test-page", _("Print test page"), + n.add_action ("test-page", TEXT_test_page, lambda x, y: self.print_test_page (x, y, name, devid)) - n.add_action ("find-driver", _("Find driver"), + n.add_action ("find-driver", TEXT_find_drv, lambda x, y: self.find_driver (x, y, name, devid)) n.set_timeout (Notify.EXPIRES_NEVER) diff --git a/authconn.py b/authconn.py index 37ff2fc..771c8a2 100644 --- a/authconn.py +++ b/authconn.py @@ -34,11 +34,16 @@ import gettext gettext.install(domain=config.PACKAGE, localedir=config.localedir) N_ = lambda x: x +TEXT_user = _("Username:") +TEXT_domain = _("Domain:") +TEXT_password = _("Password:") +TEXT_auth = _("Authentication") + cups.require("1.9.60") class AuthDialog(Gtk.Dialog): - AUTH_FIELD={'username': N_("Username:"), - 'password': N_("Password:"), - 'domain': N_("Domain:")} + AUTH_FIELD={'username': N_(TEXT_user), + 'password': N_(TEXT_password), + 'domain': N_(TEXT_domain)} def __init__ (self, title=None, parent=None, flags=Gtk.DialogFlags.MODAL, @@ -47,7 +52,7 @@ class AuthDialog(Gtk.Dialog): auth_info_required=None, allow_remember=False): if title is None: - title = _("Authentication") + title = TEXT_auth if auth_info_required is None: auth_info_required = ['username', 'password'] Gtk.Dialog.__init__ (self, title, parent, flags, buttons) diff --git a/jobviewer.py b/jobviewer.py index 5376a7e..ac8a5f3 100644 --- a/jobviewer.py +++ b/jobviewer.py @@ -70,6 +70,46 @@ ICON="printer" ICON_SIZE=22 SEARCHING_ICON="document-print-preview" +# MSVSphere +TEXT_my_jobs_on = _("my jobs on %s") +TEXT_my_jobs = _("my jobs") +TEXT_all_jobs = _("all jobs") +TEXT_doc_prn_status = _("Document Print Status (%s)") +TEXT_job = _("Job") +TEXT_user = _("User") +TEXT_doc = _("Document") +TEXT_prn = _("Printer") +TEXT_size = _("Size") +TEXT_time_subm = _("Time submitted") +TEXT_status = _("Status") +TEXT_cancel = _("_Cancel") +TEXT_del = _("_Delete") +TEXT_hold = _("_Hold") +TEXT_release = _("_Release") +TEXT_reprint = _("Re_print") +TEXT_retrieve = _("Re_trieve") +TEXT_move_to = _("_Move To") +TEXT_auth = _("_Authenticate") +TEXT_view_attr = _("_View Attributes") +TEXT_close_wnd = _("Close this window") +TEXT_del_jobs = _("Delete Jobs") +TEXT_del_jobs_ask = _("Do you really want to delete these jobs?") +TEXT_del_job = _("Delete Job") +TEXT_del_job_ask = _("Do you really want to delete this job?") +TEXT_cancel_jobs = _("Cancel Jobs") +TEXT_cancel_jobs_ask = _("Do you really want to cancel these jobs?") +TEXT_cancel_job = _("Cancel Job") +TEXT_cancel_job_ask = _("Do you really want to cancel this job?") +TEXT_keep_prn = _("Keep Printing") +TEXT_deleting = _("deleting job") +TEXT_canceling = _("canceling job") +TEXT_cancel_selected = _("Cancel selected jobs") +TEXT_delete_selected = _("Delete selected jobs") +TEXT_hold_selected = _("Hold selected jobs") +TEXT_release_selected = _("Release selected jobs") +TEXT_reprint_selected = _("Reprint selected jobs") +TEXT_retrieve_selected = _("Retrieve selected jobs") + # We need to call Notify.init before we can check the server for caps Notify.init('System Config Printer Notification') @@ -243,22 +283,22 @@ class CancelJobsOperation(GObject.GObject): self.encryption = encryption if purge_job: if len(self.jobids) > 1: - dialog_title = _("Delete Jobs") - dialog_label = _("Do you really want to delete these jobs?") + dialog_title = TEXT_del_jobs + dialog_label = TEXT_del_jobs_ask else: - dialog_title = _("Delete Job") - dialog_label = _("Do you really want to delete this job?") + dialog_title = TEXT_del_job + dialog_label = TEXT_del_job_ask else: if len(self.jobids) > 1: - dialog_title = _("Cancel Jobs") - dialog_label = _("Do you really want to cancel these jobs?") + dialog_title = TEXT_cancel_jobs + dialog_label = TEXT_cancel_jobs_ask else: - dialog_title = _("Cancel Job") - dialog_label = _("Do you really want to cancel this job?") + dialog_title = TEXT_cancel_job + dialog_label = TEXT_cancel_job_ask dialog = Gtk.Dialog (title=dialog_title, transient_for=parent, modal=True, destroy_with_parent=True) - dialog.add_buttons (_("Keep Printing"), Gtk.ResponseType.NO, + dialog.add_buttons (TEXT_keep_prn, Gtk.ResponseType.NO, dialog_title, Gtk.ResponseType.YES) dialog.set_default_response (Gtk.ResponseType.NO) dialog.set_border_width (6) @@ -325,9 +365,9 @@ class CancelJobsOperation(GObject.GObject): self.connection = connection if self.purge_job: - operation = _("deleting job") + operation = TEXT_deleting else: - operation = _("canceling job") + operation = TEXT_canceling self.connection._begin_operation (operation) self.connection.cancelJob (self.jobids[0], self.purge_job, @@ -425,25 +465,25 @@ class JobViewer (GtkGUI): job_action_group = Gtk.ActionGroup (name="JobActionGroup") job_action_group.add_actions ([ - ("cancel-job", Gtk.STOCK_CANCEL, _("_Cancel"), None, - _("Cancel selected jobs"), self.on_job_cancel_activate), - ("delete-job", Gtk.STOCK_DELETE, _("_Delete"), None, - _("Delete selected jobs"), self.on_job_delete_activate), - ("hold-job", Gtk.STOCK_MEDIA_PAUSE, _("_Hold"), None, - _("Hold selected jobs"), self.on_job_hold_activate), - ("release-job", Gtk.STOCK_MEDIA_PLAY, _("_Release"), None, - _("Release selected jobs"), self.on_job_release_activate), - ("reprint-job", Gtk.STOCK_REDO, _("Re_print"), None, - _("Reprint selected jobs"), self.on_job_reprint_activate), - ("retrieve-job", Gtk.STOCK_SAVE_AS, _("Re_trieve"), None, - _("Retrieve selected jobs"), self.on_job_retrieve_activate), - ("move-job", None, _("_Move To"), None, None, None), - ("authenticate-job", None, _("_Authenticate"), None, None, + ("cancel-job", Gtk.STOCK_CANCEL, TEXT_cancel, None, + TEXT_cancel_selected, self.on_job_cancel_activate), + ("delete-job", Gtk.STOCK_DELETE, TEXT_del, None, + TEXT_delete_selected, self.on_job_delete_activate), + ("hold-job", Gtk.STOCK_MEDIA_PAUSE, TEXT_hold, None, + TEXT_hold_selected, self.on_job_hold_activate), + ("release-job", Gtk.STOCK_MEDIA_PLAY, TEXT_release, None, + TEXT_release_selected, self.on_job_release_activate), + ("reprint-job", Gtk.STOCK_REDO, TEXT_reprint, None, + TEXT_reprint_selected, self.on_job_reprint_activate), + ("retrieve-job", Gtk.STOCK_SAVE_AS, TEXT_retrieve, None, + TEXT_retrieve_selected, self.on_job_retrieve_activate), + ("move-job", None, TEXT_move_to, None, None, None), + ("authenticate-job", None, TEXT_auth, None, None, self.on_job_authenticate_activate), - ("job-attributes", None, _("_View Attributes"), None, None, + ("job-attributes", None, TEXT_view_attr, None, None, self.on_job_attributes_activate), ("close", Gtk.STOCK_CLOSE, None, "w", - _("Close this window"), self.on_delete_event) + TEXT_close_wnd, self.on_delete_event) ]) self.job_ui_manager = Gtk.UIManager () self.job_ui_manager.insert_action_group (job_action_group, -1) @@ -506,11 +546,11 @@ class JobViewer (GtkGUI): self.toolbar.insert (item, -1) for skip, ellipsize, name, setter in \ - [(False, False, _("Job"), self._set_job_job_number_text), - (True, False, _("User"), self._set_job_user_text), - (False, True, _("Document"), self._set_job_document_text), - (False, True, _("Printer"), self._set_job_printer_text), - (False, False, _("Size"), self._set_job_size_text)]: + [(False, False, TEXT_job, self._set_job_job_number_text), + (True, False, TEXT_user, self._set_job_user_text), + (False, True, TEXT_doc, self._set_job_document_text), + (False, True, TEXT_prn, self._set_job_printer_text), + (False, False, TEXT_size, self._set_job_size_text)]: if applet and skip: # Skip the user column when running as applet. continue @@ -526,11 +566,11 @@ class JobViewer (GtkGUI): self.treeview.append_column(column) cell = Gtk.CellRendererText () - column = Gtk.TreeViewColumn (_("Time submitted"), cell, text=1) + column = Gtk.TreeViewColumn (TEXT_time_subm, cell, text=1) column.set_resizable (True) self.treeview.append_column (column) - column = Gtk.TreeViewColumn (_("Status")) + column = Gtk.TreeViewColumn (TEXT_status) icon = Gtk.CellRendererPixbuf () column.pack_start (icon, False) text = Gtk.CellRendererText () @@ -560,15 +600,15 @@ class JobViewer (GtkGUI): if my_jobs: if specific_dests: - title = _("my jobs on %s") % the_dests + title = TEXT_my_jobs_on % the_dests else: - title = _("my jobs") + title = TEXT_my_jobs else: if specific_dests: title = "%s" % the_dests else: - title = _("all jobs") - self.JobsWindow.set_title (_("Document Print Status (%s)") % title) + title = TEXT_all_jobs + self.JobsWindow.set_title (TEXT_doc_prn_status % title) if parent: self.JobsWindow.set_transient_for (parent) diff --git a/newprinter.py b/newprinter.py index eee8b55..b476323 100644 --- a/newprinter.py +++ b/newprinter.py @@ -72,6 +72,25 @@ HTTPS_TIMEOUT = 15.0 TEXT_adjust_firewall = _("The firewall may need adjusting in order to " "detect network printers. Adjust the " "firewall now?") +# MSVSphere +TEXT_adjust_firewall_header = _("Adjust Firewall") +TEXT_adjust_firewall_NO_button = _("Do It Later") +TEXT_adjust_firewall_YES_button = _("Adjust Firewall") +TEXT_secondary_text_IPP = _("Allow all incoming IPP Browse packets") +TEXT_secondary_text_mDNS = _("Allow all incoming mDNS traffic") +TEXT_secondary_text_SMB = _("Allow all incoming SMB/CIFS browse packets") +TEXT_show_info_dialog_header = _("No Print Shares") +TEXT_show_info_dialog_body = _("There were no print shares found. " + "Please check that the Samba service is " + "marked as trusted in your firewall " + "configuration.") +TEXT_searching = _("Searching") +TEXT_searching_for_drivers = _("Searching for drivers") +TEXT_share_verified = _("Print Share Verified") +TEXT_share_verified_text = _("This print share is accessible.") +TEXT_share_inaccessible = _("Print Share Inaccessible") +TEXT_share_inaccessible_text = _("This print share is not accessible.") +TEXT_no_printer_was_found_at = _("No printer was found at that address.") def validDeviceURI (uri): """Returns True is the provided URI is valid.""" @@ -1666,7 +1685,7 @@ class NewPrinterGUI(GtkGUI): self.searchedfordriverpackages = True self._searchdialog_canceled = False - fmt = _("Searching") + fmt = TEXT_searching self._searchdialog = Gtk.MessageDialog ( parent=self.NewPrinterWindow, modal=True, @@ -1675,8 +1694,7 @@ class NewPrinterGUI(GtkGUI): buttons=Gtk.ButtonsType.CANCEL, text=fmt) - self._searchdialog.format_secondary_text ( - _("Searching for drivers")) + self._searchdialog.format_secondary_text (TEXT_searching_for_drivers) self.opreq = OpenPrintingRequest () self._searchdialog.connect ( @@ -2266,13 +2284,10 @@ class NewPrinterGUI(GtkGUI): secondary_text = TEXT_adjust_firewall + "\n\n" if not ipp_allowed: - secondary_text += ("- " + - _("Allow all incoming IPP Browse packets") + - "\n") + secondary_text += "- " + TEXT_secondary_text_IPP + "\n" f.add_service (firewallsettings.IPP_CLIENT_SERVICE) if not mdns_allowed: - secondary_text += ("- " + - _("Allow all incoming mDNS traffic") + "\n") + secondary_text += "- " + TEXT_secondary_text_mDNS + "\n" f.add_service (firewallsettings.MDNS_SERVICE) if not allowed: @@ -2282,10 +2297,10 @@ class NewPrinterGUI(GtkGUI): modal=True, destroy_with_parent=True, message_type=Gtk.MessageType.QUESTION, buttons=Gtk.ButtonsType.NONE, - text= _("Adjust Firewall")) + text= TEXT_adjust_firewall_header) dialog.format_secondary_markup (secondary_text) - dialog.add_buttons (_("Do It Later"), Gtk.ResponseType.NO, - _("Adjust Firewall"), Gtk.ResponseType.YES) + dialog.add_buttons (TEXT_adjust_firewall_NO_button, Gtk.ResponseType.NO, + TEXT_adjust_firewall_YES_button, Gtk.ResponseType.YES) dialog.connect ('response', self.adjust_firewall_response) dialog.show () except (dbus.DBusException, Exception): @@ -2571,11 +2586,7 @@ class NewPrinterGUI(GtkGUI): if store.get_iter_first () is None: self.SMBBrowseDialog.hide () - show_info_dialog (_("No Print Shares"), - _("There were no print shares found. " - "Please check that the Samba service is " - "marked as trusted in your firewall " - "configuration."), + show_info_dialog (TEXT_show_info_dialog_header, TEXT_show_info_dialog_body, parent=self.NewPrinterWindow) def smb_select_function (self, selection, model, path, path_selected, data): @@ -2770,13 +2781,11 @@ class NewPrinterGUI(GtkGUI): modal=True, destroy_with_parent=True, message_type=Gtk.MessageType.QUESTION, buttons=Gtk.ButtonsType.NONE, - text=_("Adjust Firewall")) - secondary_text += ("- " + - _("Allow all incoming SMB/CIFS " - "browse packets")) + text=TEXT_adjust_firewall_header) + secondary_text += "- " + TEXT_secondary_text_SMB dialog.format_secondary_markup (secondary_text) - dialog.add_buttons (_("Do It Later"), Gtk.ResponseType.NO, - _("Adjust Firewall"), Gtk.ResponseType.YES) + dialog.add_buttons (TEXT_adjust_firewall_NO_button, Gtk.ResponseType.NO, + TEXT_adjust_firewall_YES_button, Gtk.ResponseType.YES) response = dialog.run () dialog.destroy () @@ -2893,16 +2902,16 @@ class NewPrinterGUI(GtkGUI): ready (self.NewPrinterWindow) if accessible: - show_info_dialog (_("Print Share Verified"), - _("This print share is accessible."), + show_info_dialog (TEXT_share_verified, + TEXT_share_verified_text, parent=self.NewPrinterWindow) return if not canceled: - text = _("This print share is not accessible.") + text = TEXT_share_inaccessible_text if reason: text = reason - show_error_dialog (_("Print Share Inaccessible"), text, + show_error_dialog (TEXT_share_inaccessible, text, parent=self.NewPrinterWindow) def entry_changed(self, entry, allowed_chars): @@ -3509,10 +3518,7 @@ class NewPrinterGUI(GtkGUI): self.entNPTNetworkHostname.set_sensitive (True) self.btnNetworkFind.set_sensitive (True) if self.network_found == 0: - self.lblNetworkFindNotFound.set_markup ('' + - _("No printer was " - "found at that " - "address.") + '') + self.lblNetworkFindNotFound.set_markup ('' + TEXT_no_printer_was_found_at + '') self.lblNetworkFindNotFound.show () Gdk.threads_leave () diff --git a/ppdsloader.py b/ppdsloader.py index 7be92ee..d56a2b7 100644 --- a/ppdsloader.py +++ b/ppdsloader.py @@ -33,6 +33,9 @@ import config import gettext gettext.install(domain=config.PACKAGE, localedir=config.localedir) +TEXT_searching = _("Searching") +TEXT_searching_for_drivers = _("Searching for drivers") + class PPDsLoader(GObject.GObject): """ 1. If PackageKit support is available, and this is a local server, @@ -83,14 +86,14 @@ class PPDsLoader(GObject.GObject): debugprint ("Failed to get session bus") self._bus = None - fmt = _("Searching") + fmt = TEXT_searching self._dialog = Gtk.MessageDialog (parent=parent, modal=True, destroy_with_parent=True, message_type=Gtk.MessageType.INFO, buttons=Gtk.ButtonsType.CANCEL, text=fmt) - self._dialog.format_secondary_text (_("Searching for drivers")) + self._dialog.format_secondary_text (TEXT_searching_for_drivers) self._dialog.connect ("response", self._dialog_response) diff --git a/printerproperties.py b/printerproperties.py index ca43c25..7becd6f 100755 --- a/printerproperties.py +++ b/printerproperties.py @@ -49,6 +49,25 @@ from newprinter import busy, ready import ppdippstr pkgdata = config.pkgdatadir +# MSVSphere +TEXT_inst_opts = _("Installable Options") +TEXT_prn_opts = _("Printer Options") +TEXT_submitted = _("Submitted") +TEXT_test_page_submitted = _("Test page submitted as job %d") +TEXT_maintenance_cmd_submitted = _("Maintenance command submitted as job %d") +TEXT_not_possible = _("Not possible") +TEXT_remote_srv_not_accept = _("The remote server did not accept " + "the print job, most likely " + "because the printer is not " + "shared.") +TEXT_raw_queue = _("Raw Queue") +TEXT_unable_get_queue = _("Unable to get queue details. Treating queue " + "as raw.") +TEXT_error = _("Error") +TEXT_ppd_file_damaged = _("The PPD file for this queue " + "is damaged.") +TEXT_problem_connect = _("There was a problem connecting to " + "the CUPS server.") def CUPS_server_hostname (): host = cups.getServer () @@ -954,8 +973,8 @@ class PrinterPropertiesDialog(GtkGUI): optionsbold = True else: self.btnConflict.hide() - installabletext = _("Installable Options") - optionstext = _("Printer Options") + installabletext = TEXT_inst_opts + optionstext = TEXT_prn_opts if installablebold: installabletext = "%s" % installabletext if optionsbold: @@ -1200,11 +1219,8 @@ class PrinterPropertiesDialog(GtkGUI): if (e == cups.IPP_NOT_AUTHORIZED and self._host != 'localhost' and self._host[0] != '/'): - show_error_dialog (_("Not possible"), - _("The remote server did not accept " - "the print job, most likely " - "because the printer is not " - "shared."), + show_error_dialog (TEXT_not_possible, + TEXT_remote_srv_not_accept, self.parent) else: show_IPP_Error(e, msg, self.parent) @@ -1213,8 +1229,8 @@ class PrinterPropertiesDialog(GtkGUI): cups.setUser (user) if job_id is not None: - show_info_dialog (_("Submitted"), - _("Test page submitted as job %d") % job_id, + show_info_dialog (TEXT_submitted, + TEXT_test_page_submitted % job_id, parent=self.parent) def maintenance_command (self, command): @@ -1233,19 +1249,15 @@ class PrinterPropertiesDialog(GtkGUI): format=format, file=tmpfile.name, user=cups.getUser ()) - show_info_dialog (_("Submitted"), - _("Maintenance command submitted as " - "job %d") % job_id, + show_info_dialog (TEXT_submitted, + TEXT_maintenance_cmd_submitted % job_id, parent=self.parent) except cups.IPPError as e: (e, msg) = e.args if (e == cups.IPP_NOT_AUTHORIZED and self.printer.name != 'localhost'): - show_error_dialog (_("Not possible"), - _("The remote server did not accept " - "the print job, most likely " - "because the printer is not " - "shared."), + show_error_dialog (TEXT_not_possible, + TEXT_remote_srv_not_accept, self.parent) else: show_IPP_Error(e, msg, self.parent) @@ -1315,9 +1327,8 @@ class PrinterPropertiesDialog(GtkGUI): if e in [cups.IPP_SERVICE_UNAVAILABLE, cups.IPP_INTERNAL_ERROR]: - show_dialog(_("Raw Queue"), - _("Unable to get queue details. Treating queue " - "as raw."), + show_dialog(TEXT_raw_queue, + TEXT_unable_get_queue, Gtk.MessageType.ERROR, self.parent) @@ -1328,14 +1339,12 @@ class PrinterPropertiesDialog(GtkGUI): # NULL without setting an IPP error (so it'll be something # like a failed connection), or the PPD could not be parsed. if str (e).startswith ("ppd"): - show_error_dialog (_("Error"), - _("The PPD file for this queue " - "is damaged."), + show_error_dialog (TEXT_error, + TEXT_ppd_file_damaged, self.parent) else: - show_error_dialog (_("Error"), - _("There was a problem connecting to " - "the CUPS server."), + show_error_dialog (TEXT_error, + TEXT_problem_connect, self.parent) raise diff --git a/pysmb.py b/pysmb.py index b9afe62..d373dd3 100644 --- a/pysmb.py +++ b/pysmb.py @@ -31,6 +31,14 @@ import pwd import smbc from debug import * +TEXT_not_authorized = _("Not authorized") +TEXT_password_incorrect = _("The password may be incorrect.") +TEXT_autch = _("Authentication") +TEXT_autch_header = _("You must log in to access %s.") +TEXT_user = _("Username:") +TEXT_domain = _("Domain:") +TEXT_password = _("Password:") + class _None(RuntimeError): pass @@ -87,15 +95,15 @@ class AuthContext: modal=True, destroy_with_parent=True, message_type=Gtk.MessageType.ERROR, buttons=Gtk.ButtonsType.CLOSE) - d.set_title (_("Not authorized")) + d.set_title (TEXT_not_authorized) d.set_markup ('' + - _("Not authorized") + '\n\n' + - _("The password may be incorrect.")) + TEXT_not_authorized + '\n\n' + + TEXT_password_incorrect) d.run () d.destroy () # After that, prompt - d = Gtk.Dialog (title=_("Authentication"), + d = Gtk.Dialog (title=TEXT_autch, transient_for=self.parent, modal=True) d.add_buttons (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, @@ -111,7 +119,7 @@ class AuthContext: hbox.pack_start (image, False, False, 0) vbox = Gtk.VBox (False, 12) label = Gtk.Label(label='' + - _("You must log in to access %s.") + TEXT_autch_header % self.for_server + '') label.set_use_markup (True) @@ -122,13 +130,13 @@ class AuthContext: grid = Gtk.Grid() grid.set_row_spacing (6) grid.set_column_spacing (6) - grid.attach (Gtk.Label(label=_("Username:")), 0, 0, 1, 1) + grid.attach (Gtk.Label(label=TEXT_user), 0, 0, 1, 1) username_entry = Gtk.Entry () grid.attach (username_entry, 1, 0, 1, 1) - grid.attach (Gtk.Label(label=_("Domain:")), 0, 1, 1, 1) + grid.attach (Gtk.Label(label=TEXT_domain), 0, 1, 1, 1) domain_entry = Gtk.Entry () grid.attach (domain_entry, 1, 1, 1, 1) - grid.attach (Gtk.Label(label=_("Password:")), 0, 2, 1, 1) + grid.attach (Gtk.Label(label=TEXT_password), 0, 2, 1, 1) password_entry = Gtk.Entry () password_entry.set_activates_default (True) password_entry.set_visibility (False) diff --git a/system-config-printer.py b/system-config-printer.py index c9689de..46e9141 100755 --- a/system-config-printer.py +++ b/system-config-printer.py @@ -114,6 +114,10 @@ sys.path.append (pkgdata) PlugWindow = None PlugWindowId = None +# MSVSphere +TEXT_test_page = _("Print Test Page") +TEXT_test_page_ask = _("Would you like to print a test page?") + #set program name GLib.set_prgname("system-config-printer") @@ -2045,9 +2049,9 @@ class GUI(GtkGUI): modal=True, destroy_with_parent=True, message_type=Gtk.MessageType.QUESTION, buttons=Gtk.ButtonsType.NONE, - text=_("Would you like to print a test page?")) + text=TEXT_test_page_ask) q.add_buttons (Gtk.STOCK_CANCEL, Gtk.ResponseType.NO, - _("Print Test Page"), Gtk.ResponseType.YES) + TEXT_test_page, Gtk.ResponseType.YES) response = q.run () q.destroy () if response == Gtk.ResponseType.YES: -- 2.39.2