Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[SOLVED] Specify different languages for different users

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
Antonio Rizzo
Posts: 18
Joined: 2015-09-27 09:13
Been thanked: 5 times

[SOLVED] Specify different languages for different users

#1 Post by Antonio Rizzo »

Hi, folks
I have Debian 8 installed, using:
* gdm3 as the default display manager (set up in "/etc/X11/default-display-manager");
* LXDE as the default desktop environment.

I did "dpkg-reconfigure locales" and I selected three languages:
"en_US.UTF-8", "it_IT.UTF-8", "sv_SE.UTF-8" (the predefined one is "it_IT.UTF-8").

Now I wish to create two more users each with a different language (both for X and console applications).
I did a lot of googling without success; I tried modifying ~/.profile or ~/.dmrc (adding "export LANG=...") but they didn't work. I was able to change only the system-wide language, not the one of a single user.

I got the conclusion that It's not possible to have multiple users each with a different language. Is it true?
Thanks to all.

*** UPDATE:
I made another try:
In another installation (Debian 8, with GNOME and LXDE) I created two users:
antonio, ida
The former has only one hidden file in its home-dir: ".bashrc" with "LANG=it_IT.UTF-8" as the last line
(no "export $LANG" added).
The latter ("ida") has only two hidden files in its home-dir:
1. ".bashrc" clean, with no "LANG=it_IT.UTF-8" line
2. ".dmrc" containing two lines:
[Desktop]
Language=sv_SE.utf8
I put "/usr/sbin/gdm3" in "/etc/X11/default-display-manager"
After reboot both users are OK: each of them displays its own language:
antonio has all menus and programs in italian
ida has all menus and programs in swedish
It looks curious to me ; I don't know why, but that's it.
Someome else can confirm it?
Thanks to all

*** UPDATE 2
I was able to create 4 users with 4 languages (SE, IT, FR, ES).
Then I deleted all directory and files (including "~/.bashrc" and "~/.dmrc") of one user, rebooted the PC,
and NOTHING changed!
So, where is stored the user's language?
Not in his home; there is a list elsewere?

*** UPDATE 3 :D
I don't know why (I wait someone explaining me), but now I can tell others how to do:
0. Use "lightdm" (not "gdm3") as the display manager (see "/etc/X11/default-display-manager")
To install it: su -c "apt-get install lightdm"
1. su -c "dpkg-reconfigure locales"
(select the desired locales: en_US.UTF-8, it_IT.UTF-8, sv_SE.UTF-8, etc; set "default locale for the system environment=None")
2. su -c "adduser emil" ("emil" is the name of a swedish user)
3. Logout
4. Select "Swedish" as default language (see at the top-right corner of the screen)
5. Write user name (emil) and password to login
6. After login, language is english (but file "~/.dmrc" is created with the correct language).
7. Reboot PC.
8. After reboot, login again as "emil": now language is Swedish :D
Now you can change the display manager to gdm3 if you prefer.
To change applications language:
su -c "apt-get install task-swedish task-swedish-desktop"

Hope it helps

*** UPDATE 4 :D :D

I found the file containing the user's language: it's the same containing the link to its icon:
/var/lib/AccountsService/users/UserName
(needs "apt-get install accountsservice").
Editing that file is much simpler as I described earlier :D
Last edited by Antonio Rizzo on 2015-10-14 11:12, edited 11 times in total.

User avatar
kiyop
Posts: 3983
Joined: 2011-05-05 15:16
Location: Where persons without desire to improve themselves fear to tread, in Japan
Been thanked: 3 times

Re: Specify different languages for different users

#2 Post by kiyop »

Did you modify ~/.profile with non-root user?
How about ~/.bashrc ?

Code: Select all

export LANG=it_IT.UTF-8
http://www.shellhacks.com/en/HowTo-Chan ... t-in-Linux

Modifying ~/.bashrc works correctly on one of my debian sid.

Did you log out and log in?
Modification takes effect after re-logging in.
Openbox, JWM: Jessie, Sid, Arch / Win XP (on VirtualBox), 10
http://kiyoandkei.bbs.fc2.com/

Antonio Rizzo
Posts: 18
Joined: 2015-09-27 09:13
Been thanked: 5 times

Re: Specify different languages for different users

#3 Post by Antonio Rizzo »

kiyop wrote:Did you modify ~/.profile with non-root user?
How about ~/.bashrc ?

Code: Select all

export LANG=it_IT.UTF-8
http://www.shellhacks.com/en/HowTo-Chan ... t-in-Linux

Modifying ~/.bashrc works correctly on one of my debian sid.

Did you log out and log in?
Modification takes effect after re-logging in.
Thank you for your answer.
I did change (as a user, not root) both "~/.profile" and "~/.bashrc" appending "export LANG=en_US.UTF-8" to both.
Then I rebooted my PC.
Nothing changed except the desktop (now its name is "Desktop", not "Scrivania" as before).

otyugh
Posts: 49
Joined: 2014-06-17 23:11
Been thanked: 1 time

Re: Specify different languages for different users

#4 Post by otyugh »

Tiping "locale" as user will show you if the locale were successfuly changed ; but I don't think it's your issue.
You can try very fast to see if apps are translated using "export LC_ALL="mylang"; iceweasel" for instance ; you won't have to reboot to see if the app change language or not. If it does not, then :

My actual guess is, you miss some packages to translate your environnement and software. There is meta packages for this : "apt-get install task-french" for french language (all theses meta package are found in "aptitude").

I know kde use some kind of langage addition package, as for libreoffice or claws-mail, or iceweasel... In theses case changing only the locale won't change the language. Meta packages are not propers package : they will install multiple set of package to fit your actual need and you won't have to bother about it.

User avatar
kiyop
Posts: 3983
Joined: 2011-05-05 15:16
Location: Where persons without desire to improve themselves fear to tread, in Japan
Been thanked: 3 times

Re: Specify different languages for different users

#5 Post by kiyop »

LC_ALL variable is dangerous. You should clear it

Code: Select all

LC_ALL=
Openbox, JWM: Jessie, Sid, Arch / Win XP (on VirtualBox), 10
http://kiyoandkei.bbs.fc2.com/

Antonio Rizzo
Posts: 18
Joined: 2015-09-27 09:13
Been thanked: 5 times

Re: Specify different languages for different users

#6 Post by Antonio Rizzo »

otyugh wrote:Tiping "locale" as user will show you if the locale were successfuly changed ; but I don't think it's your issue.
You can try very fast to see if apps are translated using "export LC_ALL="mylang"; iceweasel" for instance ; you won't have to reboot to see if the app change language or not. If it does not, then :

My actual guess is, you miss some packages to translate your environnement and software. There is meta packages for this : "apt-get install task-french" for french language (all theses meta package are found in "aptitude").

I know kde use some kind of langage addition package, as for libreoffice or claws-mail, or iceweasel... In theses case changing only the locale won't change the language. Meta packages are not propers package : they will install multiple set of package to fit your actual need and you won't have to bother about it.
Thank you, I got it work.
I installed packages "task-english", "task-swedish", and others, but it seems to me they are not necessary.
So, in a new fresh install (using VirtualBox) I did the following:

1. dpkg-reconfigure locales
(I selected en_US.UTF-8, it_IT.UTF-8, sv_SE.UTF-8; default locale for the system environment=None)

2. I modified only "~/.dmrc" for each user; for example:
[Desktop]
Language=sv_SE.UTF-8
Session=lightdm-xsession

3. I rebooted my PC (reboot, not logout)

There was no need to append "LANG=sv_SE.UTF-8" to "~/.bashrc" nor to "~/.profile"
As you said, to have swedish language in all programs (i.e. iceweasel) I have to install the proper language packages, but to change the overall language in LXDE, only "~/.dmrc" has to be changed.
Thank you very much. I hope this can help others.

User avatar
kiyop
Posts: 3983
Joined: 2011-05-05 15:16
Location: Where persons without desire to improve themselves fear to tread, in Japan
Been thanked: 3 times

Re: Specify different languages for different users

#7 Post by kiyop »

Antonio Rizzo wrote:There was no need to append "LANG=sv_SE.UTF-8" to "~/.bashrc" nor to "~/.profile"
As you said, to have swedish language in all programs (i.e. iceweasel) I have to install the proper language packages, but to change the overall language in LXDE, only "~/.dmrc" has to be changed.
Thanks for nice report and congratulations on your success :)

