View previous topic :: View next topic |
Author |
Message |
JotaStar n00b
Joined: 01 Oct 2016 Posts: 25
|
Posted: Sun Oct 02, 2016 5:14 pm Post subject: localectl and eselect |
|
|
Hi,
I'm a little confused about eselect command. I'm switch to pure systemd init instead openrc.
Now I'm generating and configuring the locales and keymap with systemd by the commands for that.
In my make.conf
Code: | LINGUAS="es es_ES"
L10N="es es-ES"
|
Code: | gentoohost jota # locale-gen
* Generating locale-archive: forcing # of jobs to 1
* Generating 2 locales (this might take a while) with 1 jobs
* (1/2) Generating es_ES.ISO-8859-15@euro ... [ ok ]
* (2/2) Generating es_ES.UTF-8 ... [ ok ]
* Generation complete
gentoohost jota # |
Set locales with command.
Code: | jota@gentoohost ~ $ localectl set-locale LANG="es_ES"
|
And the output of localectl
Code: | jota@gentoohost ~ $ localectl
System Locale: LANG=es_ES.utf8
VC Keymap: es
X11 Layout: es
|
So everything is ok.
BUT, the system will no change the keymap / locale unless I do a
Code: | eselect locale set es_ES@euro |
So, my question are:
1. What is the purpose of command: localectl set-locale LANG="es_ES"? Maybe I have to create a service and run it on start (systemctl) for keymap, locales, etc?
2. Why I need to use eselect to set locales / keymap?
3. Are eselect part of openrc? I dont think so because I unmerged it a while ago...
Thank you. |
|
Back to top |
|
|
Ant P. Watchman
Joined: 18 Apr 2009 Posts: 6920
|
Posted: Sun Oct 02, 2016 5:22 pm Post subject: |
|
|
localectl only sets the locale in systemd's env and processes that inherit it. eselect sets the $LANG variable in /etc/profile, which is read by all shells.
If you want the systemd setting to affect your entire system then remove /etc/env.d/02locale, run env-update, and reboot. |
|
Back to top |
|
|
Fitzcarraldo Advocate
Joined: 30 Aug 2008 Posts: 2034 Location: United Kingdom
|
Posted: Sun Oct 02, 2016 6:12 pm Post subject: |
|
|
You can use the commands 'localectl set-keymap' and 'localectl set-x11-keymap'. For example:
Code: | # nano /etc/locale.gen
# locale-gen
# localectl list-locales
# localectl set-locale LANG=pt_BR.UTF-8
# localectl list-keymaps
# localectl set-keymap br-abnt2
# localectl list-x11-keymap-layouts
# localectl set-x11-keymap br
# env-update && source /etc/profile |
_________________ Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC udev elogind & KDE on both.
Fitzcarraldo's blog |
|
Back to top |
|
|
JotaStar n00b
Joined: 01 Oct 2016 Posts: 25
|
Posted: Mon Oct 03, 2016 8:29 am Post subject: |
|
|
Ant P. wrote: | localectl only sets the locale in systemd's env and processes that inherit it. eselect sets the $LANG variable in /etc/profile, which is read by all shells.
If you want the systemd setting to affect your entire system then remove /etc/env.d/02locale, run env-update, and reboot. |
I remove the 02locale file as you mentioned and run:
Code: | gentoohost ~ # ls /etc/env.d/
000opengl 00manpager 09sandbox 70less binutils
00basic 04gcc-x86_64-pc-linux-gnu 50guile 98ca-certificates gcc
00glibc 05binutils 50ncurses 99xdg-gdm python
gentoohost ~ # localectl
System Locale: LANG=es_ES
VC Keymap: es
X11 Layout: es
gentoohost ~ # env-update && source /etc/profile
>>> Regenerating /etc/ld.so.cache...
gentoohost ~ #
|
And after reboot the system still in english
Fitzcarraldo, has you can see in the localectl all settings are ok.
Any idea why systemd dont change locale? The keyboard workd fine (keymap)
Thanks |
|
Back to top |
|
|
Logicien Veteran
Joined: 16 Sep 2005 Posts: 1555 Location: Montréal
|
Posted: Mon Oct 03, 2016 9:13 am Post subject: |
|
|
You have to set all the locale variables with localectl. You only have set the LANG one. My locales goes like this
Code: | locale
LANG=fr_FR.utf8
LC_CTYPE=fr_FR.utf8
LC_NUMERIC=fr_FR.utf8
LC_TIME=fr_FR.utf8
LC_COLLATE=fr_FR.utf8
LC_MONETARY=fr_FR.utf8
LC_MESSAGES=fr_FR.utf8
LC_PAPER=fr_FR.utf8
LC_NAME=fr_FR.utf8
LC_ADDRESS=fr_FR.utf8
LC_TELEPHONE=fr_FR.utf8
LC_MEASUREMENT=fr_FR.utf8
LC_IDENTIFICATION=fr_FR.utf8
LC_ALL= |
This is what I have in /etc/env.d/02locale -> ../locale.conf
Code: | # Configuration file for eselect
# This file has been automatically generated.
# Édité par Paul.
LANG=fr_FR.utf8
LANGUAGE=fr_FR:fr
LC_CTYPE=fr_FR.utf8
LC_NUMERIC=fr_FR.utf8
LC_TIME=fr_FR.utf8
LC_COLLATE=fr_FR.utf8
LC_MONETARY=fr_FR.utf8
LC_MESSAGES=fr_FR.utf8
LC_PAPER=fr_FR.utf8
LC_NAME=fr_FR.utf8
LC_ADDRESS=fr_FR.utf8
LC_TELEPHONE=fr_FR.utf8
LC_MEASUREMENT=fr_FR.utf8
LC_IDENTIFICATION=fr_FR.utf8 |
It have been done with Eselect and edit by me manually because Eselect only set LANG who is good enough for the system language but me, I prefer to declare all locale variables. localectl only show LANG and LANGUAGE so, they are probably the only two ones to set.
Code: | localectl status
System Locale: LANG=fr_FR.utf8
LANGUAGE=fr_FR:fr
VC Keymap: cf
X11 Layout: ca |
lf you prefer, you can edit the file /etc/locale.conf by yourself. This is the file who is read by Systemd. /etc/env.d/02locale is read by Openrc.
For Bash, I do it with a ~/.bashrc of my own who apply to any user. It can be done globally in /etc/bash/bashrc.d/. _________________ Paul
Last edited by Logicien on Mon Oct 03, 2016 11:01 am; edited 5 times in total |
|
Back to top |
|
|
JotaStar n00b
Joined: 01 Oct 2016 Posts: 25
|
Posted: Mon Oct 03, 2016 10:40 am Post subject: |
|
|
Logicien wrote: | You have to set all the locale variables with localectl. You only have set the LANG one. My locales goes like this
Code: | locale
LANG=fr_FR.utf8
LC_CTYPE=fr_FR.utf8
LC_NUMERIC=fr_FR.utf8
LC_TIME=fr_FR.utf8
LC_COLLATE=fr_FR.utf8
LC_MONETARY=fr_FR.utf8
LC_MESSAGES=fr_FR.utf8
LC_PAPER=fr_FR.utf8
LC_NAME=fr_FR.utf8
LC_ADDRESS=fr_FR.utf8
LC_TELEPHONE=fr_FR.utf8
LC_MEASUREMENT=fr_FR.utf8
LC_IDENTIFICATION=fr_FR.utf8
LC_ALL= |
This is what I have in /etc/env.d/02locale -> ../locale.conf
Code: | # Configuration file for eselect
# This file has been automatically generated.
# Édité par Paul.
LANG=fr_FR.utf8
LANGUAGE=fr_FR:fr
LC_CTYPE=fr_FR.utf8
LC_NUMERIC=fr_FR.utf8
LC_TIME=fr_FR.utf8
LC_COLLATE=fr_FR.utf8
LC_MONETARY=fr_FR.utf8
LC_MESSAGES=fr_FR.utf8
LC_PAPER=fr_FR.utf8
LC_NAME=fr_FR.utf8
LC_ADDRESS=fr_FR.utf8
LC_TELEPHONE=fr_FR.utf8
LC_MEASUREMENT=fr_FR.utf8
LC_IDENTIFICATION=fr_FR.utf8 |
It have been done with Eselect and edit by me manually because Eselect only set LANG who is good enough for the system language but me, I prefer to declare all locale variables. localectl only show LANG and LANGUAGE so, they are probably the only two ones to set.
Code: | localectl
System Locale: LANG=fr_FR.utf8
LANGUAGE=fr_FR:fr
VC Keymap: cf
X11 Layout: ca |
You are able to set any of those variables with localectl. This should set all the variables
Code: | localectl set-locale LANG="es_ES"
localectl set-locale LANGUAGE=es_ES:es
localectl set-locale LC_ALL="es_ES" |
lf you prefer, you can edit the file /etc/locale.conf by yourself. This is the file who is read by Systemd. /etc/env.d/02locale is read by Openrc.
For Bash, I do it with a ~/.bashrc of my own who apply to any user. It can be done globally in /etc/bash/bashrc.d/. |
Thank you for your response, but still not working.
Code: | gentoohost / # localectl set-locale LANG="es_ES"
gentoohost / # localectl set-locale LANGUAGE="es_ES"
gentoohost / # localectl set-locale LC_ALL="es_ES"
Failed to issue method call: Invalid Locale data.
gentoohost / # uname -r
4.4.6-gentoo
gentoohost / # locale
LANG=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=
gentoohost / # cat /etc/locale.conf
LANG=es_ES
gentoohost / #
|
If I edit manually, localectl set-locale overwrite the /etc/locale.conf file. I only want to use systemd, not OpenRC, so I removed /etc/env.d/02locale as mentioned above.
More ideas?
Thanks for your time. |
|
Back to top |
|
|
Logicien Veteran
Joined: 16 Sep 2005 Posts: 1555 Location: Montréal
|
Posted: Mon Oct 03, 2016 10:53 am Post subject: |
|
|
This is true. localectl only set in /etc/locale.conf the last variable declare. It do not take LC_ALL but the others. This is the reason why I edit the file /etc/locale.conf manually. localectl status only show LANG and LANGUAGE, so the other variables may be unnecessary.
I think the link /etc/env.d/02locale to /etc/locale.conf must stay. It may define your Bash locale variables. As I said, for Bash, I declare the locale variables in ~/.bashrc. My ~/.bash_profile source ~/.bashrc so, all my locales in Bash are good with a login and a non login shells. _________________ Paul
Last edited by Logicien on Mon Oct 03, 2016 11:33 am; edited 1 time in total |
|
Back to top |
|
|
Logicien Veteran
Joined: 16 Sep 2005 Posts: 1555 Location: Montréal
|
Posted: Mon Oct 03, 2016 11:26 am Post subject: |
|
|
This link is helpfull
Locale - ArchWiki _________________ Paul |
|
Back to top |
|
|
JotaStar n00b
Joined: 01 Oct 2016 Posts: 25
|
Posted: Mon Oct 03, 2016 3:30 pm Post subject: |
|
|
I follow this guide (not very differente as gentoo doc) and still nothing, but I dont have the script mentioned
/etc/profiles.d/locale.sh
Maybe is bcse is only from Arch?
Thank you. |
|
Back to top |
|
|
|