[Spice-devel] [PATCH 14/14] Add strings for translation

Christophe Fergeau cfergeau at redhat.com
Mon Jan 18 02:10:31 PST 2016


On Mon, Jan 18, 2016 at 10:05:50AM +0100, Fabiano FidĂȘncio wrote:
> While doing the work to use GTask isntead of GSimpleAsyncResult I've

instead

> noticed a few error strings that were not marked to be translated.
> I am not exactly sure if it was intentional or not, but I do believe
> that our error messages should be translated.
> ---
>  po/POTFILES.in               |  6 ++++++
>  src/channel-main.c           |  4 +++-
>  src/channel-port.c           |  4 +++-
>  src/channel-usbredir.c       |  4 ++--
>  src/spice-channel.c          |  2 +-
>  src/spice-pulse.c            |  8 +++++---
>  src/usb-acl-helper.c         | 10 ++++++----
>  src/usb-device-manager.c     |  4 ++--
>  src/vmcstream.c              |  4 +++-
>  src/win-usb-driver-install.c | 16 +++++++++-------
>  10 files changed, 40 insertions(+), 22 deletions(-)
> 
> diff --git a/po/POTFILES.in b/po/POTFILES.in
> index ad12609..7c79541 100644
> --- a/po/POTFILES.in
> +++ b/po/POTFILES.in
> @@ -1,8 +1,14 @@
> +src/channel-main.c
> +src/channel-port.c
>  src/channel-usbredir.c
>  src/desktop-integration.c
>  src/spice-channel.c
>  src/spice-cmdline.c
>  src/spice-option.c
> +src/spice-pulse.c
> +src/usb-acl-helper.c
>  src/usb-device-manager.c
>  src/usb-device-widget.c
>  src/usbutil.c
> +src/vmcstream.c
> +src/win-usb-driver-install.c
> diff --git a/src/channel-main.c b/src/channel-main.c
> index 6c0f238..40d5cff 100644
> --- a/src/channel-main.c
> +++ b/src/channel-main.c
> @@ -21,6 +21,8 @@
>  #include <spice/vd_agent.h>
>  #include <glib/gstdio.h>
>  
> +#include <glib/gi18n.h>
> +
>  #include "glib-compat.h"
>  #include "spice-client.h"
>  #include "spice-common.h"
> @@ -3143,7 +3145,7 @@ void spice_main_file_copy_async(SpiceMainChannel *channel,
>                                  spice_main_file_copy_async,
>                                  SPICE_CLIENT_ERROR,
>                                  SPICE_CLIENT_ERROR_FAILED,
> -                                "The agent is not connected");
> +                                _("The agent is not connected"));
>          return;
>      }
>  
> diff --git a/src/channel-port.c b/src/channel-port.c
> index 20ee2fa..86194ab 100644
> --- a/src/channel-port.c
> +++ b/src/channel-port.c
> @@ -23,6 +23,8 @@
>  #include "spice-marshal.h"
>  #include "glib-compat.h"
>  
> +#include <glib/gi18n.h>
> +
>  /**
>   * SECTION:channel-port
>   * @short_description: private communication channel
> @@ -295,7 +297,7 @@ void spice_port_write_async(SpicePortChannel *self,
>          g_task_report_new_error(self, callback,
>              user_data, spice_port_write_async,
>              SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED,
> -            "The port is not opened");
> +            _("The port is not opened"));
>          return;
>      }
>  
> diff --git a/src/channel-usbredir.c b/src/channel-usbredir.c
> index 4ddf7bf..824bc43 100644
> --- a/src/channel-usbredir.c
> +++ b/src/channel-usbredir.c
> @@ -344,14 +344,14 @@ void spice_usbredir_channel_connect_device_async(
>      if (!priv->host) {
>          g_task_return_new_error(task,
>                              SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED,
> -                            "Error libusb context not set");
> +                            _("Error libusb context not set"));
>          goto done;
>      }
>  
>      if (priv->state != STATE_DISCONNECTED) {
>          g_task_return_new_error(task,
>                              SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED,
> -                            "Error channel is busy");
> +                            _("Error channel is busy"));
>          goto done;
>      }
>  
> diff --git a/src/spice-channel.c b/src/spice-channel.c
> index dd32818..246609a 100644
> --- a/src/spice-channel.c
> +++ b/src/spice-channel.c
> @@ -2979,7 +2979,7 @@ void spice_channel_flush_async(SpiceChannel *self, GCancellable *cancellable,
>          g_task_report_new_error(self, callback, user_data,
>              spice_channel_flush_async,
>              SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED,
> -            "The channel is not ready yet");
> +            _("The channel is not ready yet"));
>          return;
>      }
>  
> diff --git a/src/spice-pulse.c b/src/spice-pulse.c
> index 60a037c..5c3cfb7 100644
> --- a/src/spice-pulse.c
> +++ b/src/spice-pulse.c
> @@ -28,6 +28,8 @@
>  #include <pulse/pulseaudio.h>
>  #include <pulse/ext-stream-restore.h>
>  
> +#include <glib/gi18n.h>
> +
>  #define SPICE_PULSE_GET_PRIVATE(obj)                                  \
>      (G_TYPE_INSTANCE_GET_PRIVATE((obj), SPICE_TYPE_PULSE, SpicePulsePrivate))
>  
> @@ -995,7 +997,7 @@ static void complete_task(SpicePulse *pulse, struct async_task *task, const gcha
>          g_task_return_new_error(task->task,
>                                  SPICE_CLIENT_ERROR,
>                                  SPICE_CLIENT_ERROR_FAILED,
> -                                "restore-info failed due %s",
> +                                _("restore-info failed due %s"),
>                                  err_msg);
>      /* Volume-info does not change if stream is not found */
>      } else if ((task->is_playback == TRUE && p->playback.info_updated == FALSE) ||
> @@ -1004,7 +1006,7 @@ static void complete_task(SpicePulse *pulse, struct async_task *task, const gcha
>          g_task_return_new_error(task->task,
>                                  SPICE_CLIENT_ERROR,
>                                  SPICE_CLIENT_ERROR_FAILED,
> -                                "Stream not found by pulse");
> +                                _("Stream not found by pulse"));
>      } else {
>          g_task_return_boolean(task->task, TRUE);
>      }
> @@ -1241,7 +1243,7 @@ fail:
>                                  pulse_stream_restore_info_async,
>                                  SPICE_CLIENT_ERROR,
>                                  SPICE_CLIENT_ERROR_FAILED,
> -                                "Volume-Info failed: %s",
> +                                _("Volume-Info failed: %s"),
>                                  pa_strerror(pa_context_errno(p->context)));
>          free_async_task(task);
>      }
> diff --git a/src/usb-acl-helper.c b/src/usb-acl-helper.c
> index 17e2b3c..85f719f 100644
> --- a/src/usb-acl-helper.c
> +++ b/src/usb-acl-helper.c
> @@ -25,6 +25,8 @@
>  #include <stdio.h>
>  #include <string.h>
>  
> +#include <glib/gi18n.h>
> +
>  #include "usb-acl-helper.h"
>  #include "glib-compat.h"
>  
> @@ -93,7 +95,7 @@ static void async_result_set_cancelled(GTask *task)
>  {
>      g_task_return_new_error(task,
>                  G_IO_ERROR, G_IO_ERROR_CANCELLED,
> -                "Setting USB device node ACL cancelled");
> +                _("Setting USB device node ACL cancelled"));
>  }
>  
>  static gboolean cb_out_watch(GIOChannel    *channel,
> @@ -127,7 +129,7 @@ static gboolean cb_out_watch(GIOChannel    *channel,
>              } else {
>                  g_task_return_new_error(priv->task,
>                              SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED,
> -                            "Error setting USB device node ACL: '%s'",
> +                            _("Error setting USB device node ACL: '%s'"),
>                              string);
>              }
>              g_free(string);
> @@ -138,7 +140,7 @@ static gboolean cb_out_watch(GIOChannel    *channel,
>          case G_IO_STATUS_EOF:
>              g_task_return_new_error(priv->task,
>                          SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED,
> -                        "Unexpected EOF reading from acl helper stdout");
> +                        _("Unexpected EOF reading from acl helper stdout"));
>              break;
>          case G_IO_STATUS_AGAIN:
>              return TRUE; /* Wait for more input */
> @@ -208,7 +210,7 @@ void spice_usb_acl_helper_open_acl(SpiceUsbAclHelper *self,
>      if (priv->out_ch) {
>          g_task_return_new_error(task,
>                              SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED,
> -                            "Error acl-helper already has an acl open");
> +                            _("Error acl-helper already has an acl open"));
>          goto done;
>      }
>  
> diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
> index 1840177..0b6f498 100644
> --- a/src/usb-device-manager.c
> +++ b/src/usb-device-manager.c
> @@ -1422,8 +1422,8 @@ _spice_usb_device_manager_connect_device_async(SpiceUsbDeviceManager *self,
>  
>      if (spice_usb_device_manager_is_device_connected(self, device)) {
>          g_task_return_new_error(task,
> -                            SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED,
> -                            "Cannot connect an already connected usb device");
> +                          SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED,
> +                          _("Cannot connect an already connected usb device"));
>          goto done;
>      }
>  
> diff --git a/src/vmcstream.c b/src/vmcstream.c
> index d9b62a0..5a1a9e1 100644
> --- a/src/vmcstream.c
> +++ b/src/vmcstream.c
> @@ -24,6 +24,8 @@
>  #include "gio-coroutine.h"
>  #include "glib-compat.h"
>  
> +#include <glib/gi18n.h>
> +
>  struct _SpiceVmcInputStream
>  {
>      GInputStream parent_instance;
> @@ -160,7 +162,7 @@ read_cancelled(GCancellable *cancellable,
>      SPICE_DEBUG("read cancelled, %p", self->task);
>      g_task_return_new_error(self->task,
>                              G_IO_ERROR, G_IO_ERROR_CANCELLED,
> -                            "read cancelled");
> +                            _("read cancelled"));
>  
>      g_clear_object(&self->task);
>  
> diff --git a/src/win-usb-driver-install.c b/src/win-usb-driver-install.c
> index a7c4864..fa19a28 100644
> --- a/src/win-usb-driver-install.c
> +++ b/src/win-usb-driver-install.c
> @@ -36,6 +36,8 @@
>  #include "win-usb-driver-install.h"
>  #include "usb-device-manager-priv.h"
>  
> +#include <glib/gi18n.h>
> +
>  /* ------------------------------------------------------------------ */
>  /* gobject glue                                                       */
>  
> @@ -152,7 +154,7 @@ void win_usb_driver_handle_reply_cb(GObject *gobject,
>          g_task_return_new_error(priv->task,
>                                  SPICE_WIN_USB_DRIVER_ERROR,
>                                  SPICE_WIN_USB_DRIVER_ERROR_FAILED,
> -                                "unexpected EOF from usbclerk");
> +                                _("unexpected EOF from usbclerk"));
>          goto failed_reply;
>      }
>  
> @@ -169,7 +171,7 @@ void win_usb_driver_handle_reply_cb(GObject *gobject,
>          g_task_return_new_error(priv->task,
>                                  SPICE_WIN_USB_DRIVER_ERROR,
>                                  SPICE_WIN_USB_DRIVER_ERROR_MESSAGE,
> -                                "usbclerk magic mismatch");
> +                                _("usbclerk magic mismatch"));
>          goto failed_reply;
>      }
>  
> @@ -179,7 +181,7 @@ void win_usb_driver_handle_reply_cb(GObject *gobject,
>          g_task_return_new_error(priv->task,
>                                  SPICE_WIN_USB_DRIVER_ERROR,
>                                  SPICE_WIN_USB_DRIVER_ERROR_MESSAGE,
> -                                "usbclerk version mismatch");
> +                                _("usbclerk version mismatch"));
>      }
>  
>      if (priv->reply.hdr.type != USB_CLERK_REPLY) {
> @@ -188,7 +190,7 @@ void win_usb_driver_handle_reply_cb(GObject *gobject,
>          g_task_return_new_error(priv->task,
>                                  SPICE_WIN_USB_DRIVER_ERROR,
>                                  SPICE_WIN_USB_DRIVER_ERROR_MESSAGE,
> -                                "usbclerk message with unexpected type");
> +                                _("usbclerk message with unexpected type"));
>          goto failed_reply;
>      }
>  
> @@ -198,7 +200,7 @@ void win_usb_driver_handle_reply_cb(GObject *gobject,
>          g_task_return_new_error(priv->task,
>                                  SPICE_WIN_USB_DRIVER_ERROR,
>                                  SPICE_WIN_USB_DRIVER_ERROR_MESSAGE,
> -                                "usbclerk message with unexpected size");
> +                                _("usbclerk message with unexpected size"));
>          goto failed_reply;
>      }
>  
> @@ -206,7 +208,7 @@ void win_usb_driver_handle_reply_cb(GObject *gobject,
>          g_task_return_new_error(priv->task,
>                                  SPICE_WIN_USB_DRIVER_ERROR,
>                                  SPICE_WIN_USB_DRIVER_ERROR_MESSAGE,
> -                                "usbclerk error reply");
> +                                _("usbclerk error reply"));
>          goto failed_reply;
>      }
>  
> @@ -314,7 +316,7 @@ void spice_win_usb_driver_op(SpiceWinUsbDriver *self,
>          g_warning("Another request exists -- try later");
>          g_task_return_new_error(result,
>                    SPICE_WIN_USB_DRIVER_ERROR, SPICE_WIN_USB_DRIVER_ERROR_FAILED,
> -                  "Another request exists -- try later");
> +                  _("Another request exists -- try later"));
>          goto failed_request;
>      }
>  
> -- 
> 2.5.0
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20160118/62a4faa7/attachment.sig>


More information about the Spice-devel mailing list