I don't use LXDE.
For one of my debian with openbox, ~/.dmrc seems to have no effect on language.
Mere "export LANG=BLAHBLAH" in ~/.bashrc works perfectly.
Openbox, JWM: Jessie, Sid, Arch / Win XP (on VirtualBox), 10
http://kiyoandkei.bbs.fc2.com/

erlguta
Posts: 11
Joined: 2012-06-04 14:52
Been thanked: 1 time

Re: [SOLVED] Specify different languages for different users

#8 Post by erlguta »

Hi,

Sorry for reopen this old post. But I have the same issue.
I have Debian 10.3 with Gnome 3.30.2.
I have all the system in English and I have 4 users. But I want to have one of them in Spanish language
I have configured in /etc/locale.gen and later with dpkg-reconfigure locale with:
en_US.UTF-8
en_GB.UTF-8
es_ES.UTF-8

In my /etc/default/locale I have:

Code: Select all

#  File generated by update-locale
LANG="en_US.UTF-8"
LANGUAGE="en_US.UTF-8"
LC_TIME="en_GB.UTF-8"
LC_PAPER="en_GB.UTF-8"
LC_MEASUREMENT="en_GB.UTF-8"
Well. Now I login with that user that I want in spanish and in gnome "Region & language" it appears correctly Spanish language and I have selected it.
I have rebooted and everything stills in English in that account.
I have tried to configure in that account .dmrc file with:

Code: Select all

[Desktop]
Session=gnome
Language=es_ES.UTF-8
and .bashrc with:

Code: Select all

LANG=es_ES.UTF-8
LANGUAGE=es_ES.UTF-8
LC_ALL=es_ES.UTF-8
With no success at all. Well, after configuring .bashrc I see terminal output messages in Spanish language but all the gnome session is still in English.
How can be one so trivial (and I think common) task be so difficult to achieve?. What I am missing or doing wrong?
Any help for being able to configure "only" this user in Spanish (meanwhile the rest of the system and 3 users are still in English) would be really appreciated.

Antonio Rizzo
Posts: 18
Joined: 2015-09-27 09:13
Been thanked: 5 times

Re: [SOLVED] Specify different languages for different users

#9 Post by Antonio Rizzo »

You can try the following code, but you might need to change something because I use LXDE, not GNOME.
Let me know if you have any problems. Sorry, I'm too busy now and I cannot make any test, but the following code works for me.

Code: Select all

su -c "
printf \"[User]\nLanguage=$locale\nXSession=LXDE\nIcon=/var/lib/AccountsService/icons/$user.png\nSystemAccount=false\n\" > /var/lib/AccountsService/users/$user
sed -i '/$locale_UTF8/c $locale_UTF8 UTF-8' /etc/locale.gen
dpkg-reconfigure locales --default-priority
printf \"[Desktop]\nLanguage=$locale\nSession=LXDE\n\" > /home/$user/.dmrc
chown $user:$user /home/$user/.dmrc
chmod 0664 /home/$user/.dmrc
rm /etc/default/locale
"
where:
locale="es_ES.UTF-8"
locale_UTF8="es_ES.UTF-8"
user=<username, e.g. "isabella">

Hope it helps

sneves
Posts: 1
Joined: 2021-11-23 18:17
Has thanked: 1 time
Been thanked: 1 time

Re: [SOLVED] Specify different languages for different users

#10 Post by sneves »

Antonio Rizzo wrote: 2015-09-27 09:51 *** UPDATE 4 :D :D

I found the file containing the user's language: it's the same containing the link to its icon:
/var/lib/AccountsService/users/UserName
(needs "apt-get install accountsservice").
Editing that file is much simpler as I described earlier :D
6 years later, and it helped me a lot. :D
Thanks to you and the internet for existing.

H3NSO3
Posts: 4
Joined: 2022-09-11 15:42
Been thanked: 1 time

Re: [SOLVED] Specify different languages for different users

#11 Post by H3NSO3 »

+1

Still very useful in 2022 (debian 11).
Thanks for sharing.

Post Reply