[Spice-devel] [PATCH spice-gtk] Make error messages translatable

Victor Toso victortoso at redhat.com
Fri Mar 24 10:11:25 UTC 2017


Hi,

On Fri, Mar 24, 2017 at 10:13:08AM +0100, Pavel Grunt wrote:
> ---
> As mentioned in https://lists.freedesktop.org/archives/spice-devel/2017-March/036492.html

To make check be happy, you need:

diff --git a/po/POTFILES.in b/po/POTFILES.in
index d1033f9..5f438b5 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,8 +1,12 @@
 src/channel-main.c
+src/channel-port.c
 src/channel-usbredir.c
 src/desktop-integration.c
+src/smartcard-manager.c
 src/spice-channel.c
+src/spice-file-transfer-task.c
 src/spice-option.c
+src/spice-pulse.c
 src/usb-device-manager.c
 src/usb-device-widget.c
 src/usbutil.c

Looks good with that
Acked-by: Victor Toso <victortoso at redhat.com>

> ---
>  src/channel-main.c             | 10 +++++-----
>  src/channel-port.c             |  4 +++-
>  src/channel-usbredir.c         |  2 +-
>  src/smartcard-manager.c        |  5 +++--
>  src/spice-channel.c            |  2 +-
>  src/spice-file-transfer-task.c |  6 ++++--
>  src/spice-pulse.c              |  4 +++-
>  7 files changed, 20 insertions(+), 13 deletions(-)
> 
> diff --git a/src/channel-main.c b/src/channel-main.c
> index be7c852..3092bed 100644
> --- a/src/channel-main.c
> +++ b/src/channel-main.c
> @@ -1875,7 +1875,7 @@ static void main_agent_handle_xfer_status(SpiceMainChannel *channel,
>      default:
>          g_warn_if_reached();
>          error = g_error_new(SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED,
> -                            "unhandled status type: %u", msg->result);
> +                            _("unhandled status type: %u"), msg->result);
>          break;
>      }
>  
> @@ -2886,7 +2886,7 @@ static void file_transfer_operation_free(FileTransferOperation *xfer_op)
>      if (xfer_op->stats.failed != 0) {
>          GError *error = g_error_new(SPICE_CLIENT_ERROR,
>                                      SPICE_CLIENT_ERROR_FAILED,
> -                                    "Transferring %u files: %u succeed, %u cancelled, %u failed",
> +                                    _("Transferring %u files: %u succeed, %u cancelled, %u failed"),
>                                      xfer_op->stats.num_files,
>                                      xfer_op->stats.succeed,
>                                      xfer_op->stats.cancelled,
> @@ -2896,7 +2896,7 @@ static void file_transfer_operation_free(FileTransferOperation *xfer_op)
>      } else if (xfer_op->stats.cancelled != 0 && xfer_op->stats.succeed == 0) {
>          GError *error = g_error_new(G_IO_ERROR,
>                                      G_IO_ERROR_CANCELLED,
> -                                    "Transferring %u files: %u succeed, %u cancelled, %u failed",
> +                                    _("Transferring %u files: %u succeed, %u cancelled, %u failed"),
>                                      xfer_op->stats.num_files,
>                                      xfer_op->stats.succeed,
>                                      xfer_op->stats.cancelled,
> @@ -2937,7 +2937,7 @@ static void spice_main_channel_reset_all_xfer_operations(SpiceMainChannel *chann
>          }
>  
>          error = g_error_new(SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED,
> -                            "Agent connection closed");
> +                            _("Agent connection closed"));
>          spice_file_transfer_task_completed(xfer_task, error);
>      }
>      g_list_free(keys);
> @@ -3094,7 +3094,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 d922e4b..9fb7f05 100644
> --- a/src/channel-port.c
> +++ b/src/channel-port.c
> @@ -17,6 +17,8 @@
>  */
>  #include "config.h"
>  
> +#include <glib/gi18n-lib.h>
> +
>  #include "spice-client.h"
>  #include "spice-common.h"
>  #include "spice-channel-priv.h"
> @@ -294,7 +296,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 fef62ce..f8a5234 100644
> --- a/src/channel-usbredir.c
> +++ b/src/channel-usbredir.c
> @@ -348,7 +348,7 @@ static void spice_usbredir_channel_open_acl_cb(
>      spice_usb_acl_helper_open_acl_finish(acl_helper, acl_res, &err);
>      if (!err && priv->state == STATE_DISCONNECTING) {
>          err = g_error_new_literal(G_IO_ERROR, G_IO_ERROR_CANCELLED,
> -                                  "USB redirection channel connect cancelled");
> +                                  _("USB redirection channel connect cancelled"));
>      }
>      if (!err) {
>          spice_usbredir_channel_open_device(channel, &err);
> diff --git a/src/smartcard-manager.c b/src/smartcard-manager.c
> index 708f976..05e113d 100644
> --- a/src/smartcard-manager.c
> +++ b/src/smartcard-manager.c
> @@ -18,6 +18,7 @@
>  #include "config.h"
>  
>  #include <glib-object.h>
> +#include <glib/gi18n-lib.h>
>  #include <string.h>
>  
>  #ifdef USE_SMARTCARD_012
> @@ -439,7 +440,7 @@ static gboolean smartcard_manager_init(SmartcardManagerInitArgs *args)
>      if (options == NULL) {
>          args->err = g_error_new(SPICE_CLIENT_ERROR,
>                                  SPICE_CLIENT_ERROR_FAILED,
> -                                "vcard_emul_options() failed!");
> +                                _("vcard_emul_options() failed!"));
>          goto end;
>      }
>  
> @@ -453,7 +454,7 @@ init:
>              && (emul_init_status != VCARD_EMUL_INIT_ALREADY_INITED)) {
>          args->err = g_error_new(SPICE_CLIENT_ERROR,
>                                  SPICE_CLIENT_ERROR_FAILED,
> -                                "Failed to initialize smartcard");
> +                                _("Failed to initialize smartcard"));
>          goto end;
>      }
>  
> diff --git a/src/spice-channel.c b/src/spice-channel.c
> index c2e8a01..c3f45e1 100644
> --- a/src/spice-channel.c
> +++ b/src/spice-channel.c
> @@ -3115,7 +3115,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-file-transfer-task.c b/src/spice-file-transfer-task.c
> index d0170da..46165f7 100644
> --- a/src/spice-file-transfer-task.c
> +++ b/src/spice-file-transfer-task.c
> @@ -17,6 +17,8 @@
>  
>  #include "config.h"
>  
> +#include <glib/gi18n-lib.h>
> +
>  #include "spice-file-transfer-task-priv.h"
>  
>  /**
> @@ -310,7 +312,7 @@ void spice_file_transfer_task_completed(SpiceFileTransferTask *self,
>          if (self->error == NULL) {
>              self->error = g_error_new(SPICE_CLIENT_ERROR,
>                                        SPICE_CLIENT_ERROR_FAILED,
> -                                      "Cannot complete task in pending state");
> +                                      _("Cannot complete task in pending state"));
>          }
>          return;
>      }
> @@ -426,7 +428,7 @@ void spice_file_transfer_task_read_async(SpiceFileTransferTask *self,
>                                  spice_file_transfer_task_read_async,
>                                  SPICE_CLIENT_ERROR,
>                                  SPICE_CLIENT_ERROR_FAILED,
> -                                "Cannot read data in pending state");
> +                                _("Cannot read data in pending state"));
>          return;
>      }
>  
> diff --git a/src/spice-pulse.c b/src/spice-pulse.c
> index 5248bc3..f213f5f 100644
> --- a/src/spice-pulse.c
> +++ b/src/spice-pulse.c
> @@ -17,6 +17,8 @@
>  */
>  #include "config.h"
>  
> +#include <glib/gi18n-lib.h>
> +
>  #include "spice-pulse.h"
>  #include "spice-common.h"
>  #include "spice-session-priv.h"
> @@ -1216,7 +1218,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);
>      }
> -- 
> 2.12.1
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170324/c0f57f1c/attachment.sig>


More information about the Spice-devel mailing list