Kde-builder fails to build ` extra-cmake-modules` due to locale

First time running kde-builder.
I’m on Fedora 41 KDE and I learnt to best set up a working environment I had to create a distrobox VM. It appears relevant because somehow the Ubuntu inside the distrobox inherited the locale setting of en_DK.UTF-8 or en_DK.utf8 from the outside Fedora (how!?).

Inside the distrobox: kde-builder kcalc fails building at building sphinx docs for extra-cmake-modules:
File “/usr/lib/python3/dist-packages/sphinx/cmd/build.py”, line 326, in main
locale.setlocale(locale.LC_ALL, ‘’)

Indeed checking the code at the line:

  def main(argv: Sequence[str] = (), /) -> int:
    locale.setlocale(locale.LC_ALL, '')

Testing the function separately, inside Python 3.12.3 shell, I can run setlocale just fine:

import locale
locale.setlocale(locale.LC_ALL, ‘’)
‘en_DK.UTF-8’

Now I noticed it still has en_DK and after setting another entry in bashrc, now

env | grep -e LC_ -e LANG
LANGUAGE=en_US
LC_ADDRESS=en_US.UTF-8
LC_NAME=en_US.UTF-8
LC_MONETARY=en_US.UTF-8
LC_PAPER=en_US.UTF-8
LANG=Default.UTF-8
LC_IDENTIFICATION=en_US.UTF-8
LC_TELEPHONE=en_US.UTF-8
LC_MESSAGES=en_US.UTF-8
LC_MEASUREMENT=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
LC_TIME=Default.UTF-8
LC_ALL=en_US.UTF-8
LC_COLLATE=en_US.UTF-8
LC_NUMERIC=Default.UTF-8

After fixing the locale as such ^^^ now in python3 shell:

import locale
locale.setlocale(locale.LC_ALL, ‘’)
‘en_US.UTF-8’

However, kde-builder still has the same problem:
/home/test-plasma/kde/log/2025-03-23_20/extra-cmake-modules/build.log
unsupported locale setting

Same failure point even after kde-builder kcalc --refresh-build. I’ve reached the bottom of my troubleshooting ideas.

I had the same problem as you. What fixed it for me was going to System Settings > Region and Language, and click “Defaults”. I had a couple of different languages set for time for example. Then restart, then it worked.

I have not tried to do it with a more complicated setup again, as for right now I can live with it.

env | grep -e LC_ -e LANG | sort
LANG=Default.UTF-8
LANGUAGE=en_US
LC_ADDRESS=en_US.UTF-8
LC_ALL=en_US.UTF-8
LC_COLLATE=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
LC_IDENTIFICATION=en_US.UTF-8
LC_MEASUREMENT=en_US.UTF-8
LC_MESSAGES=en_US.UTF-8
LC_MONETARY=en_US.UTF-8
LC_NAME=en_US.UTF-8
LC_NUMERIC=Default.UTF-8
LC_PAPER=en_US.UTF-8
LC_TELEPHONE=en_US.UTF-8
LC_TIME=Default.UTF-8

but kde-builder kcalc --ignore-projects gpgme still fails with locale.Error: unsupported locale setting
In an interactive py shell started manually:

import locale
locale.setlocale(locale.LC_ALL, '')    # 'en_US.UTF-8' 

I’ve also tried setting LC_ALL=C LANG=C

That’s strange. I’ve never heard of LANG=Default.UTF-8, could it be that this is the culprit? If I were to guess what the problem is then I would say this could be it.

I tried to find out how to set locales on Fedora, no idea if they also use the system with /etc/locale.conf. On Arch, what I did was setting there these values, then restart and reset the Regional settings in KDE to default.

LANG=en_US.UTF-8
LC_CTYPE=en_US.UTF-8

If all else fails, one could try starting a shell outside of the X session, using shortcuts Ctrl Alt F6 worked for me and try the commands there.

My env in KDE looks like this:

% env | grep -e LC_ -e LANG | sort
LANG=en_US.utf8
LANGUAGE=en_US:en:C:de_DE
LC_ALL=en_US.utf8
LC_CTYPE=en_US.UTF-8