[gimp] Bug 785265 - Patch for localization for combotext in metadata editor



commit 619a05a688ac0fec4cb8f06ba65410868c58f430
Author: draekko <draekko software gmail com>
Date:   Sun Jul 23 15:15:13 2017 -0400

    Bug 785265 - Patch for localization for combotext in metadata editor
    
    Mark string constants in arrays with N_() and call gettext() on them.

 plug-ins/metadata/metadata-editor.c |   57 +++++++++++++----------
 plug-ins/metadata/metadata-tags.h   |   86 +++++++++++++++++-----------------
 po-plug-ins/POTFILES.in             |    1 +
 3 files changed, 76 insertions(+), 68 deletions(-)
---
diff --git a/plug-ins/metadata/metadata-editor.c b/plug-ins/metadata/metadata-editor.c
index 4fb21f9..1ad0da7 100644
--- a/plug-ins/metadata/metadata-editor.c
+++ b/plug-ins/metadata/metadata-editor.c
@@ -405,7 +405,7 @@ query (void)
   };
 
   gimp_install_procedure (PLUG_IN_PROC,
-                          N_("Edit metadata (IPTC, GPS, DICOM)"),
+                          N_("Edit metadata (IPTC, EXIF, XMP)"),
                           "Edit metadata information attached to the "
                           "current image. Some or all of this metadata "
                           "will be saved in the file, depending on the output "
@@ -1623,7 +1623,7 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata,
   for (i = 0; i < 3; i++)
     {
       gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_widget),
-                                      marked[i].display);
+                                      gettext (marked[i].display));
     }
   gtk_combo_box_set_active (GTK_COMBO_BOX (combo_widget), 0);
 
@@ -1631,7 +1631,7 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata,
   for (i = 0; i < 9; i++)
     {
       gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_widget),
-                                      urgency[i]);
+                                      gettext (urgency[i]));
     }
   gtk_combo_box_set_active (GTK_COMBO_BOX (combo_widget), 0);
 
@@ -1639,7 +1639,7 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata,
   for (i = 0; i < 13; i++)
     {
       gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_widget),
-                                      minormodelagedisclosure[i].display);
+                                      gettext (minormodelagedisclosure[i].display));
     }
   gtk_combo_box_set_active (GTK_COMBO_BOX (combo_widget), 0);
 
@@ -1647,7 +1647,7 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata,
   for (i = 0; i < 4; i++)
     {
       gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_widget),
-                                      modelreleasestatus[i].display);
+                                      gettext (modelreleasestatus[i].display));
     }
   gtk_combo_box_set_active (GTK_COMBO_BOX (combo_widget), 0);
   gtk_widget_get_size_request (combo_widget, &width, &height);
@@ -1657,7 +1657,7 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata,
   for (i = 0; i < 4; i++)
     {
       gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_widget),
-                                      digitalsourcetype[i].display);
+                                      gettext (digitalsourcetype[i].display));
     }
   gtk_combo_box_set_active (GTK_COMBO_BOX (combo_widget), 0);
 
@@ -1665,7 +1665,7 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata,
   for (i = 0; i < 4; i++)
     {
       gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_widget),
-                                      propertyreleasestatus[i].display);
+                                      gettext (propertyreleasestatus[i].display));
     }
   gtk_combo_box_set_active (GTK_COMBO_BOX (combo_widget), 0);
   gtk_widget_get_size_request (combo_widget, &width, &height);
@@ -1675,7 +1675,7 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata,
   for (i = 0; i < 4; i++)
     {
       gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_widget),
-                                      dicom[i].display);
+                                      gettext (dicom[i].display));
     }
   gtk_combo_box_set_active (GTK_COMBO_BOX (combo_widget), 0);
 
@@ -1683,7 +1683,7 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata,
   for (i = 0; i < 3; i++)
     {
       gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_widget),
-                                      gpslatref[i]);
+                                      gettext (gpslatref[i]));
     }
   gtk_combo_box_set_active (GTK_COMBO_BOX (combo_widget), 0);
 
@@ -1691,7 +1691,7 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata,
   for (i = 0; i < 3; i++)
     {
       gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_widget),
-                                      gpslngref[i]);
+                                      gettext (gpslngref[i]));
     }
   gtk_combo_box_set_active (GTK_COMBO_BOX (combo_widget), 0);
 
@@ -1699,7 +1699,7 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata,
   for (i = 0; i < 3; i++)
     {
       gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_widget),
-                                      gpsaltref[i]);
+                                      gettext (gpsaltref[i]));
     }
   gtk_combo_box_set_active (GTK_COMBO_BOX (combo_widget), 0);
 
@@ -1707,7 +1707,7 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata,
   for (i = 0; i < 2; i++)
     {
       gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_widget),
-                                      gpsaltsys[i]);
+                                      gettext (gpsaltsys[i]));
     }
 
   gtk_combo_box_set_active (GTK_COMBO_BOX (combo_widget), 0);
@@ -2962,7 +2962,8 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata,
                           break;
                         }
 
-                      if (! strcmp (modelreleasestatus[loop].display, value))
+                      if (! strcmp (gettext (modelreleasestatus[loop].display),
+                                    value))
                         {
                           gtk_combo_box_set_active (GTK_COMBO_BOX (widget), loop);
                           break;
@@ -2982,7 +2983,8 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata,
                           break;
                         }
 
-                      if (! strcmp (digitalsourcetype[loop].display, value))
+                      if (! strcmp (gettext (digitalsourcetype[loop].display),
+                                    value))
                         {
                           gtk_combo_box_set_active (GTK_COMBO_BOX (widget), loop);
                           break;
@@ -3002,7 +3004,8 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata,
                           break;
                         }
 
-                      if (! strcmp (propertyreleasestatus[loop].display, value))
+                      if (! strcmp (gettext (propertyreleasestatus[loop].display),
+                                    value))
                         {
                           gtk_combo_box_set_active (GTK_COMBO_BOX (widget), loop);
                           break;
@@ -3062,7 +3065,8 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata,
                     {
                       gtk_list_store_append (phonestore, &phoneiter);
                       gtk_list_store_set (phonestore, &phoneiter,
-                                          0, phone_types[i].display, -1);
+                                          0, gettext (phone_types[i].display),
+                                          -1);
                     }
                   phonemodel = GTK_TREE_MODEL (phonestore);
 
@@ -3253,21 +3257,23 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata,
                           gchar type2[256];
                           gint  types;
 
-                          strcpy (type1, phone_types[0].display);
-                          strcpy (type2, phone_types[0].display);
+                          strcpy (type1, gettext (phone_types[0].display));
+                          strcpy (type2, gettext (phone_types[0].display));
 
                           for (types = 0; types < 6; types++)
                             {
                               if (! strcmp (tagdata[item][3],
                                             phone_types[types].data))
                                 {
-                                  strcpy (type1, phone_types[types].display);
+                                  strcpy (type1,
+                                          gettext (phone_types[types].display));
                                 }
 
                               if (! strcmp (tagdata[item][5],
                                             phone_types[types].data))
                                 {
-                                  strcpy (type2, phone_types[types].display);
+                                  strcpy (type2,
+                                          gettext (phone_types[types].display));
                                 }
                             }
 
@@ -3295,9 +3301,9 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata,
                                               COL_LICENSOR_NAME, NULL,
                                               COL_LICENSOR_ID, NULL,
                                               COL_LICENSOR_PHONE1, NULL,
-                                              COL_LICENSOR_PHONE_TYPE1, phone_types[0].display,
+                                              COL_LICENSOR_PHONE_TYPE1, gettext (phone_types[0].display),
                                               COL_LICENSOR_PHONE2, NULL,
