How to setup international keyboard in X Window System with Xmodmap: Setting up international keyboard in X Window System with XmodmapNextPreviousContents
Make your own .Xmodmap file according to information in this file.
Alternatively, write the following in your .bash_profile in home directory:
export LANG=language
export LC_ALL=language
and/or
LANG=language
(which can be LANG="sk_SK", for example)
in your /etc/sysconfig/i18n file
Here "language" is the language you want to use. The languages can be
found in the file locale.alias in /usr/X11R6/lib/X11/locale.
Run "exit" command on the console or reboot and log in again.
Install fonts (best are ISO8859-2 Type1 fonts for Czech or Slovak),
put them in path to your XF86Config. Start X Server.
Please note that KDE 2.0 editors don't display ISO8859-2 fonts even
if you have them in path. The modification of /etc/sysconfig/i18n file is
necessary here to use the international keyboard.
Run the command "xmodmap /.Xmodmap" from an X terminal window to force
the system to read the Xmodmap file.
Switch the keyboard and enjoy.
The other, XKB solution, which is not covered in this file but mentioned
at least as it pertains to internationalization too, is another way of
configuring international keyboard, and both the XKB and XMODMAP
solutions are independent of one another. You may alternatively edit
the /etc/X11/Xf86Config file as explained in a Danish Howto, or issue
this command in an X terminal window for the Slovak keyboard:
qwerty or qwertz means that letters z Z and y Y are swapped.
The "grp:shift_toggle" gives you an option to switch between keyboards.
You may also try to write Option "XkbOptions" "grp:ctrl_shift_toggle"
to your XF86Config file, which will change keyboards by pressing Ctrl
and Shift at the same time.
To see a variety of languages (symbols), look in the file symbols.dir
in /usr/X11R6/lib/X11/xkb directory. Note that some symbols are only in
sources and not in binaries (of XFree86).
As you see, this looks quite complicated too and it gets even more difficult
when you realize that many national keymaps are not included in the standard
XFree86 binary distribution, although they are included in its sources.
The kikbd utility for handling international keyboard layouts was removed
from KDE 2.0 and documentation is quite insufficient. A simple way
would be to start KDE, change the international keyboard settings and
immediately write in the language you chose (this will work for German
and other languages maybe, but in Eastern European keyboards some letters
may not function).
Moreover, the KDE 2.0 command "kcmshell Personalization/kcmlayout" will not show
you a Croatian or Macedonian keyboard unless you modify the
/etc/sysconfig/i18n file. And although it shows a Czechoslovakian keyboard,
Czechoslovakia does not exist as a country anymore and users may be confused
with how to define Czech or Slovak language.
Some X Window System managers override .Xmodmap setting. If .Xmodmap doesn't
work immediately, 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 FreeBSD 4.1 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.
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 languages, so look there in order to find out
what is ca_ES or br_FR, or to find out the exact syntax for your language
(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 fonts and put path in XF86Config file
for 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
(alternatively, copy other iso885*** Compose files to the iso8859-1
directory).
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 from X:
xset q
to see which fonts are in your path.
If you want to add fonts in your path from X, issue the command:
xset fp+ /usr/fonts_path
xset fp rehash
d) Disable every "Scroll Lock" uncommented line in your XF86Config,
because our .Xmodmap for the Slovak language uses the Scroll Lock to
switch between keyboards (you can modify this .Xmodmap for any keyboard).
e) Put the appropriate fontpath for your newly installed fonts
in the XF86Config file, if necessary (some systems may not require this,
the FontPath "unix/:7100" may be sufficient). The .Xmodmap solution may
be applied to all X keyboards; .Xmodmap file overrides all settings of
keyboard layouts as defined in /usr/X11R6/lib/X11/xkb/symbols/,
where are symbols for many international keyboards.
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 (without modification of /etc/sysconfig/i18n file).
This means that the ISO8859-1 definitions must be used instead and they
will either give you what they say they are (aacute [á], eacute [é],
etc.), or they will not give you what they say they are (using ISO8859-2
fonts, putting "threequarters" in your .Xmodmap file will not give you "3/4"
but "z" with a caron, a reveres ^ above it). For example, "mu" will give
lcaron (L'), "oslash" rcaron, etc.
However, other key definitions, for example, adieresis (a with two
dots above it), uacute (u with a slash above it), as well as dead_diaeresis
do not require a substitution of other definitions and work pretty well,
as they're defined everywhere (a dead key is a key you press, hold
it, yet nothing happens, but after pressing another key you will get
a special letter).
The original "Compose" file in ../iso8859-1 directory can be fully
utilized for English, Slovak or Czech keyboard layouts (Polish, Hungarian,
Slovenian, Croatian) in some older XFree86 distributions, but there is
only one problem - dead keys do not work. That's why you have to copy
the "Compose" file from the iso8859-2 directory to iso8859-1 directory,
or alternatively, you can edit the "Compose" file in iso8859-1 directory.
You can leave the Keyboard section in your XF86Config file without
much change. Put (if it's not already there) the following in the
"Keyboard" section:
Section "Keyboard"
Protocol "Standard"
XkbRules "xfree86"
XkbModel "pc101"
XkbLayout "us"
Some X managers and/or environments override .Xmodmap settings,
so if you use KDE and .Xmodmap doesn't work, force the system to read it
by issuing the command "xmodmap /.Xmodmap". Alternatively, you can have
60 .Xmodmap files like .Xmo1, .Xmo2, .Xmo3, .Xmo4, etc., and you may force
the system to read them (xmodmap /.Xmo1). The dot means it is a hidden
file and it is not necessary. You may also have xmo1, xmo2, or xmo3 Xmodmap
files.
You may write in a national keyboard only with applications that have access
to your ISO8859-2 fonts (or other fonts), but this may not work with
StarOffice or with other applications that have their own built-in fonts.
StarOffice has its own fonts directory - for afm fonts in
StarOffice/share/xp3/fontmetrics/afm, and for ps fonts in
StarOffice/share/xp3/pssoftfonts, so you must add the ISO8859-2 fonts
to these directories (to tell StarOffice to use these fonts too) and edit
fonts.dir file and add the symlinked fonts there. Here is a script that will
do it for you. Cut it, name it "so52", make it executable (chmod +x so52),
copy it to the StarOffice/share/xp3 directory and execute it there.
fi
------------------------------------cut_here-----------------------------
StarOffice 5.2 fully recognizes Word97 documents even written in other
languages, but for the older versions or other editors, you may use
a converter from iso8859-2 to win1250 encoding.
StarOffice 5.2 can be thus used by professional translators
who may translate in any languages and give outputs in MS Word97 or
rtf format.
If you want to edit and make your own .Xmodmap keyboard layout definitions,
I'll explain one line of the .Xmodmap file to make clear what you should do.
This explanation can be used for all keycodes. For example, the line:
keycode 0x11 = 8 asterisk aacute 8
(note: keycode 0x11 is derived from the "xkeycaps" utility; you can also use
the X "xev" utility to explore keyboard puzzles.)
says that the first pair, the default one, (number "8" and "asterisk")
will display number "8" when you press keycode 0x11 ("8"), will display
asterisk when a "shift" key is pressed. After pressing the scroll lock,
there's another definition: ISO_NEXT_GROUP, which means that when you
press the default "8" key, no "8" will be displayed, but aacute ("á");
when you press the "shift" key, number "8" will be displayed. So if
you change "aacute" and "8", anything you put instead of "aacute" and
"8" will be displayed, for example:
keycode 0x11 = 8 asterisk semicolon colon
will give you "semicolon" and "colon" in your 0x11 keycode after
pressing the Scroll Lock.
The ISO_NEXT_GROUP is defined by another line. If this line is not defined,
you will be able to use only two definitions ("8" and "asterisk") - look at
my .Xmodmap file. If you delete the ISO_NEXT_GROUP (the next pair of
definitions on the right), you will have only one group of keyboard
definitions ("8" and "asterisk"). Be careful when editing the .Xmodmap
file. You mustn't delete definitions that enable utilization of the
Scroll Lock unless you know what you are doing (or you map the second keyboard
by right Alt). These are the lines such as:
keycode 0x4e = ISO_Next_Group
add mod5 = ISO_Next_Group,
etc. You must also keep in mind that Unixes are case sensitive. If you want
to find out more about keycodes, install the package "xkeycaps" or use "xev".
You may find almost any xmodmap file in the GNOME directory in
(SuSE) /opt/gnome/share/xmodmap (with standard ISO8859-1, ISO8859-2
and other definitions). If GNOME is not installed in the /opt directory,
look in /usr/share. To switch between the keyboards, use right Alt. It
is defined in these Xmodmap files already.
The purpose of the following info is to help you build any .Xmodmap
keyboard layout with ISO8859-2 or other fonts. The ISO8859-2 Character
Set definitions are included here for you to know which names are used for
which keys. You should not bother about the numbers, but notice how keys
are named. Much of this information is useful to build a keyboard
with ISO8859-1 characters only, or a combination of Eastern European
characters and Western characters. If you're going to use other languages
than the Central European or Western European ones, find a pertinent table
for your ISO*** character set on Internet. The gdkkeysyms.h file, that contains
all the crazy names for keycode entities including hexcodes, is in (RedHat)
/usr/include/gdk/ directory. If no gdkkeysyms.h file is on your system, see
the file /usr/X11R6/include/X11/keysymdef.h, or try to look in
/lib/perl5/site_perl/5.6.0/i386-linux/GTK/keysyms.pm (it also contains names
of keycode entities including hex codes). If you have a newer version of PERL,
the "5.6.0" may differ. The similar should apply to other systems (FreeBSD),
as all these use PERL.
First, try to see if standard definitions will give you (after installing
pertinent fonts and building Xmodmap with keyboard definitions for X) what
they say they are. If they will not give you what they say they are
(some keycodes will be unfunctional), then put to your bash_profile
the "export LANG=language" and "export LC_ALL=language" statements and
if you are still unsuccessful, you must make a substitution. Definitions
which will not give you what they say they are can be traced by their
visual shape in Western Latin 1 encoding. If you are a Czech, for example,
you may issue a command:
and see what will give you an X terminal window (press both Shift keys or
press alt and hold it to see the other keyboard layout). This means that
by pressing a letter "3" you will get a real "onesuperior" key. It is good
that X terminal window does not make use of ISO8859-2 fonts now, so you
will see what you must use instead of scaron (scaron = onesuperior). By
putting "onesuperior" in an .Xmodmap file you will get a REAL "scaron", but
obviously, only with use of ISO8859-2 fonts (with use of ISO8859-1
fonts, you will get a REAL "onesuperior").
Thus, the X terminal window will show you fonts like micron,
onesuperior, threequarters, and so on. You will see what you must
substitute. But if you don't know what "?" is called in ISO terminology,
find and download an appropriate character set table for ISO8859-1, or
look in gdkkeysyms.h file, /lib/perl5/site_perl/5.6.0/i386-linux/GTK/keysyms.pm
file, or ../ISO8859-1/Compose file. Alternatively, you may experiment with
all codes defined in /usr/X11R6/lib/X11/locale/ISO8859-1/Compose file.
You must use the ISO8859-1 entities when the system refuses to display
the ISO8859-2 entities correctly.
The following symbols on your right is what I found out through my research.
This is just an example. When you use a "Pound" definition in the Xmodmap
file, the X will display you a Lslash instead (in relation to using
iso8859-2 fonts, of course). When you choose some easy KDE text
editor, select iso8859-2 fonts charset from the fonts menu. NOTE:
vowel *acute (uacute, eacute, etc.) signs require no substitution,
therefore I omitted iacute, aacute, etc., here.
ISO8859-1 entity will give you the: ISO8859-2 entity
in our nonstandard or experimental Xmodmap keycode definition
egrave ccaron
ugrave uring
agrave racute
ecircumflex "c" with something at the bottom of it
ucircumflex
Lslash "Pound" in Xmodmap gives you Lslash.
The example of a standard .Xmodmap file from keycode 0x31 to 0x33.
This file will make X Server correctly display lcaron, scaron, etc.,
if you use a newer version of XFree86 and/or have a LC_LANG=language
and LC_ALL=language statements in your bash_profile or in /etc/sysconfig/i18n.
Just copy the following text from keycode 0x31 to 0x33 to the above-listed
Xmodmap file (delete the experimental definitions from keycode 0x31 to 0x33).
ISO8859-0
old, replaced by ISO 8859-14 and ISO 8859-15.
ISO8859-1
Western Europe: Danish, Dutch, English, Faeroese, Finnish, Flemish,
French, German, Icelandic, Irish, Italian, Norwegian, Portuguese,
Spanish, and Swedish. Many other languages can be written with this.
ISO8859-2
Eastern Europe: Czech, Slovak, English, German, Hungarian, Polish,
Romanian, Serbo-Croatian, Slovak, Slovene. (Please note that Serbian
language uses both Latin ISO8859-2 and Cyrillic ISO8859-5).
ISO8859-3
English, Esperanto, Galician, Maltese and Turkish.
ISO8859-4
English, Baltic languages - Estonian, Latvian, Lithuanian,
and Scandinavian languages - Danish, Faeroese, Icelandic, Lappish,
Norwegian, and Swedish.