Gimp.PlugIn::set_i18n
@accepts(Gimp.PlugIn, unicode, unicode, unicode)
@returns(bool)
def do_set_i18n(plug_in, procedure_name, gettext_domain, catalog_dir):
This method can be overridden by all plug-ins to customize internationalization of the plug-in.
This method will be called before initializing, querying or running procedure_name (respectively with [vfunc@PlugIn.init_procedures], [vfunc@PlugIn.query_procedures] or with the `run()` function set in `Gimp.ImageProcedure.new`).
By default, GIMP plug-ins look up gettext compiled message catalogs in the subdirectory `locale/` under the plug-in folder (same folder as `Gimp.get_progname`) with a text domain equal to the plug-in name (regardless procedure_name). It is unneeded to override this method if you follow this localization scheme.
If you wish to disable localization or localize with another system, simply set the method to None, or possibly implement this method to do something useful for your usage while returning False.
If you wish to tweak the gettext_domain or the catalog_dir, return True and allocate appropriate gettext_domain and/or catalog_dir (these use the default if set None).
Note that catalog_dir must be a relative path, encoded as UTF-8, subdirectory of the directory of `Gimp.get_progname`. The domain names "gimp30-std-plug-ins", "gimp30-script-fu" and "gimp30-python" are reserved and can only be used with a None catalog_dir. These will use the translation catalogs installed for core plug-ins, so you are not expected to use these for your plug-ins, except if you are making a core plug-in. More domain names may become reserved so we discourage using a gettext domain starting with "gimp30-".
When localizing your plug-in this way, GIMP also binds gettext_domain to the UTF-8 encoding.
Since 3.0
- plug_in
a Gimp.PlugIn.
- procedure_name
procedure name.
- gettext_domain
Gettext domain. If None, it defaults to the plug-in name as determined by the directory the binary is called from.
- catalog_dir
relative path to a subdirectory of the plug-in folder containing the compiled Gettext message catalogs. If None, it defaults to "locale/".
- Returns
True if this plug-in will use Gettext localization. You may return False if you wish to disable localization or set it up differently.