Working with modules from Lua scripts in darktable

I’ll try and test. I have to set up a VM and then set a different locale

1 Like

Does it depend on the VM/OS locale? Not only on the darktable setting?

Nevertheless, I am running EndeavourOS with German locale.

@supertobi, is translation working for you?

I would need to install additional language packs in order to do i18n. I tried just setting LANG and LOCALE, but they both went back to C since I didn’t have the other language packs.

what does that mean?

English

I figured it out. The translation files have to be converted from text to binary (.po files to .mo files) using msgfmt.

To get examples/gettextExample.lua to work you need to go to <your lua scripts directory>/locale/de_DE/LC_MESSAGES and run the command
msgfmt -v ../../../examples/de_DE/LC_MESSAGES/gettextExample.po -o gettextExample.mo

Then try running the script and you should see the correct output.

thats what I did…

What is the LANG environment variable set to? Mine was de_DE.utf8

same for me:
env: „de_DE.UTF-8“

let me try it on a “clean” VM.

I will do that on Tuesday or Wednesday.

@wpferguson : It works if I rename the locale folder “de_DE” to “de”. Same for Spanish “es_ES” and “es”.

You discussed this in another (older) thread: German script translation: charset UTF-8 deficient on Windows 10 · Issue #244 · darktable-org/lua-scripts · GitHub

For me, it is okay now. It works even outside the darktable config folder, in a separate folder below the script file (if I extend the package.path in the luarc file). It works on Arch based EndeavourOS and Windows 10 (VM).

image

The .po file is quite simple, it refers to de_DE and UTF-8 and it must be transformed to .mo as described:

Now I can start with the actual translation :slight_smile: I’ll start with the German translation, then the Spanish can follow.

2 Likes

I did rename the de_DE to de but it fails to start for me on Manjaro/Arch 4.5.0+2~g41cb1baa1d

Do you use the newest version 1.2.0 of the script, as released today?

For me, it works with Arch-based EndeavourOs, quite similar to Manjaro.

Do you get any error message, starting it with darktable -d lua?

No error messages with -d lua startup
The require is in luarc correctly
and the 1.2.0 module sits in the examples
It shows correctly in the scripts
… simply fails to load

My Error:
Now shows the folllowing:
34.4903 LUA ERROR: script_manager.lua: activate: 367: Error loading examples/InitialWorkflowModule
34.4904 LUA ERROR: script_manager.lua: activate: 368: Error message: module ‘examples/Darktable-Initial-Workflow-Module-1.2.0/InitialWorkflowModule’ not found:
no field package.preload[‘examples/Darktable-Initial-Workflow-Module-1.2.0/InitialWorkflowModule’]
no file ‘/usr/share/lua/5.4/examples/Darktable-Initial-Workflow-Module-1/2/0/InitialWorkflowModule.lua’
no file ‘/usr/share/lua/5.4/examples/Darktable-Initial-Workflow-Module-1/2/0/InitialWorkflowModule/init.lua’
no file ‘/usr/lib/lua/5.4/examples/Darktable-Initial-Workflow-Module-1/2/0/InitialWorkflowModule.lua’
no file ‘/usr/lib/lua/5.4/examples/Darktable-Initial-Workflow-Module-1/2/0/InitialWorkflowModule/init.lua’
no file ‘./examples/Darktable-Initial-Workflow-Module-1/2/0/InitialWorkflowModule.lua’
no file ‘./examples/Darktable-Initial-Workflow-Module-1/2/0/InitialWorkflowModule/init.lua’
no file ‘/usr/share/darktable/lua/examples/Darktable-Initial-Workflow-Module-1/2/0/InitialWorkflowModule.lua’
no file ‘/home/david/.config/darktable/lua/examples/Darktable-Initial-Workflow-Module-1/2/0/InitialWorkflowModule.lua’
no file ‘/usr/lib/lua/5.4/examples/Darktable-Initial-Workflow-Module-1/2/0/InitialWorkflowModule.so’
no file ‘/usr/lib/lua/5.4/loadall.so’
no file ‘./examples/Darktable-Initial-Workflow-Module-1/2/0/InitialWorkflowModule.so’
no file ‘/usr/lib/lua/5.4/examples/Darktable-Initial-Workflow-Module-1.so’
no file ‘/usr/lib/lua/5.4/loadall.so’
no file ‘./examples/Darktable-Initial-Workflow-Module-1.so’

does any of these filenames match your installation?

Looks like no files correctly placed in /usr/share or /usr/lib areas … only files in /.config location
I guess I need to manually install as needed … bit strange

I did not use script manager for some month.

Now, with script manager, I get the same messages as you.

Could you require the script in luarc directly, as described in my readme?

This is in my luarc
require “tools/script_manager”

you could try this:

require“examples/Darktable-Initial-Workflow-Module-1.2.0/InitialWorkflowModule”

this points to the file directly, without script manager. If you do not need script manager, you can comment it out with –

– require “tools/script_manager”

second option: You can extract the script files somewhere else and use

package.path = package.path … “;[any path]/Darktable-Initial-Workflow-Module-1.2.0/?.lua”
require “InitialWorkflowModule”