darktable
darktable copied to clipboard
preset and style shortcut fixes
fixes #12139 fixes #11502 corrects #12208
Solves thee issues: Issue 1: Defining or renaming presets for lib modules would previously not correctly manage the associated actions (they'd still be called "new preset") so shortcuts could only be defined after a restart. This should now work correctly.
Issue 2: preset and style names containing a pipe ("|"). There was "some" initial support in inputng for the new gnome "contexted translations" style, which broke these presets/styles. Since preset/style names are internally already stored in translated form, they are now not translated again when setting up the corresponding actions.
Issue 3:
The recently introduced N_("selected images action", "group") breaks shortcuts to that button when switching languages.
Previously the translation context was separately supplied to g_dpgettext2 (which requires either storing a context for each string or specific contexts per use case, like "blendmode" for dt_develop_blend_mode_names, which then forces a separate translation for all strings in that context even if they don't deviate from the normal meaning).
The "new" gnome way is to only specify a context, in the string itself, for strings that require a separate context , using "context|string". These are then translated using Q_() instead of _().
To fully switch to this new way, we should switch from intltool to gettext (https://wiki.gnome.org/MigratingFromIntltoolToGettext). We could then instruct it to parse the new format when used in N_(). Instead, I have here redefined NC_(), which is used in only a few locations (for example to correct #12208), to pass the combined string and process it at the other end using Q_(). Doing the full gettext migration would allow supporting this functionality in introspection as well.
I have not yet implemented full contextual translation support everywhere that N_ is used. Obviously button labels work (for the group button). dt_bauhaus_widget_set_label should fully work, as well as combobox items, but since none of these have existing cases with contexted translations, actually using NC_ here might uncover issues (that should be easy to fix). Testing is hard if there are no use cases...
dt_develop_blend_mode_names could be cleaned up (meaning the "blendmode" context removed) except for those modes where the translation should actually deviate from the non-contexted version (if there are any; this is not a quick check).
@dterrahe : Even if a bug fix I'm wondering if this is safe for 4.0.1? Looks like a bit invasive. How do you feel?
Agreed; it would be better to have this in master first, so it will get thoroughly tested before release ;-)
In the OP I'm kind of making the case to switch to gettext in the build process, but I'm not that knowledgeable in that regard (especially the cross-platform consequences) so might be a better job for someone else.
@TurboGit my preferred order would be to merge this after #12338. There are some conflicts between the two. Resolving those here would make this PR smaller, but also easier to revert out if problems do occur.
@dterrahe : Noted, waiting for wpferguson feedback on #12338.
Yes please.