Skip to content

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

@gfgit

Description

@gfgit
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions