From e5f7ef23a62b6b491bb84f5f00b3adb0e5c5c427 Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Mon, 17 May 2021 16:32:14 +0200 Subject: [PATCH] WRaster: Made a few messages translatable Signed-off-by: Christophe CURIS --- wrlib/context.c | 4 ++-- wrlib/load.c | 2 +- wrlib/load_webp.c | 2 +- wrlib/misc.c | 26 +++++++++++++------------- wrlib/xpixmap.c | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/wrlib/context.c b/wrlib/context.c index 69f040cf..99657ae6 100644 --- a/wrlib/context.c +++ b/wrlib/context.c @@ -454,7 +454,7 @@ static void gatherconfig(RContext * context, int screen_n) if (ptr) { float g1, g2, g3; if (sscanf(ptr, "%f/%f/%f", &g1, &g2, &g3) != 3 || g1 <= 0.0F || g2 <= 0.0F || g3 <= 0.0F) { - printf("wrlib: invalid value(s) for gamma correction \"%s\"\n", ptr); + fprintf(stderr, _("wrlib: invalid value \"%s\" for %s\n"), ptr, "WRASTER_GAMMA"); } else { context->attribs->flags |= RC_GammaCorrection; context->attribs->rgamma = g1; @@ -466,7 +466,7 @@ static void gatherconfig(RContext * context, int screen_n) if (ptr) { int i; if (sscanf(ptr, "%d", &i) != 1 || i < 2 || i > 6) { - printf("wrlib: invalid value for color resolution \"%s\"\n", ptr); + fprintf(stderr, _("wrlib: invalid value \"%s\" for %s\n"), ptr, "WRASTER_COLOR_RESOLUTION"); } else { context->attribs->flags |= RC_ColorsPerChannel; context->attribs->colors_per_channel = i; diff --git a/wrlib/load.c b/wrlib/load.c index 6fc4b678..016a22ee 100644 --- a/wrlib/load.c +++ b/wrlib/load.c @@ -127,7 +127,7 @@ static void init_cache(void) if (RImageCacheSize > 0) { RImageCache = malloc(sizeof(RCachedImage) * RImageCacheSize); if (RImageCache == NULL) { - printf("wrlib: out of memory for image cache\n"); + fprintf(stderr, _("wrlib: out of memory for image cache\n")); return; } memset(RImageCache, 0, sizeof(RCachedImage) * RImageCacheSize); diff --git a/wrlib/load_webp.c b/wrlib/load_webp.c index 367c8b0d..04a67c36 100644 --- a/wrlib/load_webp.c +++ b/wrlib/load_webp.c @@ -129,7 +129,7 @@ RImage *RLoadWEBP(const char *file_name) free(raw_data); if (!ret) { - fprintf(stderr, "wrlib: Failed to decode WEBP from file \"%s\"\n", file_name); + fprintf(stderr, _("wrlib: failed to decode WebP from file \"%s\"\n"), file_name); RErrorCode = RERR_BADIMAGEFILE; RReleaseImage(image); return NULL; diff --git a/wrlib/misc.c b/wrlib/misc.c index 7cd1c0fa..922c73d6 100644 --- a/wrlib/misc.c +++ b/wrlib/misc.c @@ -204,44 +204,44 @@ const char *RMessageForError(int errorCode) { switch (errorCode) { case RERR_NONE: - return "no error"; + return _("no error"); case RERR_OPEN: - return "could not open file"; + return _("could not open file"); case RERR_READ: - return "error reading from file"; + return _("error reading from file"); case RERR_WRITE: - return "error writing to file"; + return _("error writing to file"); case RERR_NOMEMORY: - return "out of memory"; + return _("out of memory"); case RERR_NOCOLOR: - return "out of color cells"; + return _("out of color cells"); case RERR_BADIMAGEFILE: - return "invalid or corrupted image file"; + return _("invalid or corrupted image file"); case RERR_BADFORMAT: - return "the image format in the file is not supported and can't be loaded"; + return _("image format is not supported"); case RERR_BADINDEX: - return "image file does not contain requested image index"; + return _("file does not contain requested image index"); case RERR_BADVISUALID: - return "request for an invalid visual ID"; + return _("request for an invalid Visual ID"); case RERR_STDCMAPFAIL: - return "failed to create standard colormap"; + return _("failed to create X standard colormap"); case RERR_XERROR: - return "internal X error"; + return _("internal X error"); default: case RERR_INTERNAL: - return "internal error"; + return _("internal error"); } } diff --git a/wrlib/xpixmap.c b/wrlib/xpixmap.c index ff402e73..9cb95257 100644 --- a/wrlib/xpixmap.c +++ b/wrlib/xpixmap.c @@ -157,7 +157,7 @@ RImage *RCreateImageFromDrawable(RContext * context, Drawable drawable, Pixmap m assert(drawable != None); if (!XGetGeometry(context->dpy, drawable, &baz, &foo, &foo, &w, &h, &bar, &bar)) { - printf("wrlib: invalid window or pixmap passed to RCreateImageFromDrawable\n"); + fprintf(stderr, _("wrlib: invalid window or pixmap passed to RCreateImageFromDrawable\n")); return NULL; } pimg = XGetImage(context->dpy, drawable, 0, 0, w, h, AllPlanes, ZPixmap);