On 10/10/19 3:35 PM, Pierre Labastie via blfs-dev wrote:
On 10/10/2019 22:17, Bruce Dubbs via blfs-dev wrote:
On 10/10/19 8:12 AM, Pierre Labastie via blfs-dev wrote:
Hi,

I've eventually managed to produce a very preliminary version of a
standalone localed daemon at https://github.com/pierre-labastie/blocaled.

I'd like this daemon to be usable on blfs (SysV), because it is needed for
smooth operation of gnome. But we have a problem with configuration files.
localed assumes there are three configuration files:
- one for locale settings, containing variable assignments in shell syntax,
for setting LANG and LC_* variables. On systemd, this is the /etc/locale
file. On openrc, this is the /etc/conf.d/02locale file.
- one for keyboard settings, containing variable assignments in shell
syntax, for setting KEYBOARD and KEYBOARD_TOGGLE variables (this file may
contain other assignments, for example setting FONT, but the other variables
are not used by localed). On systemd, this the /etc/vconsole file. On
openrc, this is the /etc/conf.d/keymaps file.
- one for X11 keyboard settings, in Xorg conf syntax, for setting XkbLayout,
XkbModel, XkbVariant and XkbOptions. On systemd, this is the
/etc/X11/xorg.conf.d/00-keyboard.conf file. On openrc, this is the
/etc/X11/xorg.conf.d/30-keyboard.conf file.

Right now, the name of those files are hard coded in the program. I plan to
at least give users the choice of the names at build time (and maybe later
add a config file containing those filenames, that would be parsed when the
daemon starts). On BLFS, two of those files are straightforward to find:
/etc/sysconfig/console for the keyboard settings, and
/etc/X11/xorg.conf.d/xx-whatever.conf for the X11 keyboard. But the locale
is set in /etc/profile or /etc/profile.d/i18n.sh, in a format which is _not_
compatible with what is expected by the daemon (the "export" keyword is not
expected)...

So here is a proposition:
- define a locale config file in a format expected by the daemon (say
/etc/sysconfig/locale)
- replace the current /etc/profile.d/i18n.fr with:
---------------------
source /etc/sysconfig/locale

This needs to be:

[ -r /etc/sysconfig/locale ] && . /etc/sysconfig/locale

If the file is not present and readable, do not complain.

Agreed.



for var in LANG LC_TYPE LC_NUMERIC LC_TIME \
                  LC_COLLATE LC_MONETARY LC_MESSAGES \
                  LC_PAPER LC_NAME LC_ADDRESS \
                  LC_TELEPHONE LC_MEASUREMENTS LC_IDENTIFICATION; do

I prefer vertical alignment sorted for easier reading:

Agreed



for var in LANG            \
            LC_ADDRESS      \
            LC_COLLATE      \
            LC_MEASUREMENTS \
            LC_MESSAGES     \
            LC_MONETARY     \
            LC_NAME         \
            LC_NUMERIC      \
            LC_PAPER        \
            LC_TELEPHONE    \
            LC_TIME         \
            LC_TYPE; do

# Add LANGUAGE and LC_ALL to the above list if needed
[ -n "${!var}" ] && export $var
done
---------------------
This replacement would be done on the blocaled page, so that users not
needing the daemon can have the same files as usual.

Is blocaled needed if you just need LANG?  What I have now is:

LANG=en_US.utf8
LANGUAGE=

Actually, (b)localed is not needed for anything but gnome-shell (which
controls gdm) and gnome-settings (on Sysv). gnome-settings does not use LANG,
even if set in the environment, it only queries localed for reading and
setting the LANG/LC_* variables.

I understand, but it seems quite non-standard Unix to not check environment variables. Seems to be common in Gnome apps though.

LC_ALL should probably not be set.  It overrides all the LC* variables. If it
is in /etc/sysconfig/locale should probably be considered a bad configuration.

True, but (b)localed allows to set it...

OK.

  -- Bruce

LANGUAGE is used to set messages languages (as LC_MESSAGES) to a multi-valued
value, e.g., setting it to fr:de:en will use French messages where they exist;
if not, it will use German messages, and will fall back to English if neither
German nor French messages are available.

If LANGUAGE is in /etc/sysconfig/locale, I think it probably should be set.

You can have any number of variables set in /etc/sysconfig/locale. (b)localed
will return them if queried. It is able to set them through the method SetLocale


Pierre


--
http://lists.linuxfromscratch.org/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to