[SOLVED] $LANG per user doesn't obey the global $LANG set in /etc/profile.d/lang.sh
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
$LANG per user doesn't obey the global $LANG set in /etc/profile.d/lang.sh
In Slackware 14.2, I set $LANG in /etc/profile.d/lang.sh to en_US.UTF-8. However, the per user $LANG doesn't follow the global $LANG and when I execute
Code:
echo $LANG
I get
Code:
en_US
(except when I execute it as root after su -)
I think that this problem happened after upgrading from alien's KDE 5_16.06 to 5_16.07.
any help or any clue where to start from to solve this problem is greatly appreciated.
Looking at your output, it seems you are not doing a login shell, so it doesn't process /etc/profile or anything in your /etc/profile.d/ directory.
Try running su - $your-username, type in your password and then see what the output of [b]echo $LANG[/code] is.
If it is the correct lang, you need to change your terminal to use a login prompt or set $LANG in your .bashrc.
After su - $my-username,
Code:
echo $LANG
returned the right value. So, I created a .bashrc file and set $LANG in it and since then echo $LANG returns en_US.UTF-8. But non-English characters are still not shown correctly in Dolphin and other KDE window managers.
Quote:
Looking at your output, it seems you are not doing a login shell, so it doesn't process /etc/profile or anything in your /etc/profile.d/ directory
What is preventing me from doing a login shell?
Quote:
If it is the correct lang, you need to change your terminal to use a login prompt or set $LANG in your .bashrc.
How may I change my terminal to use a login prompt?
Konsole does not start a login shell by default. You need to configure that in the settings for your profile. The LANG setting in /etc/profile.d will not be used if you are not starting a login shell.
Unfortunately, I am at work and don't have the ability to give you the exact location, but somewhere under the settings menu there's an option to edit your profile. Go there and then find the place where it's calling /bin/bash and change it to /bin/bash -l (that's a lower case L, not an uppercase i).
In a traditional X environment $LANG would be inherited down the process-tree from it's parents. I can't speak for KDE as I neither like nor install it, but I certainly don't need to have my xterms run a 'login shell' simply to have the value of $LANG visible. If LANG is not set in the environment of whatever is launching your applications within X then something is broken and making konsole run a login shell is simply masking the issue in one specific place and IMO focusing on that is barking up the wrong tree.
But then in these days of systemd-localed, and dbus interfaces to do everything god only knows what craziness ensues in desktops like kde that have bought into Poettering's vision, hook, line and sinker.
Sorry, can't help further as I don't have KDE available to play with... just wanted to say I don't think making it a 'login shell' is the right answer.
Are you logging in from the terminal and doing a manual startx, or are you logging in via kdm or xdm (or something else?) in runlevel 4?
With konsole, I don't think it matters. I never had it inherit anything from my normal shells whether I was runlevel 3 or 4. My PS1 was never user@computer (I think it just said bash-4.3 $).
With konsole, I don't think it matters. I never had it inherit anything from my normal shells whether I was runlevel 3 or 4. My PS1 was never user@computer (I think it just said bash-4.3 $).
One of his complaints was that Dolphin (which he presumably runs right from inside KDE, not bothering to start a terminal emulator to (re)load his profile and then manually typing 'dolphin' on the commandline) has the wrong LANG setting. That will be inherited from his X Windows session, so finding out how he starts his X Windows is relevant.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.