libgimp: improve gimp_procedure_add_menu_path() docs regarding localization.

This was the last remaining bit in #8124. Basically I needed to check how
localization of menu paths worked. I was thinking of maybe have 2 arguments to
gimp_procedure_add_menu_path(), one non-localized (for default menu paths) and
one localized by the plug-in (for custom menus). That would break all plug-ins,
but also looking at our code, it's complicated to do right.

Instead let's just keep current API and add an example in function docs. We'll
see how we can improve the API if the very hypothetical problem I am foreseeing
actually happens some day: say a word in English translates to e.g. "Filters" in
some other language, whereas English "Filters" translates to yet another term;
in such case, this new menu would still merge with the default /Filters/ menu
when localized in this language, so we'd have the weird situation where the
custom menu label would have passed through 2 translations somehow.

But let's see how it goes. If we really need, in the future, we can deprecate
gimp_procedure_add_menu_path() and add a gimp_procedure_add_menu_paths() with a
base_path and a custom_path, while the custom_path would be expected to be
already translated.
This commit is contained in:
Jehan 2022-10-26 00:39:40 +02:00
parent 255cab6b43
commit 92caf44817

View file

@ -824,8 +824,19 @@ gimp_procedure_get_menu_label (GimpProcedure *procedure)
* Adds a menu path to the procedure. Only procedures which have a menu
* label can add a menu path.
*
* Menu paths are untranslated paths to menus and submenus with the
* syntax `<Prefix>/Path/To/Submenu`, for example `<Image>/Layer/Transform`
* Menu paths are untranslated paths to known menus and submenus with the
* syntax `<Prefix>/Path/To/Submenu`, for example `<Image>/Layer/Transform`.
* GIMP will localize these.
* Nevertheless you should localize unknown parts of the path. For instance, say
* you want to create procedure to create customized layers and add a `Create`
* submenu which you want to localize from your plug-in with gettext. You could
* call:
*
* ```
* gimp_procedure_add_menu_path (procedure,
* g_build_path ("/", "<Image>/Layer",
* _("Create"), NULL));
* ```
*
* See also: gimp_plug_in_add_menu_branch().
*