<?xml version="1.0"?>
<article><artheader><title>Belarusian-HOWTO </title><author><firstname>Alexander Mikhailian,
				mikhailian@altern.org </firstname></author><pubdate>v.0.1.5, 25 February 2001 </pubdate><abstract><para>				Short guide in setting up Belarusian language support in Linux
				console, X Window System, web-browsers, text editors, etc.
				Charsets used in the setup are either windows-1251 or
				iso-8859-5.  Belarusian characters can also be found in
				koi8-ub, koi8-c, koi8-ru and, of course, Unicode. Although
				this HOWTO is Linux-specific, many advices are applicable to
				other UNIX-like systems.
			</para></abstract></artheader><sect1><title>Introduction</title><sect2><title>History</title><para>				This document was started in September 15, 1999 by Alexander Mikhailian
			</para></sect2><sect2><title>Comments</title><para>				Comments on this HOWTO may be directed to the author 
				<ulink url="mailto:mikhailian@altern.org">mikhailian@altern.org</ulink>.
			</para></sect2><sect2><title>New Versions</title><para>				The newest version can always be found at
				<ulink url="http://bellinux.sourceforge.net/">the bellinux page</ulink>.
			</para></sect2><sect2><title>Copyright</title><para>				This manual may be reproduced in whole or in part without restrictions.
			</para></sect2><sect2><title>Acknowledgements and Thanks</title><para>				Thanks to everyone who gave comments as I was writing this. 
			</para></sect2></sect1><sect1><title>System-wide setup</title><sect2><title>Choosing Charset</title><para>				As for now, the choice is mainly between windows-1251 and
				iso-8859-5. Windows-1251 provides compatibility with M$
				Windows and it is is by far the most popular charset for
				nearly all slavic languages. On the other side, iso-8859-5 is
				better supported and easier to set up. 
			</para><para>				
				The present HOWTO will explain the use of both charsets in
				parallel.  Unless otherwise stated in the text, Belarusian
				support package from
				<ulink url="http://bellinux.sourceforge.net/">the bellinux page</ulink>
				contains all the files mentioned in the present HOWTO.
			</para></sect2><sect2><title>windows-1251 in the kernel</title><para>				Windows-1251 support in the kernel is needed to visualize MS
				Windows filenames in cyrillic while the console and X Window
				system are localized in windows-1251. As latest FAT file
				systems store filenames in Unicode, we have to define the
				output charset of the Virtual File System layer and install
				the support for windows-1251 in the kernel.
			</para><para>				There is a patch for 2.2.14 kernels that is included in the
				Belarusian support package.	To apply the patch,
			
				<itemizedlist><listitem><screen format="linespecific"> cd /path_to_your_kernel_source_tree
						</screen></listitem><listitem><screen format="linespecific"> patch -p0 ent patch_for_the_kernel.patch
						</screen></listitem><listitem><para>							Recompile and reinstall  the kernel modules. 
							Refer to 
							<ulink url="http://www.linuxdoc.org/HOWTO/Kernel-HOWTO.html">Kernel-HOWTO</ulink> 
							for the details.
						</para></listitem><listitem><para>							Add 
							<screen format="linespecific"> codepage=866,iocharset=microsoft-cp1251
							</screen>
								to your mount options in order to get the filenames in
								windows-1251.
						</para><para>							To test the setup, execute
							<screen format="linespecific"> mount /dev/hda -t vfat -o codepage=866,iocharset=iso8859-5 /mnt/hda
							</screen>
							as root. Of course, you should replace /dev/hda by the
							name of your vfat partitions containing names in
							cyrillic.
						</para></listitem></itemizedlist>
				
			</para></sect2><sect2><title>ISO-8859-5 in the kernel</title><para>				There is built-in support for iso-8859-5 in Linux kernel. 
				To enable iso-8859-5, make sure you compile this module 
				in the nls section of the kernel setup. Normally, iso-8859-5
				is compiled by default and can be loaded either automatically
				or by issuing 
				<screen format="linespecific"> insmod nls_iso8859-5
				</screen>
				as root.
			</para><para>							Add 
							<screen format="linespecific"> codepage=866,iocharset=iso8859-5
							</screen>
								to your mount options in order to get the filenames in
								iso-8859-5.
						</para></sect2><sect2 id="locale"><title>Setting locale</title><para>				
				<itemizedlist><listitem><para>							Belarusian locale is available in glibc 2.2 and later.
							If you do not have the belarusian locale installed in
							your system, you can compile it yourself. The source is
							available at
				<ulink url="http://bellinux.sourceforge.net/">the bellinux page</ulink>.
							Issue

							<screen format="linespecific"> localedef -f CP1251 -i be_BY be_BY.CP1251
							</screen>
												
							or
							
							<screen format="linespecific"> localedef -f ISO-8899-5 -i be_BY be_BY.ISO-8899-5
							</screen>							
							
							to compile the locale in windows-1251 encoding or iso8859-5 encoding.
						</para></listitem><listitem><para>							Check how it works by setting the locale
							<screen format="linespecific"> set  LANG=beentBY.CP1251; export LANG
							</screen>
or 
							<screen format="linespecific"> set  LANG=beentBY.ISO-8859-5; export LANG
							</screen>
							and running a locale-aware program like
							<filename moreinfo="none">date</filename> 
							or 
							<filename moreinfo="none">cal</filename>.
						</para></listitem></itemizedlist>

			</para></sect2><sect2 id="console"><title>Belarusian in console</title><sect3><title>Setting Belarusian with windows-1251</title><para>					Some cyrillic console fonts are in fact russian fonts and
					lack many cyrillic characters.  Fortunately, UniCyr fonts by
					Vadinm Zhitnikov have all the glyphs from cp866, cp1251,
					iso8859-5 and all printable symbols from koi8-r.  Besides
					the belarusian keyboard maps which you can find at the
					<ulink url="http://bellinux.sourceforge.net/">the bellinux page</ulink>					
					, other files are fairly standard and are available in most
					linux distributions.  To set up window-1251 in console,
					<itemizedlist><listitem><para>								Load a UniCyr font 
								<screen format="linespecific"> consolechars -f UniCyr_8x16
								</screen>
							</para></listitem><listitem><para>								Load <filename moreinfo="none">by2_win.kmap</filename> keymap.
								<screen format="linespecific"> loadkeys by2_win
								</screen>
							</para></listitem><listitem><para>								Load Application-Charset Map <filename moreinfo="none">cp1251.acm</filename>
								<screen format="linespecific"> consolechars -m cp1251									
								</screen>
							</para></listitem></itemizedlist>

				</para></sect3><sect3><title>Setting Belarusian with iso-8859-5</title><para>					There are two ways to set up Belarusian with iso-8859-5
					
					<itemizedlist><listitem><para>								Load iso-8859-5 font 
								<screen format="linespecific"> consolechars -f iso05.f16
								</screen>
							</para></listitem><listitem><para>								Load belarusian keymap 
								<filename moreinfo="none">by2.kmap</filename> 
								or
								<filename moreinfo="none">by.kmap</filename> 
								<screen format="linespecific"> loadkeys  by.kmap
 loadkeys by2.kmap
								</screen>
							</para></listitem></itemizedlist>
					This method has one serious drawback - you will loose all
					pseudographic characters and, say, you Midnight Commander
					will look somewhat naked.  The second method described below
					preserves all pseudographic characters:					
					<itemizedlist><listitem><para>								Load UniCyr font 
								<screen format="linespecific"> consolechars -f UniCyr_8x16
								</screen>
							</para></listitem><listitem><para>								Load <filename moreinfo="none">by2.kmap</filename>
								keymap or 
								<filename moreinfo="none">by.kmap</filename>
								<screen format="linespecific"> loadkeys  by.kmap
 loadkeys by2.kmap
								</screen>
							</para></listitem><listitem><para>								Load Application-Charset Map <filename moreinfo="none">iso05.acm</filename>
								<screen format="linespecific">consolechars -m iso05
								</screen>
							</para></listitem></itemizedlist>
					
					Beware that different Linux distributions have different
					console-related packages -
					<filename moreinfo="none">console-tools</filename> or
					<filename moreinfo="none">kbd</filename>.  Abovementioned scripts are meant
					to work with <filename moreinfo="none">console-tools</filename> which is by
					far more popular.
				</para></sect3></sect2><sect2 id="x-window"><title>Belarusian in X Window System</title><sect3><title>ISO-8859-5 in X Window System through XKB</title><para>This is is quite easy to set up.</para><itemizedlist><listitem><para>						
							Install ISO-8859-5 fonts for X Window and make sure they are
							before other fonts in the fontpath. Refer to 
							<ulink url="http://www.linuxdoc.org/HOWTO/Font-HOWTO.html">Font-HOWTO</ulink>
							for details on how to install fonts.
						</para></listitem><listitem><para>							Get the belarusian keyboard layout <filename moreinfo="none">by</filename> from the 
							<ulink url="http://bellinux.sourceforge.net/">the bellinux page</ulink>
							and put it on the place of any other keyborad layout in 
							<filename moreinfo="none">/usr/X11R6/lib/X11/xkb/symbols/</filename>, e.g.
							instead of the belgian keyboard layout 
							<filename moreinfo="none">/usr/X11R6/lib/X11/xkb/symbols/be</filename>
						</para><para>							Put the following stings in  your 
							<filename moreinfo="none">/etc/X11/XF86COnfig</filename>:
							<screen format="linespecific"> XkbModel   "microsoft"
 XkbLayout  "be"
 XkbOptions "grp:caps_toggle"
							</screen></para></listitem><listitem><para>							Don't forget to set up the system locale to
							be_BY.ISO8859-5 as described in <xref linkend="locale"></xref>. 
							You will also want to make sure that iso-8859-5 fonts
							are before any other fonts in your font path.
						</para></listitem></itemizedlist></sect3><sect3><title>					Windows-1251 in X Window System through XKB
				</title><para>					This works only with XFree 4.0.2 and higher.
				</para><itemizedlist><listitem><para>						
							Install ISO-8859-5 fonts for X Window and make sure they
							are before other fonts in the fontpath.
						</para></listitem><listitem><para>							Get the belarusian keyboard layout <filename moreinfo="none">by</filename> from the 
							<ulink url="http://bellinux.sourceforge.net/">the bellinux page</ulink>
							and put it on the place of any other keyborad layout in 
							<filename moreinfo="none">/usr/X11R6/lib/X11/xkb/symbols/</filename>, e.g.
							instead of the belgian keyboard layout 
							<filename moreinfo="none">/usr/X11R6/lib/X11/xkb/symbols/be</filename>
						</para></listitem><listitem><para>							Put the following strings in  your 
							<filename moreinfo="none">/etc/X11/XF86Config</filename>:
							<screen format="linespecific"> XkbModel   "microsoft"
 XkbLayout  "be"
 XkbOptions "grp:caps_toggle"
							</screen>
							</para></listitem><listitem><para>							Don't forget to set up the system locale to be_BY.CP1251
							as described in <xref linkend="locale"></xref>.
						</para></listitem></itemizedlist><para>					To use windows-1251 with XFree 3.3.5 and 4.0, you have to
					apply a patch from Aleksey Novodvorsky that allows the use
					of windows-1251 with XKB. The original location is at
					<ulink url="ftp.logic.ru/pub/logic/linux/be-locale">ftp.logic.ru/pub/logic/linux/be-locale</ulink> 
					and it is also available from 
					<ulink url="http://bellinux.sourceforge.net/">the bellinux page</ulink>.  
					Lucky users of Linux-Mandrake RE get a patched XFree86 out
					of box.
				</para><para>					Belarusian keyboard layout is palnned for all XFree releases
					after 4.0.2. To make it work, you will have to add the
					following lines
					into <filename moreinfo="none">/etc/X11/XF86Config</filename>:
					<screen format="linespecific"> XkbModel   "microsoft"
 XkbLayout  "by"
 XkbOptions "grp:caps_toggle"										
				</screen>
			</para></sect3><sect3><title>					Windows-1251 in X Window System through Xmodmap
				</title><para>					
					<itemizedlist><listitem><para>								Uncomment
								<screen format="linespecific"> XkbDisable
								</screen>
								line in your <filename moreinfo="none">/etc/X11/XF86COnfig</filename>.
							</para></listitem><listitem><para>								Install windows-1251 fonts  for X Windows and
								make sure thay are before other fonts in the path.
							</para></listitem><listitem><para>								Make and install xruskb package which can be
								downloaded from
								<ulink url="http://bellinux.sourceforge.net">http://bellinux.sourceforge.net</ulink>
							</para></listitem><listitem><para>								Replace .xmm files in your xruskb directory by those
								found at 
								<ulink url="http://bellinux.sourceforge.net/">the bellinux page</ulink>.
							</para></listitem><listitem><para>								Add the following lines in your .Xdefaults file
							
								<screen format="linespecific"> xrus*modeButton1.labelString: BEL xrus*modeButton1.label: BEL
								</screen>
								
							</para></listitem><listitem><para>							Run							
							<screen format="linespecific"> xrus jcuken-cp1251
							</screen>							
							or 							
							<screen format="linespecific"> xrus jcuken-iso5
							</screen>
							to start keyboard switcher.
						</para></listitem></itemizedlist>
				
			</para></sect3></sect2></sect1><sect1><title>Editing texts</title><sect2 id="emacs"><title>Emacs </title><para>				Emacs is able to display Belarusian characters out of box in many
				Linux distributions. However, the following conditions should satisfy:
				<itemizedlist><listitem><para>							Cyrillic iso-8859-5 fonts should be installed.
						</para></listitem><listitem><para>							Emacs-mule package should be installed.
						</para></listitem></itemizedlist>

			</para><para>				The user may want to change the default keyboard layout
				(entinput methodent in emacs slang) to jcuken. This
				feature is provided by <filename moreinfo="none">belarusian.el</filename>
				along with some other goodies.  Read the comments in the
				beginning of <filename moreinfo="none">belarusian.el</filename> for details
				on the setup procedure.
			</para><para>				After installing <filename moreinfo="none">belarusian.el</filename>, you will
				be able to switch the input method, by typing
				<keycombo moreinfo="none"><keycap moreinfo="none">C</keycap><keycap moreinfo="none">\</keycap><keycap moreinfo="none">cyrillic-belarusian</keycap><keycap moreinfo="none">RET</keycap></keycombo>
			</para><para>				For a more user-friendly setup, put the following lines in the
				.emacs file:
				<screen format="linespecific"> ;; enables PC-like key mappings
 (pc-bindings-mode) 
 ;; enables PC-like selection
 (pc-selection-mode)
 ;; highlight selection
 (transient-mark-mode t)
 ;; use as many multilingual fonts as possible
 (set-default-font "fontset-standard") 
 ;; set up windows-1251 as default encoding everywhere
 (codepage-setup 1251)
 (set-terminal-coding-system 'cp1251)
 (set-keyboard-coding-system nil)
 (setq default-buffer-file-coding-system 'cp1251)
 (set-selection-coding-system 'cp1251)
 (prefer-coding-system 'cp1251)
 (define-coding-system-alias 'windows-1251 'cp1251)
 (define-coding-system-alias 'microsoft-1251 'cp1251)
 (define-coding-system-alias 'microsoft-cp1251 'cp1251)
 (define-coding-system-alias 'windows-cp1251 'cp1251)
 (define-coding-system-alias 'koi8-u 'cyrillic-koi8)
 (define-coding-system-alias 'KOI8-R 'cyrillic-koi8)
 (modify-coding-system-alist 'file "\.*" 'cp1251)
 (modify-coding-system-alist 'file "\\.el$" 'iso-2022-7bit)					
				</screen>
				This configuration is for windows-1251 setup.
			</para></sect2><sect2 id="spell-checking"><title>Spell-checking </title><para>
				<itemizedlist><listitem><para>							If you do not have ispell 3.1.20, install it from any Linux
							distribution CD.  
						</para></listitem><listitem><para>							Download the package 
							<ulink url="http://bellinux.sourceforge.net/belspell.tar.gz">belspell.tar.gz</ulink>.
							Unpack it and run							
							<screen format="linespecific">buildhash belarusian.sml belarusian.aff belarusian.hash
							</screen>
							
							
						</para></listitem><listitem><para>							Copy 
							<filename moreinfo="none">belarusian.hash</filename> 
							to 
							ent<filename moreinfo="none">/usr/lib/ispell</filename> 
							or wherever your ispell
							hash tables are.  
						</para></listitem><listitem><para>							in order to spell-check a file, type
							
							
							<screen format="linespecific">ispell -d belarusian yourfile.txt
							</screen>
							
							
						</para></listitem></itemizedlist>
				
			</para><para>				Getting belarusian ispell dictionary working with emacs is a bit
				tricky.
				
				<itemizedlist><listitem><para>							Copy 
							<filename moreinfo="none">ispell.el</filename> 
							and 
							<filename moreinfo="none">ispell.elc</filename> 
							into your
							<filename moreinfo="none">$EMACSBIN/../lisp</filename> 
							directory.  
						</para></listitem><listitem><para>							Copy temporarily
							<filename moreinfo="none">$EMACSBIN/../lisp/loaddefs.el</filename> 
							to
							<filename moreinfo="none">/usr/src/emacs-XX.X/lisp/loaddefs.el</filename> 
							where XX.X stand for emacs version number.
						</para></listitem><listitem><para>							<keycombo moreinfo="none"><keycap moreinfo="none">M</keycap><keycap moreinfo="none">x</keycap><keycap moreinfo="none">update-file-autoloads</keycap><keycap moreinfo="none">RET</keycap></keycombo>
							and enter the path to the ispell.el.
						</para></listitem><listitem><para>							Copy back <filename moreinfo="none">loaddefs.el</filename> 
						</para></listitem><listitem><para>							Restart emacs
						</para></listitem></itemizedlist>

			</para></sect2><sect2><title>TeX</title><para>				from Aleksey Novodvorsky:
			</para><para>				You need TeX + babel + T2, e.g. teTeX ent= 1.0.  in order to get partial
				support for Belarusian,
				
				<itemizedlist><listitem><para>							put 
							<filename moreinfo="none">babel.sty</filename>
							, 
							<filename moreinfo="none">belarusianb.ldf</filename> 
							and
							<filename moreinfo="none">belarusianb.sty</filename> 
							into
							<filename moreinfo="none">/usr/share/texmf/tex/generic/babel</filename> 							
						</para></listitem><listitem><para>							run
							<filename moreinfo="none">texhash</filename>
						</para></listitem><listitem><para>							To use Belarusian in LaTeX: add the
							following lines in the preamble:
							
							<screen format="linespecific">\documentclass[belarusian]{article} \usepackage[cp1251]{inputenc}
\usepackage{babel}
							</screen>														
							or													
							<screen format="linespecific">\documentclass[belarusian]{article} \usepackage[iso88595]{inputenc}
\usepackage{babel}
							</screen>
							

						</para></listitem></itemizedlist>
				
			</para></sect2></sect1><sect1><title>Browsers</title><sect2><title>Netscape</title><para>				It is often a problem to correctly visualize
				Belarusian-specific characters with Netscape.  This is due to
				that Netscape 4.x looks for
				<emphasis>any</emphasis> koi8-r font and, if it finds one,
				they refuse to use other fonts for displaying Cyrillic pages.
			</para><para>				The problem is solved by removing koi8-r fonts from everywhere - X
				Window System font path and font server path.Then install koi8-ru,
				iso-8859-5 or windows-1251 and run

				<screen format="linespecific">xset fp rehash
				</screen>
				
				or restart X server. You will probably have to delete
				<filename moreinfo="none">entpreferences</filename> and
				<filename moreinfo="none">preferences.js</filename> from the Netscape home
				directory <filename moreinfo="none">.netscape</filename> and even then you are
				not guaranteed to have Netscape work right. Netscape's
				handling of fonts has always been an obscure issue.
			</para><para>				Links to koi8-ru, iso-8859-5 and windows-1251 cyrillic fonts for X
				Window System can be found at
				<ulink url="http://bellinux.sourceforge.net">the bellinux page</ulink>
			</para></sect2><sect2><title>Lynx</title><para>				In order to view Belarusian sites, you have to set up you console to
				handle the encoding you need. See section <xref linkend="console"></xref> 
				for more details.
			</para><para>				Add the following lines to your <filename moreinfo="none">.linxrc</filename> file.
				
				<screen format="linespecific">character_set=Cyrillic (windows-1251) preferred_language=be
preferred_charset=windows-1251
				</screen>

				or
				<screen format="linespecific">character_set=Cyrillic (ISO-8859-5) preferred_language=be
preferred_charset=iso-8859-5
				</screen>
				if you have set up iso-8859-5 in console.
			</para><para>				If the page you are browsing does not have an explicit charset
				declaration, press <keycap moreinfo="none">o</keycap> and set the document
				charset manually.
			</para></sect2></sect1><sect1><title>Mailers</title><sect2><title>Netscape Messenger</title><para>				Netscape Messenger can not handle belarusian texts properly.
				The same applies to Mozilla.
			</para></sect2><sect2><title>Mutt</title><para>				Mutt handles a multitude of charsets and encodings with ease.  If your
				console has windows-1251 support, add the following lines to your
				<filename moreinfo="none">.muttrc</filename>:
				
				<screen format="linespecific"> charset-hook entwindows-1251ent entcp1251ent set charset=entwindows-1251ent
				</screen>
				
			</para><para>				Mutt automatically converts all incoming messages for the screen
				output. It can also convert outgoing messages basing itself on a
				versatile pattern matching mechanism, e.g.  the following line in
				<filename moreinfo="none">.muttrc</filename> will force mutt to convert all messages sent to
				be-locale@iatp.unibel.by to <emphasis>koi8-r</emphasis>.
				
				<screen format="linespecific">send-hook '~t ^be-locale@iatp\.unibel\.by$' 'set
send_charset=entkoi8-rent'
				</screen>
				
			</para></sect2></sect1><sect1><title>Further support</title><para>			A mailing list devoted entirely to Belarusian language support
			is available at
			<ulink url="mailto:be-locale@iatp.unibel.by">be-locale@iatp.unibel.by</ulink>.  
			To subscribe, send a message to
			<ulink url="mailto:majordomo@iatp.unibel.by">majordomo@iatp.unibel.by</ulink> 
			with the string entsubscribe be-locale youremailaddressent
			in the body of the message
		</para><para>			Another mailing list that treats mostly linguistic issues is
			available at
			<ulink url="mailto:movaznaustva@egroups.com">movaznaustva@egroups.com</ulink>. 
			To subscribe to it, send a message with empty body to
			<ulink url="mailto:movaznaustva-subscribe@egroups.com">movaznaustva-subscribe@egroups.com</ulink>.
		</para></sect1></article>

