[PLUG] A Question About Locales/Languages

Carlos Konstanski ckonstanski at pippiandcarlos.com
Tue Dec 29 04:44:25 UTC 2009


On Mon, 28 Dec 2009, Mark Phillips wrote:

> Date: Mon, 28 Dec 2009 21:09:08 -0700
> From: Mark Phillips <mark at phillipsmarketing.biz>
> Reply-To: "General Linux/UNIX discussion and help;	civil and on-topic"
>     <plug at lists.pdxlinux.org>
> To: Phoenix Linux Users <plug-discuss at lists.plug.phoenix.az.us>,
>     Portland Linux Users Group <plug at lists.pdxlinux.org>
> Subject: [PLUG] A Question About Locales/Languages
> 
> One of my daughter's has a Mac and it has a neat feature that allows her to
> switch languages for her keyboard so she can type in Spanish in openoffice.
> When she switches to Spanish, a nice keyboard map appears on the screen so
> she can see where the special characters are located (i.e. the n-tilde is
> right next to the L key). This does not switch all the menus etc to Spanish.
> It just switches the keyboard to a Spanish keyboard. The display of the
> Spanish keyboard on the screen is really important.
>
> Is there a way to configure Debian so there is a little country flag in the
> tool bar so I can switch my keyboard from English to German and get a small
> keyboard map for the German keys?
>
> Thanks!
>
> Mark

Haw! Actually yes, if you use KDE. I'm sure GNOME has a locale
switcher too. Even XFCE4 might have something like that. It's been a
long time since I used anything so user-friendly though, so...

If you want to switch locales and keymaps the old-fashioned way (not
tested on debian):

1. Make sure glibc has support for the locales you need. Type "locale -a"
    to check. If not, add the locale to /etc/locale.gen (or debian
    equivalent), and then run locale-gen.

2. Once you see your desired locale in the output to "locale -a", set
    the following environment variables (this example is for German):

    LANG=german
    LC_CTYPE=de_DE.utf8
    LC_MESSAGES=de_DE.utf8
    LC_PAPER=de_DE.utf8
    GDM_LANG=de_DE.utf8

    I always use utf8 locales. You could use iso-8859-1 if you wish,
    but I don't recommend it.

3. Tell Xorg about your desired keymap. If you're using xorg-1.6 or
    higher, you'll need to set the keymap in your HAL policy file. My
    /etc/hal/fdi/policy/10-X11-input.fdi looks like the following:

    <?xml version="1.0" encoding="UTF-8"?>
    <deviceinfo version="0.2">
        <device>
            <match key="info.capabilities" contains="input.keyboard">
                <merge key="input.x11_driver" type="string">evdev</merge>
                <merge key="input.auto.repeat" type="string">500 30</merge>
                <merge key="input.xkb.rules" type="string">xorg</merge>
                <merge key="input.xkb.model" type="string">pc102</merge>
                <merge key="input.xkb.layout" type="string">de</merge>
                <merge key="input.xkb.variant" type="string">nodeadkeys</merge>
                <!--<merge key="input.xkb.options" type="string">grp:alt_shift_toggle,grp_led:scroll</merge>-->
            </match>
            <match key="info.capabilities" contains="input.mouse">
                <merge key="input.x11_driver" type="string">evdev</merge>
            </match>
        </device>
    </deviceinfo>

    Notice the commented-out line with the key
    "input.xkb.options". This can be used to toggle between keymaps. I
    never use it, so my setup is incomplete for that purpose. You can
    google for this info.

    Also notice the option "input.xkb.variant". This turns off "dead
    keys". For Spanish, you probably do not want this line, since
    you'll need dead keys to do all those squiggly things over certain
    letters. Dead keys are when you type a tilde or backtick, and
    nothing appears. Then when you type the next key, it appears with a
    tilde or backtick over it. It's for characters that require two
    keystrokes.

4. Get a Spanish keyboard, or get a 102-key keyboard and some Spanish
    keyboard stickers. Actually I don't know whether you really need a
    102-key keyboard for Spanish. You do for German. Best to study a
    graphic of a Spanish layout closely.

I think #3 is really what you're after. You don't want all man pages
and every locale-aware program to start outputting in Spanish. You
just want to be able to type Spanish characters, oy?

For permanent setups, iIt is also a good idea to set the VGA console's
keymap. I have no idea how this is done in debian. In gentoo, you edit
the file /etc/conf.d/keymaps. It contains instructions in comments,
and is very easy.

Carlos



More information about the PLUG mailing list