[gimp] plug-ins: properly localize core Python plug-ins.



commit 208d415a1ad96614f9038421b24a750283875ca1
Author: Jehan <jehan girinstud io>
Date:   Thu May 26 00:26:25 2022 +0200

    plug-ins: properly localize core Python plug-ins.
    
    - Set the "gimp30-python" Gettext domain and bind it to the proper
      locale directory as installed by GIMP.
    - Localize various strings with gettext.
    - Remove calls to self.set_translation_domain() in
      do_query_procedures(). This is technically wrong right now but I am
      going to get rid of the menu item localization for plug-ins done by
      the core.

 plug-ins/python/colorxhtml.py                    | 10 ++--
 plug-ins/python/file-openraster.py               |  3 -
 plug-ins/python/foggify.py                       | 13 ++--
 plug-ins/python/gradients-save-as-css.py         | 14 ++---
 plug-ins/python/histogram-export.py              | 11 ++--
 plug-ins/python/palette-offset.py                | 16 +++--
 plug-ins/python/palette-sort.py                  | 27 ++++-----
 plug-ins/python/palette-to-gradient.py           | 24 ++++----
 plug-ins/python/python-console/python-console.py | 16 +++--
 plug-ins/python/python-eval.py                   |  3 -
 plug-ins/python/spyro-plus.py                    | 76 ++++++++++++------------
 11 files changed, 98 insertions(+), 115 deletions(-)
---
diff --git a/plug-ins/python/colorxhtml.py b/plug-ins/python/colorxhtml.py
index d030f73201..2564bfe613 100755
--- a/plug-ins/python/colorxhtml.py
+++ b/plug-ins/python/colorxhtml.py
@@ -29,8 +29,10 @@ from gi.repository import GLib
 from gi.repository import Gio
 
 import gettext
+textdomain = "gimp30-python"
+gettext.bindtextdomain(textdomain, Gimp.locale_directory())
+gettext.textdomain(textdomain)
 _ = gettext.gettext
-def N_(message): return message
 
 escape_table = {
     '&': '&amp;',
@@ -299,8 +301,6 @@ class ColorXhtml(Gimp.PlugIn):
 
     ## GimpPlugIn virtual methods ##
     def do_query_procedures(self):
-        self.set_translation_domain("gimp30-python",
-                                    Gio.file_new_for_path(Gimp.locale_directory()))
         return [ 'file-colorxhtml-save' ]
 
     def do_create_procedure(self, name):
@@ -311,10 +311,10 @@ class ColorXhtml(Gimp.PlugIn):
                                            save_colorxhtml, None)
             procedure.set_image_types("RGB")
             procedure.set_documentation (
-                N_("Save as colored HTML text"),
+                _("Save as colored HTML text"),
                 "Saves the image as colored XHTML text (based on Perl version by Marc Lehmann)",
                 name)
-            procedure.set_menu_label(N_("Colored HTML text"))
+            procedure.set_menu_label(_("Colored HTML text"))
             procedure.set_attribution("Manish Singh and Carol Spears",
                                       "(c) GPL V3.0 or later",
                                       "2003")
diff --git a/plug-ins/python/file-openraster.py b/plug-ins/python/file-openraster.py
index c78d776612..cffb53b29c 100755
--- a/plug-ins/python/file-openraster.py
+++ b/plug-ins/python/file-openraster.py
@@ -454,9 +454,6 @@ def load_ora(procedure, run_mode, file, args, data):
 class FileOpenRaster (Gimp.PlugIn):
     ## GimpPlugIn virtual methods ##
     def do_query_procedures(self):
-        self.set_translation_domain("gimp30-python",
-                                    Gio.file_new_for_path(Gimp.locale_directory()))
-
         return [ 'file-openraster-load-thumb',
                  'file-openraster-load',
                  'file-openraster-save' ]
diff --git a/plug-ins/python/foggify.py b/plug-ins/python/foggify.py
index 71b54c3217..57339b4073 100755
--- a/plug-ins/python/foggify.py
+++ b/plug-ins/python/foggify.py
@@ -26,8 +26,10 @@ import time
 import sys
 
 import gettext
+textdomain = "gimp30-python"
+gettext.bindtextdomain(textdomain, Gimp.locale_directory())
+gettext.textdomain(textdomain)
 _ = gettext.gettext
-def N_(message): return message
 
 def foggify(procedure, run_mode, image, n_drawables, drawables, args, data):
     config = procedure.create_config()
@@ -126,9 +128,6 @@ class Foggify (Gimp.PlugIn):
 
     ## GimpPlugIn virtual methods ##
     def do_query_procedures(self):
-        self.set_translation_domain("gimp30-python",
-                                    Gio.file_new_for_path(Gimp.locale_directory()))
-
         return [ 'python-fu-foggify' ]
 
     def do_create_procedure(self, name):
@@ -138,10 +137,10 @@ class Foggify (Gimp.PlugIn):
         procedure.set_image_types("RGB*, GRAY*");
         procedure.set_sensitivity_mask (Gimp.ProcedureSensitivityMask.DRAWABLE |
                                         Gimp.ProcedureSensitivityMask.DRAWABLES)
-        procedure.set_documentation (N_("Add a layer of fog"),
-                                     "Adds a layer of fog to the image.",
+        procedure.set_documentation (_("Add a layer of fog"),
+                                     _("Adds a layer of fog to the image."),
                                      name)
-        procedure.set_menu_label(N_("_Fog..."))
+        procedure.set_menu_label(_("_Fog..."))
         procedure.set_attribution("James Henstridge",
                                   "James Henstridge",
                                   "1999,2007")
diff --git a/plug-ins/python/gradients-save-as-css.py b/plug-ins/python/gradients-save-as-css.py
index 6f74025580..f562df1872 100755
--- a/plug-ins/python/gradients-save-as-css.py
+++ b/plug-ins/python/gradients-save-as-css.py
@@ -32,8 +32,10 @@ import time
 import sys
 
 import gettext
+textdomain = "gimp30-python"
+gettext.bindtextdomain(textdomain, Gimp.locale_directory())
+gettext.textdomain(textdomain)
 _ = gettext.gettext
-def N_(message): return message
 
 w3c_template = """background-image: linear-gradient(top, %s);\n"""
 moz_template = """background-image: -moz-linear-gradient(center top, %s);\n"""
@@ -136,8 +138,8 @@ class GradientsSaveAsCSS (Gimp.PlugIn):
    ## Parameters ##
     __gproperties__ = {
         "run-mode": (Gimp.RunMode,
-                     "Run mode",
-                     "The run mode",
+                     _("Run mode"),
+                     _("The run mode"),
                      Gimp.RunMode.NONINTERACTIVE,
                      GObject.ParamFlags.READWRITE),
         "gradient": (str,
@@ -150,8 +152,6 @@ class GradientsSaveAsCSS (Gimp.PlugIn):
 
     ## GimpPlugIn virtual methods ##
     def do_query_procedures(self):
-        self.set_translation_domain("gimp30-python",
-                                    Gio.file_new_for_path(Gimp.locale_directory()))
         return [ 'gradient-save-as-css' ]
 
     def do_create_procedure(self, name):
@@ -161,8 +161,8 @@ class GradientsSaveAsCSS (Gimp.PlugIn):
                                            Gimp.PDBProcType.PLUGIN,
                                            gradient_css_save, None)
             procedure.set_image_types("*")
-            procedure.set_documentation ("Creates a new palette from a given gradient",
-                                         "palette_from_gradient (gradient, number, segment_colors) -> None",
+            procedure.set_documentation (_("Creates a new palette from a given gradient"),
+                                         _("palette_from_gradient (gradient, number, segment_colors) -> 
None"),
                                          name)
             procedure.set_menu_label("Save as CSS...")
             procedure.set_attribution("Joao S. O. Bueno",
diff --git a/plug-ins/python/histogram-export.py b/plug-ins/python/histogram-export.py
index f8e933bc81..4f27cd6685 100644
--- a/plug-ins/python/histogram-export.py
+++ b/plug-ins/python/histogram-export.py
@@ -51,9 +51,10 @@ gi.require_version('Gtk', '3.0')
 from gi.repository import Gtk
 
 import gettext
+textdomain = "gimp30-python"
+gettext.bindtextdomain(textdomain, Gimp.locale_directory())
+gettext.textdomain(textdomain)
 _ = gettext.gettext
-def N_(message): return message
-
 
 class StringEnum:
     """
@@ -335,8 +336,6 @@ class HistogramExport(Gimp.PlugIn):
 
     ## GimpPlugIn virtual methods ##
     def do_query_procedures(self):
-        self.set_translation_domain("gimp30-python",
-                                    Gio.file_new_for_path(Gimp.locale_directory()))
         return ['histogram-export']
 
     def do_create_procedure(self, name):
@@ -348,10 +347,10 @@ class HistogramExport(Gimp.PlugIn):
 
             procedure.set_image_types("*")
             procedure.set_documentation (
-                N_("Exports the image histogram to a text file (CSV)"),
+                _("Exports the image histogram to a text file (CSV)"),
                 globals()["__doc__"],  # This includes the docstring, on the top of the file
                 name)
-            procedure.set_menu_label(N_("_Export histogram..."))
+            procedure.set_menu_label(_("_Export histogram..."))
             procedure.set_attribution("João S. O. Bueno",
                                       "(c) GPL V3.0 or later",
                                       "2014")
diff --git a/plug-ins/python/palette-offset.py b/plug-ins/python/palette-offset.py
index 3ce208a162..e38b7de338 100644
--- a/plug-ins/python/palette-offset.py
+++ b/plug-ins/python/palette-offset.py
@@ -24,8 +24,10 @@ from gi.repository import Gio
 import sys
 
 import gettext
+textdomain = "gimp30-python"
+gettext.bindtextdomain(textdomain, Gimp.locale_directory())
+gettext.textdomain(textdomain)
 _ = gettext.gettext
-def N_(message): return message
 
 class PaletteOffset (Gimp.PlugIn):
     ## Parameter: run-mode ##
@@ -67,8 +69,8 @@ class PaletteOffset (Gimp.PlugIn):
     ## Return: new-palette ##
     @GObject.Property(type=str,
                       default=None,
-                      nick="Name of the edited palette",
-                      blurb="Name of the newly created palette if read-only or the input palette otherwise")
+                      nick=_("Name of the edited palette"),
+                      blurb=_("Name of the newly created palette if read-only or the input palette 
otherwise"))
     def new_palette(self):
         return self.new_palette
 
@@ -78,10 +80,6 @@ class PaletteOffset (Gimp.PlugIn):
 
     ## GimpPlugIn virtual methods ##
     def do_query_procedures(self):
-        # Localization
-        self.set_translation_domain ("gimp30-python",
-                                     Gio.file_new_for_path(Gimp.locale_directory()))
-
         return [ "python-fu-palette-offset" ]
 
     def do_create_procedure(self, name):
@@ -89,8 +87,8 @@ class PaletteOffset (Gimp.PlugIn):
                                        Gimp.PDBProcType.PLUGIN,
                                        self.run, None)
         if name == 'python-fu-palette-offset':
-            procedure.set_menu_label(N_("_Offset Palette..."))
-            procedure.set_documentation(N_("Offset the colors in a palette"),
+            procedure.set_menu_label(_("_Offset Palette..."))
+            procedure.set_documentation(_("Offset the colors in a palette"),
                                         "palette_offset (palette, amount) -> modified_palette",
                                         "")
             procedure.set_attribution("Joao S. O. Bueno Calligaris, Carol Spears",
diff --git a/plug-ins/python/palette-sort.py b/plug-ins/python/palette-sort.py
index 34b20fb867..162ee6c8dd 100755
--- a/plug-ins/python/palette-sort.py
+++ b/plug-ins/python/palette-sort.py
@@ -34,9 +34,10 @@ from gi.repository import Gtk
 import sys
 
 import gettext
+textdomain = "gimp30-python"
+gettext.bindtextdomain(textdomain, Gimp.locale_directory())
+gettext.textdomain(textdomain)
 _ = gettext.gettext
-def N_(message): return message
-
 
 AVAILABLE_CHANNELS = (_("Red"), _("Green"), _("Blue"),
                       _("Luma (Y)"),
@@ -330,15 +331,15 @@ class PaletteSort (Gimp.PlugIn):
     ## Parameters ##
     __gproperties__ = {
         "run-mode": (Gimp.RunMode,
-                     "Run mode",
-                     "The run mode",
+                     _("Run mode"),
+                     _("The run mode"),
                      Gimp.RunMode.NONINTERACTIVE,
                      GObject.ParamFlags.READWRITE),
         # TODO. originally was:   (PF_PALETTE, "palette",  _("Palette"), ""),
         # Should probably be of type Gimp.Palette .
         "palette": (str,
                     _("Palette"),
-                    "Palette",
+                    _("Palette"),
                     "",
                     GObject.ParamFlags.READWRITE),
         "selections": (int,
@@ -362,7 +363,7 @@ class PaletteSort (Gimp.PlugIn):
                      GObject.ParamFlags.READWRITE),
         "ascending1": (bool,
                        _("_Ascending"),
-                        "Ascending",
+                       _("Ascending"),
                        True,
                        GObject.ParamFlags.READWRITE),
         # TODO: was  (PF_OPTION,   "channel2",    _("Secondary Channel to s_ort"), 5,
@@ -374,12 +375,12 @@ class PaletteSort (Gimp.PlugIn):
                      GObject.ParamFlags.READWRITE),
         "ascending2": (bool,
                        _("_Ascending"),
-                       "Ascending",
+                       _("Ascending"),
                        True,
                        GObject.ParamFlags.READWRITE),
         "quantize": (float,
                      _("_Quantization"),
-                     "Quantization",
+                     _("Quantization"),
                      0.0, 1.0, 0.0,
                      GObject.ParamFlags.READWRITE),
         # TODO: was (PF_OPTION,  "pchannel",    _("_Partitioning channel"), 3, AVAILABLE_CHANNELS),
@@ -390,22 +391,20 @@ class PaletteSort (Gimp.PlugIn):
                      GObject.ParamFlags.READWRITE),
         "pquantize": (float,
                      _("Partition q_uantization"),
-                     "Partition quantization",
+                     _("Partition quantization"),
                      0.0, 1.0, 0.0,
                      GObject.ParamFlags.READWRITE),
 
         # Returned value
         "new_palette": (str,
                         _("Palette"),
-                        "Palette",
+                        _("Palette"),
                         "",
                         GObject.ParamFlags.READWRITE),
     }
 
     ## GimpPlugIn virtual methods ##
     def do_query_procedures(self):
-        self.set_translation_domain("gimp30-python",
-                                    Gio.file_new_for_path(Gimp.locale_directory()))
         return ["python-fu-palette-sort"]
 
     def do_create_procedure(self, name):
@@ -414,12 +413,12 @@ class PaletteSort (Gimp.PlugIn):
             procedure = Gimp.Procedure.new(self, name,
                                            Gimp.PDBProcType.PLUGIN,
                                            self.run, None)
-            procedure.set_menu_label(N_("_Sort Palette..."))
+            procedure.set_menu_label(_("_Sort Palette..."))
 
             # FIXME: Write humanly readable help -
             # See for reference: https://gitlab.gnome.org/GNOME/gimp/-/issues/4368#note_763460
             procedure.set_documentation(
-                N_("Sort the colors in a palette"),
+                _("Sort the colors in a palette"),
                 dedent("""\
                     palette_sort (palette, selection, slice_expr, channel,
                     channel2, quantize, ascending, pchannel, pquantize) -> new_palette
diff --git a/plug-ins/python/palette-to-gradient.py b/plug-ins/python/palette-to-gradient.py
index 5e0317f946..d4af909338 100644
--- a/plug-ins/python/palette-to-gradient.py
+++ b/plug-ins/python/palette-to-gradient.py
@@ -22,8 +22,10 @@ from gi.repository import Gio
 import sys
 
 import gettext
+textdomain = "gimp30-python"
+gettext.bindtextdomain(textdomain, Gimp.locale_directory())
+gettext.textdomain(textdomain)
 _ = gettext.gettext
-def N_(message): return message
 
 def make_gradient(palette, num_segments, num_colors):
     gradient = Gimp.gradient_new(palette)
@@ -112,8 +114,8 @@ class PaletteToGradient (Gimp.PlugIn):
     ## Properties: return values ##
     @GObject.Property(type=str,
                       default="",
-                      nick="Name of the newly created gradient",
-                      blurb="Name of the newly created gradient")
+                      nick=_("Name of the newly created gradient"),
+                      blurb=_("Name of the newly created gradient"))
     def new_gradient(self):
         """Read-write integer property."""
         return self.new_gradient
@@ -124,10 +126,6 @@ class PaletteToGradient (Gimp.PlugIn):
 
     ## GimpPlugIn virtual methods ##
     def do_query_procedures(self):
-        # Localization
-        self.set_translation_domain ("gimp30-python",
-                                     Gio.file_new_for_path(Gimp.locale_directory()))
-
         return ['python-fu-palette-to-gradient',
                 'python-fu-palette-to-gradient-repeating']
 
@@ -136,14 +134,14 @@ class PaletteToGradient (Gimp.PlugIn):
                                        Gimp.PDBProcType.PLUGIN,
                                        run, None)
         if name == 'python-fu-palette-to-gradient':
-            procedure.set_menu_label(N_("Palette to _Gradient"))
-            procedure.set_documentation(N_("Create a gradient using colors from the palette"),
-                                        "Create a new gradient using colors from the palette.",
+            procedure.set_menu_label(_("Palette to _Gradient"))
+            procedure.set_documentation(_("Create a gradient using colors from the palette"),
+                                        _("Create a new gradient using colors from the palette."),
                                         "")
         elif name == 'python-fu-palette-to-gradient-repeating':
-            procedure.set_menu_label(N_("Palette to _Repeating Gradient"))
-            procedure.set_documentation(N_("Create a repeating gradient using colors from the palette"),
-                                        "Create a new repeating gradient using colors from the palette.",
+            procedure.set_menu_label(_("Palette to _Repeating Gradient"))
+            procedure.set_documentation(_("Create a repeating gradient using colors from the palette"),
+                                        _("Create a new repeating gradient using colors from the palette."),
                                         "")
         else:
             procedure = None
diff --git a/plug-ins/python/python-console/python-console.py 
b/plug-ins/python/python-console/python-console.py
index e5598033a4..b49dbc9317 100755
--- a/plug-ins/python/python-console/python-console.py
+++ b/plug-ins/python/python-console/python-console.py
@@ -32,8 +32,10 @@ import pyconsole
 #import gimpshelf, gimpui, pyconsole
 
 import gettext
+textdomain = "gimp30-python"
+gettext.bindtextdomain(textdomain, Gimp.locale_directory())
+gettext.textdomain(textdomain)
 _ = gettext.gettext
-def N_(message): return message
 
 PROC_NAME = 'python-fu-console'
 
@@ -331,7 +333,7 @@ class PythonConsole (Gimp.PlugIn):
     ## Properties: parameters ##
     @GObject.Property(type=Gimp.RunMode,
                       default=Gimp.RunMode.NONINTERACTIVE,
-                      nick="Run mode", blurb="The run mode")
+                      nick=_("Run mode"), blurb=_("The run mode"))
     def run_mode(self):
         """Read-write integer property."""
         return self.runmode
@@ -342,10 +344,6 @@ class PythonConsole (Gimp.PlugIn):
 
     ## GimpPlugIn virtual methods ##
     def do_query_procedures(self):
-        # Localization
-        self.set_translation_domain ("gimp30-python",
-                                     Gio.file_new_for_path(Gimp.locale_directory()))
-
         return [ PROC_NAME ]
 
     def do_create_procedure(self, name):
@@ -353,9 +351,9 @@ class PythonConsole (Gimp.PlugIn):
             procedure = Gimp.Procedure.new(self, name,
                                            Gimp.PDBProcType.PLUGIN,
                                            run, None)
-            procedure.set_menu_label(N_("Python _Console"))
-            procedure.set_documentation(N_("Interactive GIMP Python interpreter"),
-                                        "Type in commands and see results",
+            procedure.set_menu_label(_("Python _Console"))
+            procedure.set_documentation(_("Interactive GIMP Python interpreter"),
+                                        _("Type in commands and see results"),
                                         "")
             procedure.set_attribution("James Henstridge",
                                       "James Henstridge",
diff --git a/plug-ins/python/python-eval.py b/plug-ins/python/python-eval.py
index f351de2a85..b058b122f1 100644
--- a/plug-ins/python/python-eval.py
+++ b/plug-ins/python/python-eval.py
@@ -36,9 +36,6 @@ def code_eval(procedure, run_mode, code, args, data):
 class PythonEval (Gimp.PlugIn):
     ## GimpPlugIn virtual methods ##
     def do_query_procedures(self):
-        self.set_translation_domain("gimp30-python",
-                                    Gio.file_new_for_path(Gimp.locale_directory()))
-
         return ['python-fu-eval']
 
     def do_create_procedure(self, name):
diff --git a/plug-ins/python/spyro-plus.py b/plug-ins/python/spyro-plus.py
index e7110038ad..495b2b56b6 100755
--- a/plug-ins/python/spyro-plus.py
+++ b/plug-ins/python/spyro-plus.py
@@ -31,8 +31,10 @@ import time
 import sys
 
 import gettext
+textdomain = "gimp30-python"
+gettext.bindtextdomain(textdomain, Gimp.locale_directory())
+gettext.textdomain(textdomain)
 _ = gettext.gettext
-def N_(message): return message
 
 from math import pi, sin, cos, atan, atan2, fmod, radians, sqrt
 import gettext
@@ -2209,82 +2211,78 @@ class SpyrogimpPlusPlugin(Gimp.PlugIn):
     ## Parameters ##
     __gproperties__ = {
         "curve_type" : (int,
-                        "The curve type { Spyrograph (0), Epitrochoid (1), Sine (2), Lissajous(3) }",
-                        "The curve type { Spyrograph (0), Epitrochoid (1), Sine (2), Lissajous(3) }",
+                        _("The curve type { Spyrograph (0), Epitrochoid (1), Sine (2), Lissajous(3) }"),
+                        _("The curve type { Spyrograph (0), Epitrochoid (1), Sine (2), Lissajous(3) }"),
                         0, 3, 0,
                         GObject.ParamFlags.READWRITE),
         "shape": (int,
-                  "Shape of fixed gear",
-                  "Shape of fixed gear",
+                  _("Shape of fixed gear"),
+                  _("Shape of fixed gear"),
                   0, GLib.MAXINT, 0,
                   GObject.ParamFlags.READWRITE),
         "sides": (int,
-                  "Number of sides of fixed gear (3 or greater). Only used by some shapes.",
-                  "Number of sides of fixed gear (3 or greater). Only used by some shapes.",
+                  _("Number of sides of fixed gear (3 or greater). Only used by some shapes."),
+                  _("Number of sides of fixed gear (3 or greater). Only used by some shapes."),
                   3, GLib.MAXINT, 3,
                   GObject.ParamFlags.READWRITE),
         "morph": (float,
-                  "Morph shape of fixed gear, between 0 and 1. Only used by some shapes.",
-                  "Morph shape of fixed gear, between 0 and 1. Only used by some shapes.",
+                  _("Morph shape of fixed gear, between 0 and 1. Only used by some shapes."),
+                  _("Morph shape of fixed gear, between 0 and 1. Only used by some shapes."),
                   0.0, 1.0, 0.0,
                   GObject.ParamFlags.READWRITE),
         "fixed_teeth": (int,
-                        "Number of teeth for fixed gear",
-                        "Number of teeth for fixed gear",
+                        _("Number of teeth for fixed gear"),
+                        _("Number of teeth for fixed gear"),
                         0, GLib.MAXINT, 96,
                         GObject.ParamFlags.READWRITE),
         "moving_teeth": (int,
-                         "Number of teeth for moving gear",
-                         "Number of teeth for moving gear",
+                         _("Number of teeth for moving gear"),
+                         _("Number of teeth for moving gear"),
                          0, GLib.MAXINT, 36,
                          GObject.ParamFlags.READWRITE),
         "hole_percent": (float,
-                         "Location of hole in moving gear in percent, where 100 means that "
-                         "the hole is at the edge of the gear, and 0 means the hole is at the center",
-                         "Location of hole in moving gear in percent, where 100 means that "
-                         "the hole is at the edge of the gear, and 0 means the hole is at the center",
+                         _("Location of hole in moving gear in percent, where 100 means that "
+                         "the hole is at the edge of the gear, and 0 means the hole is at the center"),
+                         _("Location of hole in moving gear in percent, where 100 means that "
+                         "the hole is at the edge of the gear, and 0 means the hole is at the center"),
                          0.0, 100.0, 100.0,
                          GObject.ParamFlags.READWRITE),
         "margin": (int,
-                   "Margin from selection, in pixels",
-                   "Margin from selection, in pixels",
+                   _("Margin from selection, in pixels"),
+                   _("Margin from selection, in pixels"),
                    0, GLib.MAXINT, 0,
                    GObject.ParamFlags.READWRITE),
         "equal_w_h": (bool,
-                      "Make height and width equal",
-                      "Make height and width equal",
+                      _("Make height and width equal"),
+                      _("Make height and width equal"),
                       False,
                       GObject.ParamFlags.READWRITE),
         "pattern_rotation": (float,
-                             "Pattern rotation, in degrees",
-                             "Pattern rotation, in degrees",
+                             _("Pattern rotation, in degrees"),
+                             _("Pattern rotation, in degrees"),
                              -360.0, 360.0, 0.0,
                              GObject.ParamFlags.READWRITE),
         "shape_rotation": (float,
-                           "Shape rotation of fixed gear, in degrees",
-                           "Shape rotation of fixed gear, in degrees",
+                           _("Shape rotation of fixed gear, in degrees"),
+                           _("Shape rotation of fixed gear, in degrees"),
                            -360.0, 360.0, 0.0,
                            GObject.ParamFlags.READWRITE),
         "tool": (int,
-                 "Tool to use for drawing the pattern.",
-                 "Tool to use for drawing the pattern.",
+                 _("Tool to use for drawing the pattern."),
+                 _("Tool to use for drawing the pattern."),
                  0, GLib.MAXINT, 1,
                  GObject.ParamFlags.READWRITE),
         "long_gradient" : (bool,
-                           "Whether to apply a long gradient to match the length of the pattern. "
-                           "Only applicable to some of the tools.",
-                           "Whether to apply a long gradient to match the length of the pattern. "
-                           "Only applicable to some of the tools.",
+                           _("Whether to apply a long gradient to match the length of the pattern. "
+                           "Only applicable to some of the tools."),
+                           _("Whether to apply a long gradient to match the length of the pattern. "
+                           "Only applicable to some of the tools."),
                            False,
                            GObject.ParamFlags.READWRITE),
     }
 
     ## GimpPlugIn virtual methods ##
     def do_query_procedures(self):
-        # Localization
-        self.set_translation_domain("gimp30-python",
-                                    Gio.file_new_for_path(Gimp.locale_directory()))
-
         return [PROC_NAME]
 
     def do_create_procedure(self, name):
@@ -2294,11 +2292,11 @@ class SpyrogimpPlusPlugin(Gimp.PlugIn):
                                                 self.plug_in_spyrogimp, None)
             procedure.set_image_types("*")
             procedure.set_sensitivity_mask (Gimp.ProcedureSensitivityMask.DRAWABLE)
-            procedure.set_documentation (N_("Draw spyrographs using current tool settings and selection."),
-                                         "Uses current tool settings to draw Spyrograph patterns. "
-                                         "The size and location of the pattern is based on the current 
selection.",
+            procedure.set_documentation (_("Draw spyrographs using current tool settings and selection."),
+                                         _("Uses current tool settings to draw Spyrograph patterns. "
+                                         "The size and location of the pattern is based on the current 
selection."),
                                          name)
-            procedure.set_menu_label(N_("Spyrogimp..."))
+            procedure.set_menu_label(_("Spyrogimp..."))
             procedure.set_attribution("Elad Shahar",
                                       "Elad Shahar",
                                       "2018")


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