How to setup international keyboard in X Window with Xmodmap and XKB
v1.3, 01 December 2001
How to setup international keyboard in Linux or Unix with Xmodmap and XKB written by (c) Juraj Sipos. The Xmodmap is a file that XFree86 reads in order to give you a keyboard layout. This solution will work for you in setting up any international keyboard for (Debian, !RedHat, Mandrake, !CorelLinux?) Linux, FreeBSD, OpenBSD, NetBSD and possibly every Unix that uses XFree86. The advantage of this howto is that it is not architecture specific and will work on all other systems. However, it is a little experimental in that that it bypasses some standardized XFree86 solutions (with respect to its older versions), although a standard form of internationalization is included too.
----; Table of Contents; 1. Introduction: ; 1.1. Copyright; 1.2. Revision history; 1.3. Introduction; 2. Setting up international keyboard in X Window System with Xmodmap and XKB: ; 2.1. Quick start; 2.2. How to do it - this experimental or nonstandard solution is not necessary for newer versions of XFree86. Skip this if not interested; 2.3. Xmodmap theory and standard Xmodmap solution; 2.4. Experimental .Xmodmap sample file for the Slovak language typewriter layout; 2.5. Character sets; 2.6. ISO-8859-2 (ISO Latin2) character set; 2.7. The standard ISO8859-2 definitions in the Xmodmap file; 3. How this Xmodmap solution works on various systems: ; 3.1. SuSE 6.4 and 7.0; 3.2. SuSE 7.0 with Xfree86 version 3.3.6 and KDE 1.x; 3.3. Mandrake Linux 7.2; 3.4. Mandrake 8.1; 3.5. !RedHat 5.1, 5.2, 6.0, 6.1 and 6.2 (XFree86 3.3.6 and older); 3.6. !RedHat 7.2; 3.7. FreeBSD 3.1 and 3.2; 3.8. FreeBSD 4.1; 3.9. FreeBSD 4.4.; 3.10. Corel Linux 1.0 and 1.1; 3.11. ISO* specifications; 4. Some national Xmodmap files: ; 4.1. German; 4.2. Hungarian; 4.3. Czech; 4.4. Polish; 4.5. French; 4.6. Croatian/Slovenian; 4.7. Lithuanian keyboard (AZERTY layout); 4.8. Polish; 5. Troubleshooting and some Xmodmap tips: ; 5.1. Troubleshooting; 5.2. Tips; 6. Links: ; 6.1. Other information on internationalization; 6.2. Links to some non ISO8859-1 fonts
This documentation is free documentation; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
; Version 1.0.0:
Initial version Summer 1999
; Version 1.1:
Added copyright information and slight modifications pertaining to newer systems
; Version 1.2:
Completely rebuilt, added the possibility to force the system to read Xmodmap; some national Xmodmap files added, more information included on building up the standard Xmodmap files
; Version 1.3:
Minor corrections, spell checking and editation made, few more Xmodmap files added; list of what all ISO8859* specifications mean
; Version 1.4:
Correction of script for including X Window fonts to !StarOffice 5.2
; Version 1.5:
December 2001, Links on internationalization added, info on XKB, troubleshooting, info on newer Linux versions, !StarOffice 6
The international keyboard Xmodmap HOWTO. Copyright (C) 1999, 2001 Juraj Sipos (xvudpapc@savba.sk). Imagine you use a Linux or a BSD OS and want to write a business letter to a person that has a foreign name with a slash or idiaresis. Danish language uses signs like ø and Spanish like ñ.
This is the Xmodmap Howto, but some info on XKB is included, too.
With this information you can make your own international keyboard
layout without installing any additional packages. The following
information will help you set up German, Spanish, Italian,
Slovak, Czech, Polish, Slovenian, Croatian, Danish,
Dutch, French, Finnish, Norwegian, Estonian, Latvian, Swedish and
other keyboards. You can also alternatively look at my hompage
at http://www.freebsd.nfo.sk
to see layouts of various keyboards. In case you want to install
Greek, Hebrew or Russian language, follow my information and apply
changes pertinent to these languages also with respect to other
documentation (e.g., install Greek fonts, etc., see the Cyrilic,
Hebrew, or Danish howto).
Make your own .Xmodmap file according to information in this file.
Write the following to your .bash_profile in your home directory:
export LANG=language
where "language" is the language you want to use. The languages can be found in the file locale.alias in /usr/X11R6/lib/X11/locale. Note: some programs, like Mozilla, won't care about these user's locale settings. Run "exit" command on the console and log in again for bash to read the statement from its .bash_profile.
Install fonts (best are ISO8859-2 Type1 fonts for Eastern Europe, Czech or Slovak), put them in your font path in the /etc/X11/XF86Config file (on some newer systems this is not necessary). Start X Server. Run the command "xmodmap /.Xmodmap" from an X terminal window to force the system to read the .Xmodmap file.
Provided you have your fonts installed, just open the X Terminal window and issue a command: setxkbmap kb, where "kb" is the keyboard layout you want to use, for example: setxkbmap si
for the Slovenian language
setxkbmap de
for the German language
All the language names you may use are located in /usr/X11R6/lib/X11/xkb/symbols directory.
If you are using KDE, open the KDE Start button, click on Preferences, Personalization, Country 8 Language and choose ISO8859-2 charset. Note that this may be slightly different depending on the Linux distribution.
Switch the keyboard (my xmodmap definition uses Scroll Lock for switching, other xmodmap files use Right Alt) and enjoy.
You may alternatively edit the /etc/X11/Xf86Config file as explained in the Danish Howto, or issue this command in an X terminal window for the Slovak keyboard:
setxkbmap -model pc102 -symbols 'czsk(us_sk_qwertz)' setxkbmap cs -option grp:shift_toggle
In !RedHat 7.2 and Mandrake 8.1, it is enough to run the following setxkbmap command from an X Terminal Window (assuming you have correct fonts installed): setxkbmap sk setxkbmap si setxkbmap de
qwerty or qwertz means that the letter z Z and y Y are swapped.
To see a variety of language maps (symbols), look in the file symbols.dir in /usr/X11R6/lib/X11/xkb directory.
Some X Window managers override .Xmodmap setting. If .Xmodmap isn't read by X automatically after starting the X Window System, a good way is to force the system to read it from your root (home) directory. You will do this by issuing the following command from an X terminal window:
xmodmap /.Xmodmap
After I installed the Slovak keyboard in KDE with Xmodmap file that used the standard definitions for ISO8859-2 keycode entities (lcaron, scaron, etc.), I couldn't write in Slovak or Czech, so I made few changes to the Xmodmap file explained later in this file. After applying these changes, no other changes were necessary.
Put the following in your .bash_profile:
export LANG=language
OR
OR for csh shell
setenv LANG=langauge
and have the standard Xmodmap file in your home directory. If you ask me where you may obtain such "standard" Xmodmap files, go to GNOME ../share directory. The file /usr/X11R6/lib/X11/locale/locale.alias contains the aliases for langauges, so look there in order to find out what is ca_ES or br_FR (the exact syntax for your language to use - you cannot write "croatia" but you must write "croatian", not "Croatian"; this is very important, as Unix is case sensitive).
Now you must install the pertinent language fonts and put path in XF86Config file to these fonts. If you want to internationalize your keyboard, use the standard Xmodmap definitions first and use right alt to switch between keyboards (if you use GNOME Xmodmap files). If it does not work, do the following:
a) Copy the "Compose" file from: /usr/X11R6/lib/X11/locale/iso8859-2 to: /usr/X11R6/lib/X11/locale/iso8859-1 directory (yes, iso8859-1, not iso8859-2). Back up the original "Compose" file if you want
b) Put the included .Xmodmap file to your root directory (Slovak language, or make your own .Xmodmap file, or choose from the ones listed here).
c) Install ISO8859-2 fonts (or other pertinent fonts).
You may try to issue the command:
xset q
to see which fonts are in your path.
If you want to add fonts in your path from the X Window System, issue the command:
xset fp+ /usr/fonts_path
xset fp rehash
d) Disable every "Scroll Lock" uncommented line in your XF86Config, because our .Xmodmap file for the Slovak language uses the Scroll Lock to switch between keyboards.
e) Put the appropriate fontpath for your newly installed fonts in the XF86Config file, if necessary (Mandrake 7.2 and other OS's may not require this). The Xmodmap solution may be applied to all X keyboards of your choice.
First, I must say that in my solution (in older XFree86 versions), different mapping is used for Xmodmap keycodes for some ISO8859-2 keycode entities. ISO8859-2 definitions (keycode entities) like lcaron, zcaron actually do not work. This means that the ISO8859-1 definitions must be used instead and they will either give you what they say they are (aacute [á