I use color labels in darktable as markers for my RAW developing workflow. At the end I find myself always appending a color label filter to the collection module in lighttable, and I change this filter a lot during a session. So I thought it would be a good idea to create global keyboard shortcuts (Shift+F1…F5) for these actions.
My first approach was to search for a Lua script, so I discovered https://github.com/darktable-org/lua-scripts/blob/master/contrib/CollectHelper.lua, which does something similar but is based on the current image selection, not working globally. So I just added a new local function to it and registered 5 events for shortcuts which can be assigned via preferences.
My problem is:
If I use darktable set to German language, the filter data of the collection module also expects an input in german language for color labels. You must enter “Rot” instead of “red”. That means CollectHelper.lua doesn’t work for me either.
As a correct translation is currently mandatory from functionally aspect and out of scope of the script, I think the best approach to achieve working functionality would be accessing the (official) “darktable” text domain for gettext from within the Lua script:
-- for color labels we use global darktable translations gettext.bindtextdomain("darktable","/opt/darktable-test/share/locale/") local label_red = gettext.dgettext("darktable", 'red') local label_yellow = gettext.dgettext("darktable", 'yellow') etc. pp.
This is working fine for me, but is obviously not much interoperable as I need to access the translation folder by absolute path. The Lua API manual only lists environment variables for darktable.configuration.config_dir. Is there a better solution or is this even so welcome as a feature to be integrated into darktable?