Skip to content

Sometimes darktable GUI is not fully localized after startup #18196

Closed

Description

@rgr59

Describe the bug

For some time now, I have sporadically observed that after darktable starts, some (but not all) elements of the GUI are not localized (i. e. are in English, my locale is German). This affects at least the topmost selection possibilities for lighttable, darkroom, etc., and the button labels in the "action on selection" module.
Closing darktable and starting it again usually makes the issue go away.

Now by coincidence I found that I can increase the probability of this behaviour to (nearly) 100 percent by deleting the openCL kernels before the darktable start, so darktable has to compile them again. Looks like some race condition?

Here is a "-d all" logfile:
darktable.log.txt.gz

Steps to reproduce

See above

Expected behavior

No response

Logfile | Screenshot | Screencast

See above

Commit

No response

Where did you obtain darktable from?

self compiled

darktable version

5.1.0+61~g6a713b379d

What OS are you using?

Linux

What is the version of your OS?

Fedora 41

Describe your system?

AMD Ryzen 7 7745HX, 32 GB
Gnome / X11

Are you using OpenCL GPU in darktable?

Yes

If yes, what is the GPU card and driver?

NVIDIA RTX 4070 Laptop, 8 GB, 565.77

Please provide additional context if applicable. You can attach files too, but might need to rename to .txt or .zip

No response

Activity

  1. added
    scope: translation / strings
    scope: UI
    on Jan 12, 2025
  2. TurboGit commented on Jan 13, 2025

    @TurboGit
    Member

    Yes I have seen the same issue from time to time. Indeed restarting always fix the issue.

  3. dterrahe commented on Jan 13, 2025

    @dterrahe
    Contributor

    These days opencl is initialised/compiled in parallel with the rest of the program and ui initialisation, but it contains the following code

    https://github.com/darktable-org/darktable/blob/57cc85c4a6d75db1f5b29fc17715d3a70a749239/src/common/opencl.c#L1118-1123

    which during compilation resets the language to "C", which is then used to find translations during that interval. After 12 years, AMD may have fixed their compilers so this ugly hack may not be needed anymore. I have no idea if uselocale (which supposedly is thread safe) would help work around the original issue and one would need access to a broken compiler to test. Alternatively, the call to add _detect_opencl_job_create could be moved towards the end of dt_init. There may be some just-in-time translation lookups that could still be affected, but that would then not do "lasting" harm during the rest of the session.

  4. zisoft commented on Jan 14, 2025

    @zisoft
    Collaborator

    Yes, set_locale() isn't thread safe, and uselocale() does not exist on Windows.
    I had a similar problem when fixing the aperture collection filter and ended up with this snippet (see dt_util_float_to_str() in src/common/utility.c):

    #if defined(WIN32)
      _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
      setlocale (LC_NUMERIC, "C");
    #else
      locale_t nlocale = newlocale(LC_NUMERIC_MASK, "C", (locale_t) 0);
      locale_t locale = uselocale(nlocale);
    #endif
    
      // code here...
    
    #if defined(WIN32)
      _configthreadlocale(_DISABLE_PER_THREAD_LOCALE);
    #else
      uselocale(locale);
      freelocale(nlocale);
    #endif
    
    
  5. dterrahe commented on Jan 14, 2025

    @dterrahe
    Contributor

    I had a similar problem

    Here we are talking about external (AMD OpenCL) code that we have no control over and therefore have to work around. Maybe there are other ways of influencing the locale that code would use when called from dt, but I am not aware of any.

    Ideally we find out if the workaround is still necessary with any of the more modern AMD drivers. There's probably a minimum required/advised version anyway in order to guarantee complete compatibility with "recent" dt modules. If people could test and provide feedback before the next release. Removing the workaround I pointed out and then a few times on pixls request that AMD users (I don't know if this was just relevant for linux or windows as well) test master and provide feedback if they run into trouble (of course pointing out that they should use a non-english language in the first place) and then simply release and in the release notes explain to update to latest proven working drivers if problems are encountered with older ones.

    Another alternative would be to not initialise opencl in parallel if AMD drivers are selected in preferences (we can't deparallise based on actually present drivers, because those are only detected after the initialisation has started). A simple extension of the check in dt_init (here

    if(init_gui)
    ) would do the trick (and then maybe move the locale workaround code there too so that it is clear why this is needed and so that it is not active in the parallel case). This would not be as bad now that there is a splash screen to show what is happening during the few minutes opencl compilation could take. There could even be just a separate "non-parallel opencl initialisation" switch (in prefs, only visible when AMD selected, or hidden in darktablerc) for people that do encounter problems. Unlikely they will find it though or link it to their occasionally broken language issues. So maybe it should then be off by default.

    Yet another approach; leave the workaround in place only if an old (older than oldest tested working) AMD driver detected and if any compilation has been done and the language is not english show a message warning people that they could see translation problems and to simply restart to get rid of them.

  6. jenshannoschwalm commented on Feb 2, 2025

    @jenshannoschwalm
    Collaborator

    Or we do it the "hard way". Remove that workaround and get user issues on those systems :-)

    we might add a hidden conf key so on advice the workaround could be still done ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    scope: UIscope: translation / strings

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions