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

Re: multilingual setup ...



On Thu, Feb 27, 2020 at 04:56:06PM +0100, Albretch Mueller wrote:
> On 2/27/20, Greg Wooledge <wooledg@eeg.ccf.org> wrote:
> > Note the key phrase "when I su into a shell".
> > That is VERY different from "I want each user to have a different locale
> > when they login".
> 
>  OK, each user should have "language interfacing personas" LIP (to
> call it something) and after (s)he logs in (s)he will find separate
> windows for each language (or a simple way to access their LIP).
> Everything you do within a LIP will be with the corresponding locale,
> ... etc

Well, that's definitely *not* what I expected.  Kudos for actually
surprising me.

OK, first thing I will say: I do *NOT* know if any Desktop Environment
can do this.  It is absolutely antithetical to how they work, as they
tend to want to take over your entire user experience and force it into
one of a small number of predefined boxes.

You are looking for something radically different from anything I've
ever heard of before, and I seriously doubt that you can achieve it
with a Desktop Environment.  (I'm willing to be proved wrong, if any
DE experts out there can correct me.)

So, my first step for you is: do not use a Desktop Environment.  Use
a traditional window manager and a traditional ~/.xsession file to
configure your login session.

The next step, and this is an important one, is that the window
manager is a single process, and as such, it will have single locale.
That locale will determine how the window manager itself works, and it
will also determine how any CHILDREN of the window manager work, unless
said children override the inherited locale.

So, you'll have to decide upon one "main" locale for this user, which
will be the one used by the WM.  Not necessarily used by anything else.

Next, you'll want to launch a series of terminals with the locale
variables set appropriately for each terminal.

After that, you'll probably want to configure the WM so that these
locale-specific terminals can be re-launched at will.

In addition to all of that, there are some Debian-specific pieces
involved: you will need to generate all of the locales that you intend
to use, by running dpkg-reconfigure locales.  And you will need to
decide how you're logging in, and adjust a few dot file choices
based on that.

Let's say that you've done the dpkg-reconfigure step to generate
locales for English (US), Spanish and French.  Let's also say that
you're logging in with lightdm (a GUI display manager).

Since the login uses lightdm, there's no login shell, and the shell's
dot files are not relevant.  In Debian, you configure the overall
login session with ~/.xsessionrc -- so we'll put the dominant locale
selection there.


### ~/.xsessionrc
export LANG=en_US.UTF-8


Next, we'll write a ~/.xsession file that launches three terminals
with three different locales, and then execs the system's default
window manager program.


### ~/.xsession
LANG=es_ES.UTF-8 xterm -T 'xterm - espanol' &
LANG=fr_FR.UTF-8 xterm -T 'xterm - francais' &
LANG=en_US.UTF-8 xterm -T 'xterm - english' &
exec x-window-manager


(When I tried xterm -T 'xterm - español' locally, the ñ was replaced by
a ? character in the title bar -- this may be an issue with my WM, or
something deeper, so I just said "screw it" and went with ASCII.  If your
WM handles titles with non-ASCII characters, feel free to correct my
spelling above.)

Configuration of the WM will be entirely specific to each individual WM.
I could give you configuration snippets for fvwm, but chances are you're
using some other WM, and I don't know very many of them.

Just realize that you WILL almost certainly want to add some way for
the WM to launch each of your locale-specific terminals, and perhaps
other locale-specific programs like Firefox, Eclipse, and so on.

Any non-customized WM selections will use the dominant locale, the one
that was set in ~/.xsessionrc.

Any programs that you explicitly run from one of the xterms will inherit
the locale from that particular xterm.


Reply to: