[gimp/gimp-2-10] plug-ins: improve a few error messages and allow translating.
- From: Jacob Boerema <jboerema src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] plug-ins: improve a few error messages and allow translating.
- Date: Tue, 2 Mar 2021 22:38:58 +0000 (UTC)
commit 198fdc4e521e64ce39522256bed07f8c28c3eec4
Author: Jacob Boerema <jgboerema gmail com>
Date: Tue Mar 2 16:08:55 2021 -0500
plug-ins: improve a few error messages and allow translating.
Improved and added a few error messages and made all
user visible messages (g_message) translatable.
(cherry picked from commit 20cedd4c0cde3497d4ce1ea395408c559b15fc81)
# Conflicts:
# plug-ins/file-tiff/file-tiff-load.c
plug-ins/file-tiff/file-tiff-load.c | 51 ++++++++++++++++++++++---------------
1 file changed, 30 insertions(+), 21 deletions(-)
---
diff --git a/plug-ins/file-tiff/file-tiff-load.c b/plug-ins/file-tiff/file-tiff-load.c
index 40bdf9a9ef..04695f651b 100644
--- a/plug-ins/file-tiff/file-tiff-load.c
+++ b/plug-ins/file-tiff/file-tiff-load.c
@@ -249,7 +249,13 @@ load_image (GFile *file,
tif = tiff_open (file, "r", error);
if (! tif)
- return GIMP_PDB_EXECUTION_ERROR;
+ {
+ if (! (error && *error))
+ g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
+ _("Not a TIFF image or image is corrupt."));
+
+ return GIMP_PDB_EXECUTION_ERROR;
+ }
pages.target = GIMP_PAGE_SELECTOR_TARGET_LAYERS;
gimp_get_data (LOAD_PROC "-target", &pages.target);
@@ -574,7 +580,7 @@ load_image (GFile *file,
if (! TIFFGetField (tif, TIFFTAG_IMAGEWIDTH, &cols))
{
TIFFClose (tif);
- g_message ("Could not get image width from '%s'",
+ g_message (_("Could not get image width from '%s'"),
gimp_file_get_utf8_name (file));
return GIMP_PDB_EXECUTION_ERROR;
}
@@ -582,7 +588,7 @@ load_image (GFile *file,
if (! TIFFGetField (tif, TIFFTAG_IMAGELENGTH, &rows))
{
TIFFClose (tif);
- g_message ("Could not get image length from '%s'",
+ g_message (_("Could not get image length from '%s'"),
gimp_file_get_utf8_name (file));
return GIMP_PDB_EXECUTION_ERROR;
}
@@ -590,8 +596,8 @@ load_image (GFile *file,
if (cols > GIMP_MAX_IMAGE_SIZE || cols <= 0 ||
rows > GIMP_MAX_IMAGE_SIZE || rows <= 0)
{
- g_message ("Invalid image dimensions (%u x %u) for page %d. "
- "Image may be corrupt.",
+ g_message (_("Invalid image dimensions (%u x %u) for page %d. "
+ "Image may be corrupt."),
(guint32) cols, (guint32) rows, li+1);
continue;
}
@@ -611,15 +617,15 @@ load_image (GFile *file,
compression == COMPRESSION_CCITTRLE ||
compression == COMPRESSION_CCITTRLEW))
{
- g_message ("Could not get photometric from '%s'. "
- "Image is CCITT compressed, assuming min-is-white",
+ g_message (_("Could not get photometric from '%s'. "
+ "Image is CCITT compressed, assuming min-is-white"),
gimp_file_get_utf8_name (file));
photomet = PHOTOMETRIC_MINISWHITE;
}
else
{
- g_message ("Could not get photometric from '%s'. "
- "Assuming min-is-black",
+ g_message (_("Could not get photometric from '%s'. "
+ "Assuming min-is-black"),
gimp_file_get_utf8_name (file));
/* old AppleScan software misses out the photometric tag
@@ -650,8 +656,8 @@ load_image (GFile *file,
/* In non-interactive mode, we assume unassociated alpha if unspecified.
* We don't output messages in interactive mode as the user
* has already the ability to choose through a dialog. */
- g_message ("alpha channel type not defined for file %s. "
- "Assuming alpha is not premultiplied",
+ g_message (_("Alpha channel type not defined for %s. "
+ "Assuming alpha is not premultiplied"),
gimp_file_get_utf8_name (file));
switch (default_extra)
@@ -675,9 +681,9 @@ load_image (GFile *file,
if (is_non_conformant_tiff (photomet, spp))
{
if (run_mode != GIMP_RUN_INTERACTIVE)
- g_message ("File '%s' does not conform to TIFF specification: "
+ g_message (_("Image '%s' does not conform to the TIFF specification: "
"ExtraSamples field is not set while extra channels are present. "
- "Assuming the first extra channel as non-premultiplied alpha.",
+ "Assuming the first extra channel is non-premultiplied alpha."),
gimp_file_get_utf8_name (file));
switch (default_extra)
@@ -908,6 +914,9 @@ load_image (GFile *file,
break;
default:
+ g_message (_("Invalid or unknown compression %u. "
+ "Setting compression to none."),
+ compression);
compression = COMPRESSION_NONE;
break;
}
@@ -963,7 +972,7 @@ load_image (GFile *file,
if (*image < 1)
{
TIFFClose (tif);
- g_message ("Could not create a new image: %s",
+ g_message (_("Could not create a new image: %s"),
gimp_get_pdb_error ());
return GIMP_PDB_EXECUTION_ERROR;
}
@@ -1128,8 +1137,8 @@ load_image (GFile *file,
break;
default:
- g_message ("File error: unknown resolution "
- "unit type %d, assuming dpi", read_unit);
+ g_message (_("Unknown resolution "
+ "unit type %d, assuming dpi"), read_unit);
break;
}
}
@@ -1138,15 +1147,15 @@ load_image (GFile *file,
/* no res unit tag */
/* old AppleScan software produces these */
- g_message ("Warning: resolution specified without "
- "any units tag, assuming dpi");
+ g_message (_("Warning: resolution specified without "
+ "unit type, assuming dpi"));
}
}
else
{
/* xres but no yres */
- g_message ("Warning: no y resolution info, assuming same as x");
+ g_message (_("Warning: no y resolution info, assuming same as x"));
yres = xres;
}
@@ -1279,7 +1288,7 @@ load_image (GFile *file,
&redmap, &greenmap, &bluemap))
{
TIFFClose (tif);
- g_message ("Could not get colormaps from '%s'",
+ g_message (_("Could not get colormaps from '%s'"),
gimp_file_get_utf8_name (file));
return GIMP_PDB_EXECUTION_ERROR;
}
@@ -1562,7 +1571,7 @@ load_rgba (TIFF *tif,
if (! TIFFReadRGBAImage (tif, image_width, image_height, buffer, 0))
{
- g_message ("%s: Unsupported image format, no RGBA loader available",
+ g_message (_("%s: Unsupported image format, no RGBA loader available"),
G_STRFUNC);
g_free (buffer);
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]