-                                              COL_LICENSOR_PHONE_TYPE1, phone_types[0].display,
+                                              COL_LICENSOR_PHONE_TYPE1, gettext (phone_types[0].display),
                                               COL_LICENSOR_EMAIL, NULL,
                                               COL_LICENSOR_WEB, NULL,
                                               -1);
@@ -4927,7 +4933,7 @@ metadata_editor_write_callback (GtkWidget  *dialog,
             {
               for (types = 0; types < 6; types++)
                 {
-                  if (! strcmp (tag_data, phone_types[types].display))
+                  if (! strcmp (tag_data, gettext (phone_types[types].display)))
                     {
                       strcpy (type1, phone_types[types].data);
                       break;
@@ -4960,8 +4966,9 @@ metadata_editor_write_callback (GtkWidget  *dialog,
             {
               for (types = 0; types < 6; types++)
                 {
-                  g_print("%d %s %s\n", types, tag_data, phone_types[types].display);
-                  if (! strcmp (tag_data, phone_types[types].display))
+                  g_print ("%d %s %s\n", types, tag_data,
+                           gettext (phone_types[types].display));
+                  if (! strcmp (tag_data, gettext (phone_types[types].display)))
                     {
                       g_print("%d %s \n", types, phone_types[types].data);
                       strcpy (type2, phone_types[types].data);
diff --git a/plug-ins/metadata/metadata-tags.h b/plug-ins/metadata/metadata-tags.h
index 4806f9a..db1cfa3 100644
--- a/plug-ins/metadata/metadata-tags.h
+++ b/plug-ins/metadata/metadata-tags.h
@@ -247,11 +247,11 @@ static const metadata_tag equivalent_metadata_tags[] =
  */
 static const combobox_str_tag digitalsourcetype[] =
 {
-  { "http://cv.iptc.org/newscodes/digitalsourcetype/digitalCapture";, "Original digital capture of a real 
life scene"    },
-  { "http://cv.iptc.org/newscodes/digitalsourcetype/negativeFilm";,   "Digitised from a negative on film"     
           },
-  { "http://cv.iptc.org/newscodes/digitalsourcetype/positiveFilm";,   "Digitised from a positive on film"     
           },
-  { "http://cv.iptc.org/newscodes/digitalsourcetype/print";,          "Digitised from a print on 
non-transparent medium" },
-  { "http://cv.iptc.org/newscodes/digitalsourcetype/softwareImage";,  "Created by software"                   
           }
+  { "http://cv.iptc.org/newscodes/digitalsourcetype/digitalCapture";, N_("Original digital capture of a real 
life scene")    },
+  { "http://cv.iptc.org/newscodes/digitalsourcetype/negativeFilm";,   N_("Digitised from a negative on film") 
               },
+  { "http://cv.iptc.org/newscodes/digitalsourcetype/positiveFilm";,   N_("Digitised from a positive on film") 
               },
+  { "http://cv.iptc.org/newscodes/digitalsourcetype/print";,          N_("Digitised from a print on 
non-transparent medium") },
+  { "http://cv.iptc.org/newscodes/digitalsourcetype/softwareImage";,  N_("Created by software")               
               }
 };
 
 /* Model Release Status Combobox Items
@@ -259,10 +259,10 @@ static const combobox_str_tag digitalsourcetype[] =
  */
 static const combobox_str_tag modelreleasestatus[] =
 {
-  { "http://ns.useplus.org/ldf/vocab/MR-NON";, "None"                                 },
-  { "http://ns.useplus.org/ldf/vocab/MR-NAP";, "Not Applicable"                       },
-  { "http://ns.useplus.org/ldf/vocab/MR-NAP";, "Unlimited Model Releases"             },
-  { "http://ns.useplus.org/ldf/vocab/MR-LPR";, "Limited or Incomplete Model Releases" }
+  { "http://ns.useplus.org/ldf/vocab/MR-NON";, N_("None")                                 },
+  { "http://ns.useplus.org/ldf/vocab/MR-NAP";, N_("Not Applicable")                       },
+  { "http://ns.useplus.org/ldf/vocab/MR-NAP";, N_("Unlimited Model Releases")             },
+  { "http://ns.useplus.org/ldf/vocab/MR-LPR";, N_("Limited or Incomplete Model Releases") }
 };
 
 /* Property Release Status Combobox Items
@@ -270,10 +270,10 @@ static const combobox_str_tag modelreleasestatus[] =
  */
 static const combobox_str_tag propertyreleasestatus[] =
 {
-  { "http://ns.useplus.org/ldf/vocab/PR-NON";, "None"                                    },
-  { "http://ns.useplus.org/ldf/vocab/PR-NAP";, "Not Applicable"                          },
-  { "http://ns.useplus.org/ldf/vocab/PR-NAP";, "Unlimited Property Releases"             },
-  { "http://ns.useplus.org/ldf/vocab/PR-LPR";, "Limited or Incomplete Property Releases" }
+  { "http://ns.useplus.org/ldf/vocab/PR-NON";, N_("None")                                    },
+  { "http://ns.useplus.org/ldf/vocab/PR-NAP";, N_("Not Applicable")                          },
+  { "http://ns.useplus.org/ldf/vocab/PR-NAP";, N_("Unlimited Property Releases")             },
+  { "http://ns.useplus.org/ldf/vocab/PR-LPR";, N_("Limited or Incomplete Property Releases") }
 };
 
 /* Minor Model Age Disclosure Combobox Items
@@ -281,44 +281,44 @@ static const combobox_str_tag propertyreleasestatus[] =
  */
 static const combobox_str_tag minormodelagedisclosure[] =
 {
-  { "http://ns.useplus.org/ldf/vocab/AG-UNK";, "Age Unknown"     },
-  { "http://ns.useplus.org/ldf/vocab/AG-A25";, "Age 25 or Over"  },
-  { "http://ns.useplus.org/ldf/vocab/AG-A24";, "Age 24"          },
-  { "http://ns.useplus.org/ldf/vocab/AG-A23";, "Age 23"          },
-  { "http://ns.useplus.org/ldf/vocab/AG-A22";, "Age 22"          },
-  { "http://ns.useplus.org/ldf/vocab/AG-A21";, "Age 21"          },
-  { "http://ns.useplus.org/ldf/vocab/AG-A20";, "Age 20"          },
-  { "http://ns.useplus.org/ldf/vocab/AG-A19";, "Age 19"          },
-  { "http://ns.useplus.org/ldf/vocab/AG-A18";, "Age 18"          },
-  { "http://ns.useplus.org/ldf/vocab/AG-A17";, "Age 17"          },
-  { "http://ns.useplus.org/ldf/vocab/AG-A16";, "Age 16"          },
-  { "http://ns.useplus.org/ldf/vocab/AG-A15";, "Age 15"          },
-  { "http://ns.useplus.org/ldf/vocab/AG-U14";, "Age 14 or Under" }
+  { "http://ns.useplus.org/ldf/vocab/AG-UNK";, N_("Age Unknown")     },
+  { "http://ns.useplus.org/ldf/vocab/AG-A25";, N_("Age 25 or Over")  },
+  { "http://ns.useplus.org/ldf/vocab/AG-A24";, N_("Age 24")          },
+  { "http://ns.useplus.org/ldf/vocab/AG-A23";, N_("Age 23")          },
+  { "http://ns.useplus.org/ldf/vocab/AG-A22";, N_("Age 22")          },
+  { "http://ns.useplus.org/ldf/vocab/AG-A21";, N_("Age 21")          },
+  { "http://ns.useplus.org/ldf/vocab/AG-A20";, N_("Age 20")          },
+  { "http://ns.useplus.org/ldf/vocab/AG-A19";, N_("Age 19")          },
+  { "http://ns.useplus.org/ldf/vocab/AG-A18";, N_("Age 18")          },
+  { "http://ns.useplus.org/ldf/vocab/AG-A17";, N_("Age 17")          },
+  { "http://ns.useplus.org/ldf/vocab/AG-A16";, N_("Age 16")          },
+  { "http://ns.useplus.org/ldf/vocab/AG-A15";, N_("Age 15")          },
+  { "http://ns.useplus.org/ldf/vocab/AG-U14";, N_("Age 14 or Under") }
 };
 
 /* Urgency */
 static const gchar *urgency[] =
 {
-  "None", "High", "2", "3", "4", "Normal", "6", "7", "Low"
+  N_("None"), N_("High"), N_("2"), N_("3"), N_("4"), N_("Normal"), N_("6"), N_("7"), N_("Low")
 };
 
 /* Marked */
 static const combobox_int_tag marked[] =
 {
-  { -1,     "Unknown"       }, // DO NOT SAVE
-  {  TRUE,  "Copyrighted"   }, // TRUE
-  {  FALSE, "Public Domain" }, // FALSE
+  { -1,     N_("Unknown")       }, // DO NOT SAVE
+  {  TRUE,  N_("Copyrighted")   }, // TRUE
+  {  FALSE, N_("Public Domain") }, // FALSE
 };
 
 /* Phone Types */
 static const combobox_str_tag phone_types[] =
 {
-  { "",                                      "Select a value" },
-  { "http://ns.useplus.org/ldf/vocab/work";,  "Work"  },
-  { "http://ns.useplus.org/ldf/vocab/cell";,  "Cell"  },
-  { "http://ns.useplus.org/ldf/vocab/fax";,   "Fax"   },
-  { "http://ns.useplus.org/ldf/vocab/home";,  "Home"  },
-  { "http://ns.useplus.org/ldf/vocab/pager";, "Pager" }
+  { "",                                      N_("Select a value") },
+  { "http://ns.useplus.org/ldf/vocab/work";,  N_("Work")  },
+  { "http://ns.useplus.org/ldf/vocab/cell";,  N_("Cell")  },
+  { "http://ns.useplus.org/ldf/vocab/fax";,   N_("Fax")   },
+  { "http://ns.useplus.org/ldf/vocab/home";,  N_("Home")  },
+  { "http://ns.useplus.org/ldf/vocab/pager";, N_("Pager") }
 };
 
 /* DICOM Patient Sex
@@ -329,28 +329,28 @@ static const combobox_str_tag phone_types[] =
  */
 static const combobox_str_tag dicom[] =
 {
-  { "",        "Select a value" },
-  { "male",    "Male"    },
-  { "female",  "Female"  },
-  { "other",   "Other"   },
+  { "",        N_("Select a value") },
+  { "male",    N_("Male")    },
+  { "female",  N_("Female")  },
+  { "other",   N_("Other")   },
 };
 
 /* GPS Altitute Ref */
 static const gchar *gpsaltref[] =
 {
-  "Unknown", "Above Sea Level", "Below Sea Level"
+  N_("Unknown"), N_("Above Sea Level"), N_("Below Sea Level")
 };
 
 /* GPS Latitute Ref */
 static const gchar *gpslatref[] =
 {
-  "Unknown", "North", "South"
+  N_("Unknown"), N_("North"), N_("South")
 };
 
 /* GPS Longitute Ref */
 static const gchar *gpslngref[] =
 {
-  "Unknown", "East", "West"
+  N_("Unknown"), N_("East"), N_("West")
 };
 
 /* GPS Measurement System */
diff --git a/po-plug-ins/POTFILES.in b/po-plug-ins/POTFILES.in
index 8936794..7a90563 100644
--- a/po-plug-ins/POTFILES.in
+++ b/po-plug-ins/POTFILES.in
@@ -223,6 +223,7 @@ plug-ins/map-object/map-object-apply.c
 plug-ins/map-object/map-object-main.c
 plug-ins/map-object/map-object-ui.c
 plug-ins/metadata/metadata-editor.c
+plug-ins/metadata/metadata-tags.h
 plug-ins/metadata/metadata-viewer.c
 plug-ins/pagecurl/pagecurl.c
 plug-ins/print/print-draw-page.c


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]