From 92caf448172c7a5ab296c895c19c9dbe345f7ef5 Mon Sep 17 00:00:00 2001 From: Jehan Date: Wed, 26 Oct 2022 00:39:40 +0200 Subject: [PATCH] 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. --- libgimp/gimpprocedure.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/libgimp/gimpprocedure.c b/libgimp/gimpprocedure.c index 870c4cb572..03d4144180 100644 --- a/libgimp/gimpprocedure.c +++ b/libgimp/gimpprocedure.c @@ -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 `/Path/To/Submenu`, for example `/Layer/Transform` + * Menu paths are untranslated paths to known menus and submenus with the + * syntax `/Path/To/Submenu`, for example `/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 ("/", "/Layer", + * _("Create"), NULL)); + * ``` * * See also: gimp_plug_in_add_menu_branch(). *