lua-scripts icon indicating copy to clipboard operation
lua-scripts copied to clipboard

POC: translation done by darktable.

Open TurboGit opened this issue 1 year ago • 19 comments

This is a POC on how Lua script translation could be handled directly in darktable.

The darktable part

  • Add lua-scripts has a submodule in src/external

  • Add all lua files into po/POTFILES.in

This will make it possible with the current main darktable translation workflow to also translate the scripts.

The Lua script part

  • As proposed in this PR remove the gettext domain, use a common one to share as much as possible the strings across darktable and all lua scripts.

  • Use common casing for all Lua strings. Indeed there is some string identical except for the casing. Again this is to share a maximum of string.

  • Remove any spaces in start or end of strings, the layout must not be done in strings. I see for example "of " and some other cases.

Redesign

  • As discussed in issue #438 we also want to redesign the Lua script description to be more uniform and structured. Those description must be done using _('...") to allow for translation. Some description are quite big, I'm wondering if we want this in the dt tooltip or maybe a lite description in dt tooltip and a full description in main dt documentation. To be discussed.

  • We probably want to have a string for the name of the module provided by the script. As I understand we use the script filename for the name today. This is not really user friendly, so better have a string for the name of the script which is displayed on the UI (as done for dt modules).

  • The redesigned of the UI with standard button as already discussed.

@wpferguson : This is my current idea to make Lua scripts a first class citizen. Let me know how it sounds to you.

I hope I have not missed something, but at least with this POC I was able to translate Lua scripts in French.

TurboGit avatar Jan 17 '24 11:01 TurboGit

@wpferguson : All this is quite some work, so if you agree with the general direction I'd propose to concentrate on the two scripts in this PR. The main script manager and the copy_paste_metadata plug-in. When (if) we can get this working properly then we'll have a clear idea of the transition for all others plug-ins.

TurboGit avatar Jan 17 '24 13:01 TurboGit

Remove any spaces in start or end of strings, the layout must not be done in strings. I see for example "of " and some other cases.

The problem is the way we format output, i.e.dt.print(_("export ")..tostring(number).." / "..tostring(total)). We could either .dt.print(_("export") .. " " ..tostring(number).." / "..tostring(total))or dt.print(string.format(_("export %d/%d", number, total))

wpferguson avatar Jan 17 '24 21:01 wpferguson

dt.print(string.format(_("export %d/%d", number, total))

Yes, seems close to what is done on darktable core.

TurboGit avatar Jan 17 '24 21:01 TurboGit

Does this match what you translated?

script_manager script_manager2 copypaste

wpferguson avatar Jan 17 '24 22:01 wpferguson

Does this match what you translated?

Yes I recognize the few strings I have translated there. So it's working.

TurboGit avatar Jan 18 '24 06:01 TurboGit

I think the next step should be to clean up what we have, before we start adding new things.

  • remove bindtextdomain statements
  • change gettext.dgettext to gettext.gettext
  • change translatable statements with variables to string.format()

wpferguson avatar Jan 18 '24 18:01 wpferguson

@TurboGit how do want to proceed on this? Do you want me to push what I have to your branch do you want to look at #455 and see if I've covered everything?

wpferguson avatar Apr 19 '24 18:04 wpferguson

@wpferguson : I'll have a look at #455 and we will decide what to do next.

TurboGit avatar Apr 20 '24 10:04 TurboGit

@TurboGit I think this is how we should proceed on this:

  • I'll add bindtextdomain back into #455 and merge it so we'll have better strings but it will still work.
  • It's late in the cycle to potentially drop a new set of strings on the translators so I think we should aim for 5.0 and start early in the cycle so that the translators have time to translate.

wpferguson avatar May 12 '24 20:05 wpferguson

@wpferguson : Agreed I keep pushing back on this because of other priorities, sorry for that. So yes we should aim at 5.0 now and start working on this just after 4.8 is out.

  • I'll add bindtextdomain back into ...

You mean that even if bindtestdomain is added we still have a proper translation for known strings in a different domain?

TurboGit avatar May 12 '24 20:05 TurboGit

If I put bindtextdomain back, then the current translations we have will still work, minus the strings I changed.

When we start 4.9, I'll bump the API then remove the bindtextdomain again and merge that into the development branch. Anyone using master will get the development branch to develop and test against.

wpferguson avatar May 12 '24 23:05 wpferguson

@TurboGit are we ready to start on this again?

wpferguson avatar Jul 31 '24 15:07 wpferguson

I'm not ready as in vacation :) I'm trying to merge some (easy) PR but this require some time. What I can say is that I want this to be moved forward, so please review current status and let me know what would be the path forward. But again, yes I'm very motivated to see this project integrated in 5.0.

TurboGit avatar Jul 31 '24 19:07 TurboGit

as in vacation :)

I hope you have a great time!

I'm very motivated to see this project integrated in 5.0

I am too. Once this is done I think we can bundle the lua-scripts as part of the build, which removes the git barrier. I'll give the ones that want to download an override so they still can and stay up to date.

And I have some other goodies for when you get back :rofl:

wpferguson avatar Aug 01 '24 00:08 wpferguson

@TurboGit when we stopped I think we were close, but we were too close to release to drop the additional strings on the translators. This is how I think we should resume:

  • I'll pull all the translatable strings and give them another going over
  • When you're ready, add the scripts back as a submodule
  • After that I'll remove the bindtextdomain block again
  • Generate the PO files with the scripts included

That should be all

wpferguson avatar Aug 06 '24 17:08 wpferguson

@TurboGit when we stopped I think we were close, but we were too close to release to drop the additional strings on the translators. This is how I think we should resume:

* I'll pull all the translatable strings and give them another going over

Sounds like a plan to me. When you've done this first item, let me know and I'll add the submodule. As you know I'm in vacation, but if I have some time I'll update the sub-module ASAP and then I'll let you do the 3rd point above.

I'll add as a 4th point (before generating the PO) a review of the strings/documentation of the Lua scripts to ensure that all is clean before launching the translation. As there is a huge number of new strings we don't want to push too much work on translators :)

TurboGit avatar Aug 06 '24 19:08 TurboGit

@TurboGit I've gone over the strings again and did some more cleaning and some refactoring. I think we're ready to move forward.

wpferguson avatar Aug 21 '24 18:08 wpferguson

@TurboGit I've gone over the strings again and did some more cleaning and some refactoring. I think we're ready to move forward.

Which means adding the sub-module, right?

TurboGit avatar Aug 21 '24 18:08 TurboGit

Which means adding the sub-module, right?

Yes

wpferguson avatar Aug 21 '24 19:08 wpferguson

@wpferguson : We should close this at this stage I think.

TurboGit avatar Nov 04 '24 14:11 TurboGit

I looked at it last week and had the same thought :smile:

Done

wpferguson avatar Nov 04 '24 16:11 wpferguson