[Spice-devel] [PATCH spice-gtk] Translate file transfer error messages

Jonathon Jongsma jjongsma at redhat.com
Thu Sep 1 13:49:37 UTC 2016


On Thu, 2016-09-01 at 09:33 +0200, Christophe Fergeau wrote:
> On Wed, Aug 31, 2016 at 03:36:04PM -0500, Jonathon Jongsma wrote:
> > 
> > If we are to ever display error messages to a user in a UI, they
> > need to
> > be translated.
> > ---
> >  po/POTFILES.in     | 1 +
> >  src/channel-main.c | 5 +++--
> >  2 files changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/po/POTFILES.in b/po/POTFILES.in
> > index ad12609..db42281 100644
> > --- a/po/POTFILES.in
> > +++ b/po/POTFILES.in
> > @@ -1,3 +1,4 @@
> > +src/channel-main.c
> >  src/channel-usbredir.c
> >  src/desktop-integration.c
> >  src/spice-channel.c
> > diff --git a/src/channel-main.c b/src/channel-main.c
> > index 419b0c2..77c9464 100644
> > --- a/src/channel-main.c
> > +++ b/src/channel-main.c
> > @@ -20,6 +20,7 @@
> >  #include <math.h>
> >  #include <spice/vd_agent.h>
> >  #include <glib/gstdio.h>
> > +#include <glib/gi18n-lib.h>
> >  
> >  #include "spice-client.h"
> >  #include "spice-common.h"
> > @@ -1854,11 +1855,11 @@ static void
> > main_agent_handle_xfer_status(SpiceMainChannel *channel,
> >          return;
> >      case VD_AGENT_FILE_XFER_STATUS_CANCELLED:
> >          error = g_error_new(SPICE_CLIENT_ERROR,
> > SPICE_CLIENT_ERROR_FAILED,
> > -                            "The spice agent cancelled the file
> > transfer");
> > +                            _("The spice agent cancelled the file
> > transfer"));
> >          break;
> >      case VD_AGENT_FILE_XFER_STATUS_ERROR:
> >          error = g_error_new(SPICE_CLIENT_ERROR,
> > SPICE_CLIENT_ERROR_FAILED,
> > -                            "The spice agent reported an error
> > during the file transfer");
> > +                            _("The spice agent reported an error
> > during the file transfer"));
> 
> Actually, g_error_new_literal would be better here. This way you are
> fully sure a translation won't break everything with an unwanted %
> format
> specifier.
> 
> Christophe


Right, I'll change it.



More information about the Spice-devel mailing list