Issue with Application Locale Settings on Manjaro KDE Plasma (Wayland)

Hello,

I’ve encountered an issue with launching Anki on my Manjaro KDE Plasma running under Wayland, where the application requires explicit UTF-8 locale settings to launch correctly. Despite my system locale being set to en_US.UTF-8, Anki wouldn’t start from the KDE application launcher without specifying LANG and LC_ALL environment variables directly in the .desktop file’s Exec command. From the terminal it starts just as expected.

Here’s what I’ve done to address the issue:

  1. Checked and confirmed that my system’s locale is set to en_US.UTF-8 using locale command.
  2. Adjusted the Anki launcher (~/.local/share/applications/anki.desktop) to include LANG and LC_ALL in the Exec line:
    Exec=env LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 /usr/bin/anki
    
    This change allowed Anki to launch successfully from the KDE application menu.

I suspect this issue might be related to how I changed the system language or a particularity with KDE Plasma’s handling of environment variables under Wayland. Before this, I had switched my system language from German to English, which might not have been applied consistently across all locale settings.

I’m seeking advice on whether this is a known issue with a more systematic solution and if my current workaround could lead to other complications. Additionally, I’m wondering if there are specific commands or logs I should check to diagnose this issue further or provide more details.

For reference, here are my current locale settings:

> locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=en_US.UTF-8
LC_TIME=en_US.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=en_US.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=en_US.UTF-8
LC_NAME=en_US.UTF-8
LC_ADDRESS=en_US.UTF-8
LC_TELEPHONE=en_US.UTF-8
LC_MEASUREMENT=en_US.UTF-8
LC_IDENTIFICATION=en_US.UTF-8
LC_ALL=

Any insights or suggestions would be greatly appreciated. Thank you!

Hi @aditunoe,

From what I can see, that looks perfectly fine to me. An example from one of mine:

$ grep -C 4 -i env /home/mirdarthos/.local/share/applications/wine-protocol-Blizzard.URI.Battlenet.desktop                                                                                                                                            2 ↵
[Desktop Entry]
Type=Application
Name=Battle․net
MimeType=x-scheme-handler/Blizzard.URI.Battlenet;
Exec=env WINEPREFIX="/mnt/5TB/Mirdarthos' Stuff/Wine/StarcraftII" wine start %u
NoDisplay=true
StartupNotify=true
Icon=FC6C_Battle.net.0

Thank you for your response. Perhaps I wasn’t entirely clear in my initial post. The issue with launching Anki has been resolved by adjusting the .desktop file to explicitly set the locale environment variables, as shown below for reference:

[Desktop Entry]
Categories=Education;Languages;KDE;Qt;
Comment[en_US]=An intelligent spaced-repetition memory training program
Comment=An intelligent spaced-repetition memory training program
Exec=env LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 /usr/bin/anki
GenericName[en_US]=Flashcards
GenericName=Flashcards
Icon=anki
MimeType=
Name[en_US]=Anki
Name=Anki
Path=
SingleMainWindow=true
StartupNotify=true
Terminal=false
TerminalOptions=
TryExec=anki
Type=Application
Version=1.0
X-GNOME-SingleWindow=true
X-KDE-SubstituteUID=false
X-KDE-Username=

The workaround is effective, but it raises a question for me. Given that I’ve set LANG and LC_ALL to en_US.UTF-8 at the system level, why is it necessary to specify these environment variables again in the .desktop file? Shouldn’t the application inherit these settings from the system and function correctly without additional modification?

I’m concerned about the underlying cause of this discrepancy. If the locale was not properly set when I changed the system language, I’d like to understand how to correct this to ensure I don’t encounter similar issues with other applications in the future. The goal is to avoid having to manually prepend env LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 for applications to recognize the system-wide locale settings.

That’s a good theory. But it might not, no, it’s obviously not working that way. For what reason I don’t know.

2 Likes

Thanks for pointing out, my bad I didn’t see this post.

So changing the plasma-localerc did the trick:
~/.config/plasma-localerc

Here, I just also set the language to the one I wanted:

[Formats]
LANG=en_US.UTF-8
LC_TIME=en_US.UTF-8

[Translations]
LANGUAGE=en_US.UTF-8

Then I don’t need to do that manually for each app anymore.

Thanks for the help, much appreciated!

2 Likes

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.