User Tools

Site Tools


tutorials:common:set_keyboard_language

Set Keyboard Language

About this Article

Abstract

We may want to set keyboard language,here is a guide for you. This guide has successfully set up the keyboard in Lubuntu on cubietruck. Thank Ryan for editing it.

Some basic regional setting

This section is optional, but probably useful for some.

Check for any international fonts packages or language packs you might want installed:

$ apt-cache search xfonts-intl
$ apt-cache search language-pack

If you see any packages you need, install them using apt-get, e.g.:

$sudo apt-get install xfonts-intl-european
$sudo apt-get install language-pack-en language-pack-gnome-en

Note that installing the language-pack-* and language-pack-gnome-* will also install the corresponding language-pack-*-base and language-pack-gnome-*-base packages.

Optionally, you can check for any existing fonts or language packs already installed that you might not need any more.

$ dpkg --get-selections | grep -E "xfonts-intl|language-pack"

Remove any unneeded language packs or fonts packages using apt-get, e.g.:

$ sudo apt-get remove language-pack-gnome-zh-hans language-pack-gnome-zh-hans-base language-pack-zh-hans language-pack-zh-hans-base
$ sudo apt-get remove xfonts-intl-chinese xfonts-intl-chinese-big

Setting keyboard layout in the current session

For your current session only you can run setxkbmap at the command line:

$ setxkbmap -layout <country-code>

Where the country code is "us", "gb", "fr", e.g.

$ setxkbmap -layout gb

This setting will only last for your current session.

The setxkbmap command allows for toggling between different keyboard layouts if you need to use more than one, so check out the man pages etc for more info.

Setting the default keyboard used on login screen and all user sessions

If you want the keyboard set correctly on the login screen and for all users by default, you need to edit the default keyboard settings. *WARNING* If your default keyboard doesn't contain the characters in your username/password, you may have trouble logging on, e.g. if you have a Russian keyboard and you've used latin characters in your password. In this case skip to the next section.

$ sudo vi /etc/default/keyboard

Edit the line in this file for the XKBLAYOUT setting to the required layout:

XKBLAYOUT="<country-code>"

Where country code is the same as you would use for setxkbmap, e.g.

XKBLAYOUT="gb"

Now when cubie starts up, the keyboard will be configured correctly on the login screen as well as after you log in to your user account.

Setting your user's keyboard map to something other than default

You only need to do this if your system default keyboard layout is not the same as the one you want your users to use. If your default keyboard is the correct keyboard layout for your keyboard, you can skip this section.

Append the setxkbmap command to the Lubuntu autostart file:

$ echo '@setxkbmap -layout <country-code>' | sudo tee -a /etc/xdg/lxsession/Lubuntu/autostart

Where the country code is "us", "gb", "fr", e.g.

$ echo '@setxkbmap -layout gb' | sudo tee -a /etc/xdg/lxsession/Lubuntu/autostart

Now when you log on to your user account, your keyboard layout will be configured.

See Also

tutorials/common/set_keyboard_language.txt · Last modified: 2014/05/12 12:22 by allen