Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lxqt-config-locale] LANGUAGE variable not set #975

Open
gfgit opened this issue Jan 17, 2024 · 1 comment
Open

[lxqt-config-locale] LANGUAGE variable not set #975

gfgit opened this issue Jan 17, 2024 · 1 comment

Comments

@gfgit
Copy link
Member

gfgit commented Jan 17, 2024

Expected Behavior

All relevant language environment variables are set correctly and are coherently, unless explicitly a custom setup is specifically wanted by the user.

Current Behavior

LXQt Panel's FancyMenu plugin is half translated and half original after changing system locale from English to Italian.

fancymenu_kde_plasma_buttons

This happens because Qt libraries sometimes use LANGUAGE variables as highest priority over LANG, sometimes the other way round.
See qlocale_unix.cpp#L104.

This leads QLocale::system().name() to return en_US even though I've chosen "Italian" in the config dialog.
This code is called for example by lxqttranslator.cpp#L135
So it's pretty much all LXQt applications.

The QtXdg library instead follows another priority order. See qtxdg/xdgdesktopfile.cpp#L858
Here LANGUAGE variable is not even considered, the code checks in order: LC_MESSAGES, LC_ALL, LANG which in my setup are all set to it_IT.UTF-8 which is correct.

Possible Solution

Either set LANGUAGE to same value as LANG (don't know if it's correct for Unix docs)
or change evaluation priority order to match Qt libraries

Steps to Reproduce (for bugs)
  1. Change from English to Italian
  2. Restart lxqt-panel
  3. Open FancyMenu
  4. Categories and apps are in Italian, special "virtual" categories are in English and so is the rest of the UI
Context

My environment on KDE Tuxedo 2:

~$ env | grep LC
LC_ADDRESS=it_IT.UTF-8
LC_NAME=it_IT.UTF-8
LC_MONETARY=it_IT.UTF-8
LC_PAPER=it_IT.UTF-8
LC_IDENTIFICATION=it_IT.UTF-8
LC_TELEPHONE=it_IT.UTF-8
LC_MEASUREMENT=it_IT.UTF-8
LC_TIME=it_IT.UTF-8
LC_NUMERIC=it_IT.UTF-8

~$ env | grep LANG
LANGUAGE=it
LANG=en_US.UTF-8

See LANG set to English which seems fine.

My environment in Ubuntu LXQt:

~$ env | grep LC
LC_MONETARY=it_IT.UTF-8
LC_MEASUREMENT=it_IT.UTF-8
LC_TIME=it_IT.UTF-8
LC_COLLATE=it_IT.UTF-8
LC_NUMERIC=it_IT.UTF-8

~$ env | grep LANG
LANGUAGE=en
GDM_LANG=en
LANG=it_IT.UTF-8

Here LANG is like LC_* but LANGUAGE is still English

System Information
  • Distribution & Version: Ubuntu 23.10
  • Kernel:
  • Qt Version: 5.15.10
  • liblxqt Version: master
  • lxqt-build-tools Version: master
  • Package version: 1.4.0
@gfgit
Copy link
Member Author

gfgit commented Jan 17, 2024

It's worth considering #506 while refactoring this code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant