FS#19409 - [initscripts] locale: support all the LC_* variables

Attached to Project: Arch Linux
Opened by Mark (voidzero) - Monday, 10 May 2010, 12:37 GMT
Last edited by Tom Gundersen (tomegun) - Thursday, 20 October 2011, 22:52 GMT
Task Type Feature Request
Category Arch Projects
Status Closed
Assigned To Aaron Griffin (phrakture)
Thomas Bächler (brain0)
Roman Kyrylych (Romashka)
Tom Gundersen (tomegun)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

I opt to split LANG and LC_ALL in rc.conf and rc.sysinit. I suggest this because for me, there is a need Dutch locales and a preference to set en_GB.utf8 as LANG. Currently, the LOCALE variable is used to set LANG and LC_ALL.

In rc.sysinit checks exist that test if LOCALE has been set, and if it hasn't, it will be set to "en_US" (why not C, or en_US.utf8 or even en_GB.utf8? What if the locales haven't been added during setup?)

There should be some tests for LANG as well:
if LANG is unset and LOCALE is unset, set them both to e.g. en_US.utf8 (since Arch has moved to utf8 by default for about everything else now);
if LANG is unset and LOCALE is set, set LANG to LOCALE;
if both are set, use them both.

This also introduces a new variable in rc.conf.
This task depends upon

Closed by  Tom Gundersen (tomegun)
Thursday, 20 October 2011, 22:52 GMT
Reason for closing:  Implemented
Comment by Mark (voidzero) - Monday, 10 May 2010, 12:44 GMT
Actually, it seems that LC_ALL isn't set anywhere. My mistake. LOCALE is only used as LANG in rc.sysinit. :)

When I changed LOCALE in rc.conf, nothing but LANG got changed. So, there is a need to set the proper LOCALEs, by setting each of the individual LC-variables. Perhaps we could exclude LC_MESSAGES and set that to LANG as well.
Comment by Roman Kyrylych (Romashka) - Monday, 10 May 2010, 16:09 GMT
I don't see a need to complicate initscripts with LC_* setting.
Just set any LC_* var in ~/.bashrc or similar place (for per-user setting) or _at the end_ of /etc/profile for global setting.
Comment by Mark (voidzero) - Monday, 10 May 2010, 18:15 GMT
Hi Roman. I understand that your approach is a viable solution. At the same time these things are matter of taste. This bug task is not addressing a critical problem that needs to be solved. However, in my opinion, as the distribution evolves one might notice that there are different ways of doing something. In this manner the question that comes up, is, does one provide this functionality in the distribution, or does he rather add its own special needs upon his own particular installation?

The fundamental reason that I add this request to the tracker is that LOCALE *is* set in /etc/rc.conf but what it actually sets is LANG, which are two different things. Secondly, the use of /etc/profile and ~/.bashrc are only valid for bash and not for, say, zsh or csh.

Thirdly, it seemed to me that changing LOCALE after the initial installation doesn't really do anything logical. Zsh for example does not read /etc/profile.d/locale.sh. Therefore the current solution needs to be adapted, imho, which is a matter that could be discussed, even if nothing else is appropriate.
Comment by Thomas Bächler (brain0) - Monday, 10 May 2010, 20:45 GMT
I am confused. What's the goal here? We try to keep it simple by only setting LANG, it can be overridden easily by setting any of the LC_* variables.

That said, the whole locale setting needs a redesign anyway.
Comment by Mark (voidzero) - Monday, 10 May 2010, 21:22 GMT
At first my goal was to simply add a LANG variable next to the current LOCALE variable. But then I noticed that LOCALE actually was the thing that sets LANG. So yes, the current goal here, after rethinking, is to redesign the locale setting.

I can write up some patches; please share your thoughts first.

And, do you think we should attract some attention from the Archlinux BBS?
Comment by Roman Kyrylych (Romashka) - Tuesday, 11 May 2010, 07:15 GMT
Why would zsh not read files in profile.d?
They are sourced from /etc/profile which should be sourced by all shells,
otherwise we have much bigger problems.
(if this is a case - file a separate report)

I suggest to close this report and open a separate feature request with proposal for redesigning the locale settings.
Thomas, if you have a concrete proposal - please describe it in the above-mentioned report,
I don't really have any specific ideas about that (except that locale.sh can die, but I am not sure about alternatives).
Comment by Tom Gundersen (tomegun) - Wednesday, 01 December 2010, 10:50 GMT
@Thomas, Mark:

I'm also interested in redesigning locale support, has anything been done in this regard yet. The scheme being implemented by Fedora and SuSE (and maybe others?) as part of systemd is very simple and might make sense to copy: <http://0pointer.de/public/systemd-man/locale.conf.html>. (We could maybe skip support for changing locale settings via kernel parameters.)

If there is interest I'd be more than happy to help.
Comment by Mark (voidzero) - Monday, 07 February 2011, 20:26 GMT
Tom, there's interest. What more can I say? :)

I'm not that well known on working with locale support and recently my real life has been attracting most of my attention. We all know how that can go.

Tom/Thomas, do you want to pick up this bug?
Comment by Thomas Bächler (brain0) - Monday, 07 February 2011, 20:56 GMT
Tom, can you write a patch for what you have in mind? Right now, I don't really understand what your goal is.
Comment by Rémy Oudompheng (remyoudompheng) - Monday, 13 June 2011, 11:28 GMT
I think we should not put *user* settings in /etc/rc.conf: the locale setting in rc.conf should only be a preference for daemon and system processes output, and users should put their preferences in their profile settings. Now do we need fine tuning of locales for the system?
Comment by Tom Gundersen (tomegun) - Monday, 13 June 2011, 11:59 GMT
Traditionally, the locale settings in rc.conf were only the user settings. Now we have the option of also applying these to daemons.

I think the correct approach is to define system-wide settings in rc.conf, which are inherited by user sessions and daemons alike. Then it is up to the user to override these if they want.

Even if these settings are not applied to users, only to daemons. I think it is within our scope to support fine-tuning by the LC_* variables. Though, it is not high on my list of priorities. First of all we should make sure the inheritance of these variables is clear and consistent.

Lastly, LC_ALL should not be set by us, it is for debugging only, and would contradict the other settings.
Comment by Tom Gundersen (tomegun) - Thursday, 20 October 2011, 22:52 GMT
Support for /etc/locale.conf is now in testing.

Loading...