Commit 18c37f70 authored by Jehan's avatar Jehan
Browse files

plug-ins, libgimp: override set_i18n() for all our core plug-ins.

Hence avoiding the stderr messages. These are going to be localized with
centrally installed catalogs "gimp*-std-plugins", "gimp*-script-fu" and
"gimp*-python".

We now handle core plug-in localizations differently and in particular,
with kind of a reverse logic:

- We don't consider "gimp*-std-plugins" to be the default catalog
  anymore. It made sense in the old world where we would consider the
  core plug-ins to be the most important and numerous ones. But we want
  to push a world where people are even more encouraged to develop their
  own plug-ins. These won't use the standard catalog anymore (because
  there are nearly no reasons that the strings are the same, it's only a
  confusing logic). So let's explicitly set the standard catalogs with
  DEFINE_STD_SET_I18N macro (which maps to a different catalog for
  script-fu plug-ins).
- Doing something similar for Python plug-ins which have again their own
  catalog.
- Getting rid of the INIT_I18N macro since now all the locale domain
  binding is done automatically by libgimp when using the set_i18n()
  method infrastructure.
parent 4b9d8a56
......@@ -27,16 +27,19 @@
#include <glib/gi18n.h>
#ifndef HAVE_BIND_TEXTDOMAIN_CODESET
# define bind_textdomain_codeset(Domain, Codeset) (Domain)
#endif
#define INIT_I18N() G_STMT_START{ \
bindtextdomain (GETTEXT_PACKAGE"-std-plug-ins", \
gimp_locale_directory ()); \
bind_textdomain_codeset (GETTEXT_PACKAGE"-std-plug-ins", "UTF-8"); \
textdomain (GETTEXT_PACKAGE"-std-plug-ins"); \
}G_STMT_END
#define DEFINE_STD_SET_I18N \
static gboolean \
set_i18n (GimpPlugIn *plug_in, \
const gchar *procedure_name, \
gchar **gettext_domain, \
gchar **catalog_dir) \
{ \
*gettext_domain = g_strdup (GETTEXT_PACKAGE"-std-plug-ins"); \
return TRUE; \
};
#define STD_SET_I18N set_i18n
#endif /* __STDPLUGINS_INTL_H__ */
......@@ -131,6 +131,8 @@ static void align_layers_scale_entry_update_int (GimpLabelSpin
G_DEFINE_TYPE (AlignLayers, align_layers, GIMP_TYPE_PLUG_IN)
GIMP_MAIN (ALIGN_LAYERS_TYPE)
DEFINE_STD_SET_I18N
/* dialog variables */
typedef struct
......@@ -162,6 +164,7 @@ align_layers_class_init (AlignLayersClass *klass)
plug_in_class->query_procedures = align_layers_query_procedures;
plug_in_class->create_procedure = align_layers_create_procedure;
plug_in_class->set_i18n = STD_SET_I18N;
}
static void
......@@ -242,8 +245,6 @@ align_layers_run (GimpProcedure *procedure,
GList *layers;
gint layer_num;
INIT_I18N ();
switch ( run_mode )
{
case GIMP_RUN_INTERACTIVE:
......
......@@ -115,6 +115,7 @@ static gboolean is_ms_tag (const gchar *str,
G_DEFINE_TYPE (Optimize, optimize, GIMP_TYPE_PLUG_IN)
GIMP_MAIN (OPTIMIZE_TYPE)
DEFINE_STD_SET_I18N
/* Global widgets'n'stuff */
......@@ -134,6 +135,7 @@ optimize_class_init (OptimizeClass *klass)
plug_in_class->query_procedures = optimize_query_procedures;
plug_in_class->create_procedure = optimize_create_procedure;
plug_in_class->set_i18n = STD_SET_I18N;
}
static void
......@@ -316,7 +318,6 @@ optimize_run (GimpProcedure *procedure,
const gchar *name = gimp_procedure_get_name (procedure);
gboolean diff_only = FALSE;
INIT_I18N ();
gegl_init (NULL, NULL);
if (! strcmp (name, OPTIMIZE_PROC))
......
......@@ -162,6 +162,7 @@ static gboolean is_ms_tag (const gchar *str,
G_DEFINE_TYPE (Play, play, GIMP_TYPE_PLUG_IN)
GIMP_MAIN (PLAY_TYPE)
DEFINE_STD_SET_I18N
/* Global widgets'n'stuff */
......@@ -217,6 +218,7 @@ play_class_init (PlayClass *klass)
plug_in_class->query_procedures = play_query_procedures;
plug_in_class->create_procedure = play_create_procedure;
plug_in_class->set_i18n = STD_SET_I18N;
}
static void
......@@ -275,7 +277,6 @@ play_run (GimpProcedure *procedure,
const GimpValueArray *args,
gpointer run_data)
{
INIT_I18N ();
gegl_init (NULL, NULL);
image = _image;
......
......@@ -99,6 +99,7 @@ static void apply_blinds (GimpDrawable *drawable)
G_DEFINE_TYPE (Blinds, blinds, GIMP_TYPE_PLUG_IN)
GIMP_MAIN (BLINDS_TYPE)
DEFINE_STD_SET_I18N
/* Array to hold each size of fans. And no there are not each the
......@@ -124,6 +125,7 @@ blinds_class_init (BlindsClass *klass)
plug_in_class->query_procedures = blinds_query_procedures;
plug_in_class->create_procedure = blinds_create_procedure;
plug_in_class->set_i18n = STD_SET_I18N;
}
static void
......@@ -206,7 +208,6 @@ blinds_run (GimpProcedure *procedure,
{
GimpDrawable *drawable;
INIT_I18N ();
gegl_init (NULL, NULL);
if (n_drawables != 1)
......
......@@ -81,6 +81,7 @@ static void thickness_callback (GtkWidget *widget,
G_DEFINE_TYPE (BorderAverage, border_average, GIMP_TYPE_PLUG_IN)
GIMP_MAIN (BORDER_AVERAGE_TYPE)
DEFINE_STD_SET_I18N
static gint borderaverage_thickness = 3;
......@@ -105,6 +106,7 @@ border_average_class_init (BorderAverageClass *klass)
plug_in_class->query_procedures = border_average_query_procedures;
plug_in_class->create_procedure = border_average_create_procedure;
plug_in_class->set_i18n = STD_SET_I18N;
}
static void
......@@ -183,7 +185,6 @@ border_average_run (GimpProcedure *procedure,
GimpRGB result_color = { 0.0, };
GeglBuffer *buffer;
INIT_I18N ();
gegl_init (NULL, NULL);
if (n_drawables != 1)
......
......@@ -85,6 +85,7 @@ static void busy_dialog_response (GtkDialog *di
G_DEFINE_TYPE (BusyDialog, busy_dialog, GIMP_TYPE_PLUG_IN)
GIMP_MAIN (BUSY_DIALOG_TYPE)
DEFINE_STD_SET_I18N
static void
busy_dialog_class_init (BusyDialogClass *klass)
......@@ -93,6 +94,7 @@ busy_dialog_class_init (BusyDialogClass *klass)
plug_in_class->query_procedures = busy_dialog_query_procedures;
plug_in_class->create_procedure = busy_dialog_create_procedure;
plug_in_class->set_i18n = STD_SET_I18N;
}
static void
......@@ -178,8 +180,6 @@ busy_dialog_run (GimpProcedure *procedure,
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpRunMode run_mode;
INIT_I18N ();
run_mode = GIMP_VALUES_GET_ENUM (args, 0);
switch (run_mode)
{
......
......@@ -86,6 +86,7 @@ static void check_size_update_callback (GtkWidget *widget);
G_DEFINE_TYPE (Checkerboard, checkerboard, GIMP_TYPE_PLUG_IN)
GIMP_MAIN (CHECKERBOARD_TYPE)
DEFINE_STD_SET_I18N
static CheckVals cvals =
......@@ -102,6 +103,7 @@ checkerboard_class_init (CheckerboardClass *klass)
plug_in_class->query_procedures = checkerboard_query_procedures;
plug_in_class->create_procedure = checkerboard_create_procedure;
plug_in_class->set_i18n = STD_SET_I18N;
}
static void
......@@ -172,7 +174,6 @@ checkerboard_run (GimpProcedure *procedure,
{
GimpDrawable *drawable;
INIT_I18N ();
gegl_init (NULL, NULL);
if (n_drawables != 1)
......
......@@ -424,6 +424,7 @@ static gdouble parse_line_to_gdouble (FILE *file,
G_DEFINE_TYPE (Explorer, explorer, GIMP_TYPE_PLUG_IN)
GIMP_MAIN (EXPLORER_TYPE)
DEFINE_STD_SET_I18N
static GtkWidget *preview;
......@@ -474,6 +475,7 @@ explorer_class_init (ExplorerClass *klass)
plug_in_class->query_procedures = explorer_query_procedures;
plug_in_class->create_procedure = explorer_create_procedure;
plug_in_class->set_i18n = STD_SET_I18N;
}
static void
......@@ -548,8 +550,6 @@ explorer_run (GimpProcedure *procedure,
const GimpValueArray *args,
gpointer run_data)
{
INIT_I18N ();
if (n_drawables != 1)
{
GError *error = NULL;
......
......@@ -85,6 +85,7 @@ static gboolean remap_dialog (GimpImage *image,
G_DEFINE_TYPE (Remap, remap, GIMP_TYPE_PLUG_IN)
GIMP_MAIN (REMAP_TYPE)
DEFINE_STD_SET_I18N
static void
......@@ -94,6 +95,7 @@ remap_class_init (RemapClass *klass)
plug_in_class->query_procedures = remap_query_procedures;
plug_in_class->create_procedure = remap_create_procedure;
plug_in_class->set_i18n = STD_SET_I18N;
}
static void
......@@ -214,7 +216,6 @@ remap_run (GimpProcedure *procedure,
guchar map[256];
gint i;
INIT_I18N ();
gegl_init (NULL, NULL);
/* Make sure that the image is indexed */
......
......@@ -194,6 +194,7 @@ static void type_combo_callback (GimpIntComboBox *combo,
G_DEFINE_TYPE (Compose, compose, GIMP_TYPE_PLUG_IN)
GIMP_MAIN (COMPOSE_TYPE)
DEFINE_STD_SET_I18N
/* Decompositions availables.
......@@ -344,6 +345,7 @@ compose_class_init (ComposeClass *klass)
plug_in_class->query_procedures = compose_query_procedures;
plug_in_class->create_procedure = compose_create_procedure;
plug_in_class->set_i18n = STD_SET_I18N;
}
static void
......@@ -541,7 +543,6 @@ compose_run (GimpProcedure *procedure,
gint compose_by_drawable;
gint i;
INIT_I18N ();
gegl_init (NULL, NULL);
compose_by_drawable = ! strcmp (name, DRAWABLE_COMPOSE_PROC);
......
......@@ -143,6 +143,7 @@ static void MSRCR (guchar *src,
G_DEFINE_TYPE (Retinex, retinex, GIMP_TYPE_PLUG_IN)
GIMP_MAIN (RETINEX_TYPE)
DEFINE_STD_SET_I18N
static RetinexParams rvals =
......@@ -161,6 +162,7 @@ retinex_class_init (RetinexClass *klass)
plug_in_class->query_procedures = retinex_query_procedures;
plug_in_class->create_procedure = retinex_create_procedure;
plug_in_class->set_i18n = STD_SET_I18N;
}
static void
......@@ -250,7 +252,6 @@ retinex_run (GimpProcedure *procedure,
GimpDrawable *drawable;
gint x, y, width, height;
INIT_I18N ();
gegl_init (NULL, NULL);
if (n_drawables != 1)
......
......@@ -71,6 +71,7 @@ static void do_zcrop (GimpDrawable *drawable,
G_DEFINE_TYPE (Crop, crop, GIMP_TYPE_PLUG_IN)
GIMP_MAIN (CROP_TYPE)
DEFINE_STD_SET_I18N
static void
......@@ -80,6 +81,7 @@ crop_class_init (CropClass *klass)
plug_in_class->query_procedures = crop_query_procedures;
plug_in_class->create_procedure = crop_create_procedure;
plug_in_class->set_i18n = STD_SET_I18N;
}
static void
......@@ -137,7 +139,6 @@ crop_run (GimpProcedure *procedure,
{
GimpDrawable *drawable;
INIT_I18N ();
gegl_init (NULL, NULL);
gimp_progress_init (_("Zealous cropping"));
......
......@@ -377,6 +377,7 @@ static int p_save_pointfile (BenderDialog *cd,
G_DEFINE_TYPE (Bender, bender, GIMP_TYPE_PLUG_IN)
GIMP_MAIN (BENDER_TYPE)
DEFINE_STD_SET_I18N
static CRMatrix CR_basis =
......@@ -397,6 +398,7 @@ bender_class_init (BenderClass *klass)
plug_in_class->query_procedures = bender_query_procedures;
plug_in_class->create_procedure = bender_create_procedure;
plug_in_class->set_i18n = STD_SET_I18N;
}
static void
......@@ -666,7 +668,6 @@ bender_run (GimpProcedure *procedure,
GimpLayer *bent_layer = NULL;
GError *error = NULL;
INIT_I18N ();
gegl_init (NULL, NULL);
if (n_drawables != 1)
......
......@@ -150,6 +150,7 @@ static gchar * generate_filename (GimpImage *image,
G_DEFINE_TYPE (Decompose, decompose, GIMP_TYPE_PLUG_IN)
GIMP_MAIN (DECOMPOSE_TYPE)
DEFINE_STD_SET_I18N
#define CPN_RGBA_R { "R", N_("red"), 0.0, 1.0, FALSE }
......@@ -232,6 +233,7 @@ decompose_class_init (DecomposeClass *klass)
plug_in_class->query_procedures = decompose_query_procedures;
plug_in_class->create_procedure = decompose_create_procedure;
plug_in_class->set_i18n = STD_SET_I18N;
}
static void
......@@ -364,7 +366,6 @@ decompose_run (GimpProcedure *procedure,
gchar *tmp;
gint j;
INIT_I18N ();
gegl_init (NULL, NULL);
if (n_drawables != 1)
......
......@@ -175,6 +175,7 @@ static void util_fillReducedBuffer (guchar *dest,
G_DEFINE_TYPE (Merge, merge, GIMP_TYPE_PLUG_IN)
GIMP_MAIN (MERGE_TYPE)
DEFINE_STD_SET_I18N
static void
......@@ -184,6 +185,7 @@ merge_class_init (MergeClass *klass)
plug_in_class->query_procedures = merge_query_procedures;
plug_in_class->create_procedure = merge_create_procedure;
plug_in_class->set_i18n = STD_SET_I18N;
}
static void
......@@ -295,7 +297,6 @@ merge_run (GimpProcedure *procedure,
GimpDrawable *drawable;
DepthMerge dm;
INIT_I18N ();
gegl_init (NULL, NULL);
if (n_drawables != 1)
......
......@@ -129,6 +129,7 @@ static void preview_update (GtkWidget *previe
G_DEFINE_TYPE (Despeckle, despeckle, GIMP_TYPE_PLUG_IN)
GIMP_MAIN (DESPECKLE_TYPE)
DEFINE_STD_SET_I18N
/* Number of pixels in actual histogram falling into each category */
......@@ -146,6 +147,7 @@ despeckle_class_init (DespeckleClass *klass)
plug_in_class->query_procedures = despeckle_query_procedures;
plug_in_class->create_procedure = despeckle_create_procedure;
plug_in_class->set_i18n = STD_SET_I18N;
}
static void
......@@ -231,7 +233,6 @@ despeckle_run (GimpProcedure *procedure,
GimpProcedureConfig *config;
GimpDrawable *drawable;
INIT_I18N ();
gegl_init (NULL, NULL);
if (n_drawables != 1)
......
......@@ -90,6 +90,7 @@ static void destripe_scale_entry_update_int (GimpLabelSpin *entry,
G_DEFINE_TYPE (Destripe, destripe, GIMP_TYPE_PLUG_IN)
GIMP_MAIN (DESTRIPE_TYPE)
DEFINE_STD_SET_I18N
static DestripeValues vals =
......@@ -107,6 +108,7 @@ destripe_class_init (DestripeClass *klass)
plug_in_class->query_procedures = destripe_query_procedures;
plug_in_class->create_procedure = destripe_create_procedure;
plug_in_class->set_i18n = STD_SET_I18N;
}
static void
......@@ -171,7 +173,6 @@ destripe_run (GimpProcedure *procedure,
{
GimpDrawable *drawable;
INIT_I18N ();
gegl_init (NULL, NULL);
if (n_drawables != 1)
......
......@@ -87,6 +87,7 @@ static gboolean save_dialog (GimpProcedure *procedure,
G_DEFINE_TYPE (Ascii, ascii, GIMP_TYPE_PLUG_IN)
GIMP_MAIN (ASCII_TYPE)
DEFINE_STD_SET_I18N
static void
......@@ -96,6 +97,7 @@ ascii_class_init (AsciiClass *klass)
plug_in_class->query_procedures = ascii_query_procedures;
plug_in_class->create_procedure = ascii_create_procedure;
plug_in_class->set_i18n = STD_SET_I18N;
}
static void
......@@ -171,7 +173,6 @@ ascii_save (GimpProcedure *procedure,
GimpExportReturn export = GIMP_EXPORT_CANCEL;
GError *error = NULL;
INIT_I18N ();
gegl_init (NULL, NULL);
config = gimp_procedure_create_config (procedure);
......
......@@ -92,6 +92,7 @@ static gboolean need_palette (GFile *file,
G_DEFINE_TYPE (Cel, cel, GIMP_TYPE_PLUG_IN)
GIMP_MAIN (CEL_TYPE)
DEFINE_STD_SET_I18N
static gchar *palette_file = NULL;
......@@ -105,6 +106,7 @@ cel_class_init (CelClass *klass)
plug_in_class->query_procedures = cel_query_procedures;
plug_in_class->create_procedure = cel_create_procedure;
plug_in_class->set_i18n = STD_SET_I18N;
}
static void
......@@ -207,7 +209,6 @@ cel_load (GimpProcedure *procedure,
gboolean needs_palette = FALSE;
GError *error = NULL;
INIT_I18N ();
gegl_init (NULL, NULL);
if (run_mode != GIMP_RUN_NONINTERACTIVE)
......@@ -280,7 +281,6 @@ cel_save (GimpProcedure *procedure,
GimpExportReturn export = GIMP_EXPORT_CANCEL;
GError *error = NULL;
INIT_I18N ();
gegl_init (NULL, NULL);
switch (run_mode)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment