You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Sometimes darktable GUI is not fully localized after startup #18196
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?
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.
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):
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
) 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.
Activity
TurboGit commentedon Jan 13, 2025
Yes I have seen the same issue from time to time. Indeed restarting always fix the issue.
dterrahe commentedon Jan 13, 2025
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_createcould be moved towards the end ofdt_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.zisoft commentedon Jan 14, 2025
Yes,
set_locale()isn't thread safe, anduselocale()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()insrc/common/utility.c):dterrahe commentedon Jan 14, 2025
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(heredarktable/src/common/darktable.c
Line 1712 in 57cc85c
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.
jenshannoschwalm commentedon Feb 2, 2025
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 ...