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

Christophe Fergeau cfergeau at redhat.com
Fri Mar 24 10:38:52 UTC 2017


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
> ---
>  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"),

You'd need to use ngettext for such strings with plurals, which gets
tricky here as you have multiple plurals involved :-/

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170324/d0822d93/attachment-0001.sig>


More information about the Spice-devel mailing list