[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Is there / should there be a default locale setting on Debian systems ?



> Hi,
> 
> a short while ago I realized that quite a few aspects of a Debian system can
> actually be localized: many commands can produce messages in languages other than
> English, there are translated manpages etc. In most cases, the program is told to
> use localized messages etc. by setting the environment vars LANG, LC_ALL and
> friends (see e.g. man bash 1 [search for 'LANG']).
> 
> However, I only became aware of that fact by accident. In addition to that, I had
> to try and figure out myself where to put the 'export LANG=de_DE' (I'm German) to
> make it available to all applications. Just putting it into /etc/profile is not
> enough, because X apps may not get the setting that way if you use xdm. 
> 
> Therefore I think the current way of setting the locale might be improved. 
> I'll try to list where I believe the problems are and the solutions that seem
> reasonable to me. Since I have limited experience with system administration, I'd
> be grateful for any comments.
> 
> Problems & possible solutions:
> 
> 1) There is no default locale setting
> While every user should be able to set his/her personal locale, a system wide default
> would certainly helpful. A default setting should always try to be as reasonable as
> possible, and the present default is 'always use US-English', clearly not a reasonable
> default for many systems.
> Proposed solution: Have a question in the installation tool that asks for the default
> locale, just like machine name and timezone are already prompted for (btw, the timezone is 
> of course only a default setting as well, just like the locale would be according
> to my proposal). 
> Extension: Amend the Debian policy to give a place where the default locale is stored
> (/etc/default-locale ?). Does that make sense, or is it enough to have the locale
> in the environment vars LANG , LC_CHAR & friends?
> 
> 2) There is no place to put a systemwide environment var setting that should be
> available to *all* applications
> If you put a setting into /etc/profile , it will only be read by login shells 
> starting up, not e.g. by X programs. For those, it needs to be put into 
> /etc/X11/Xsession . For programs started by e.g. cron, I don't really know
> myself.
> Proposed solution: Have a file /etc/environment for environment settings that should
> be available to every application. That file could then be sourced by /etc/profile
> and by /etc/X11/Xsession (and by cron & similar programs?). The default Xsession
> file already does just that, by the way.

Please wrap you text at column 77 so that it is easier to read from console.

The question is more complicated: *all* environment settings should be done
in /etc/profile and user's .profile. A correctly set-up environment is
inherited automatically by all programs, including X, so there is no need
for further initializations by /etc/X11/Xsession.

In my opinion sourcing /etc/environment from Xsession is a bad thing because
it could override user's variables set in his .profile script, for example a
LANG different from the default LANG specified in /etc/environment.

Things are very different when using xdm. Xdm starts an environment without
any system profile or user setting. This is bad because the user would like
to have the same environment when logging in from console or from xdm.

A solution would be to source all system and user environment setup scripts
in Xsession only if it is run by xdm, but this is difficult because different
users have different shells and xdm should load the proper file for each
shell. Furthermore there are users who run automatically any sort of programs
from their startup scripts and running them at the xdm login my not be a wise
choice.

On my machines use a modified Xsession which sources /etc/profile and the
user .profile when started from xdm. This works for me but it is a kludge
which works only when using bash as default shell.

The ideal solution would be that xdm starts a login-like shell and run the
Xsession script from there, but I don't know if this is possible and that if
it works with every login shell.

> 3) There is no place to put a personal environment var setting that should be
> available to *all* applications
> Also see 2). If a user wants a personal locale (and other setting), there is 
> at present no obvious place to put it.
> Proposed solution: Maybe have a file  ~/.environment that is source by the default
> .xsession and the default startup script of any shell. Or does it make more sense
> to compile /.environment into the respective programs?

This means that the .environment must be in sh syntax. I have no problem
with sh scripts but there are some users who prefer csh or other shells.

> 4) Does all/some of that need to go into the Debian policy?
>  
> I hope I'm not being off-topic, and I'd appreciate any kind of comment.
> 
> Greetings,
> 
> Sebastian Leske

-- 
Massimo Dal Zotto

+----------------------------------------------------------------------+
|  Massimo Dal Zotto               email: dz@cs.unitn.it               |
|  Via Marconi, 141                phone: ++39-0461534251              |
|  38057 Pergine Valsugana (TN)      www: http://www.cs.unitn.it/~dz/  |
|  Italy                             pgp: finger dz@tango.cs.unitn.it  |
+----------------------------------------------------------------------+


Reply to: