English and Māori with Debian GNU/Linux

[The following notes were accurate until around 2006. These days, support for Māori can be set up using the regular system settings dialogs.]

The Debian GNU/Linux Operating System includes support for New Zealand English and Māori. These notes describe how to enable that support using Debian 3.1 ("Sarge").

Setting up the locales

Debian's locales package includes the en_NZ and mi_NZ templates.

  1. Install the locales package:
    # apt-get install locales
    
  2. Add these two lines to /etc/locale.gen:
    en_NZ.UTF-8 UTF-8
    mi_NZ.UTF-8 UTF-8
    
  3. Compile the new locales by running locale-gen:
    # /usr/sbin/locale-gen
    

Very few command-line programs include māori language translations, but a lot of the core GNOME and KDE programs do. To run a GNOME program (e.g. gedit) in māori, with NZ English as a fallback, try something like this:

$ export LANG=mi_NZ.UTF-8
$ export LANGUAGE=mi_NZ:en_NZ
$ gedit

(The macrons will probably be a mess. The section on fonts deals with that.)

To avoid having to export those variables manually, use your /etc/environment and ~/.bash_profile files. For example, to make NZ English the system default, your /etc/environment would look something like this:

LANGUAGE=en_NZ:en
LANG=en_NZ.UTF-8

To make māori the default for a particular user, with English as a fallback, add the following lines to his or her ~/.bash_profile:

export LANGUAGE=mi_NZ:en_NZ:en
export LANG=mi_NZ.UTF-8

You might like to add the following line to /etc/locale.alias, too.

maori  mi_NZ.UTF-8

That'd make LANG=maori equivalent to LANG=mi_NZ.UTF-8.

Installing fonts

TrueType Fonts for X11

The fonts in Debian's ttf-bitstream-vera package cover most West European languages, including English. For the macrons necessary for māori, install the ttf-freefont package.

# apt-get install ttf-bitstream-vera ttf-freefont

Note that you can drop additional TrueType fonts into your ~/.fonts directory. (Microsoft's Arial, Verdana, Georgia and Courier New fonts look nice and include macrons. If you have those, you might as well rescue them before converting your Windows partition to ext3.)

For an xterm, try:

$ uxterm -fa 'Free Mono' -fs 12

(Here's my ~/.Xresources file, with settings for uxterm.)

Console font

Terminus is a nice looking console font with macrons.

# apt-get install console-terminus

Take a look in /usr/share/doc/console-terminus for documentation.

My ~/.bash_profile includes these lines:

if [ "$TERM" = linux ]; then
  unicode_start ter-v16b.psf 2>/dev/null
fi

(FIXME: it's probably nicer to switch all consoles to Unicode during boot.)

Setting up the keyboard

This section assumes you're using an ordinary US-style keyboard and PC.

Typing macrons with X11

The Latvian keyboard layout can be used for māori.

$ setxkbmap lv

Pressing the right-hand ALT key plus a vowel key should now get you that vowel with a macron.

If you're running GNOME, it's probably best to use GNOME's Keyboard Indicator applet. Right-click on a GNOME-panel, select Add to Panel, and choose the Keyboard Indicator. Open the Keyboard Indicator's preferences dialog. Under Layouts, add Latvian.

Another option is to edit /etc/X11/XF86Config-4:

Section "InputDevice"
  Identifier  "Generic Keyboard"
  Driver  "keyboard"
  Option  "CoreKeyboard"
  Option  "XkbRules"    "xfree86"
  Option  "XkbModel"    "pc104"
  Option  "XkbLayout"   "us,lv"
  Option  "XkbOptions"  "grp:switch,grp:sclk_toggle,grp_led:scroll"
EndSection

That should let you switch between us and lv layouts by pressing the Scroll Lock key.

Typing macrons on the console

The following script generates nz.kmap.gz, a console keymap based on the plain US keymap.

#!/bin/sh

# mknz.sh
#   Makes nz.kmap.gz from us.kmap.gz
#   Usage: mknz.sh > nz.kmap.gz

PROG=$(basename $0)
TMPFILE=${TMPDIR:-/tmp}/$$.$PROG

US_KEYMAP=/usr/share/keymaps/i386/qwerty/us.kmap.gz

gunzip -c "$US_KEYMAP" |
  sed -e '1 s/ us.map/ nz.map/' \
      -e 's/^keymaps.*$/keymaps 0-6,8-9,12/' \
  > "$TMPFILE" || exit

cat <<- EOF >> "$TMPFILE"
altgr keycode 30       = amacron
altgr shift keycode 30 = Amacron
altgr keycode 18       = emacron
altgr shift keycode 18 = Emacron
altgr keycode 23       = imacron
altgr shift keycode 23 = Imacron
altgr keycode 24       = omacron
altgr shift keycode 24 = Omacron
altgr keycode 22       = umacron
altgr shift keycode 22 = Umacron
EOF

gzip -c "$TMPFILE"

To use nz.kmap.gz, run loadkeys:

$ loadkeys nz

Now press the right-hand ALT key plus a vowel key. The result should be a vowel with a macron.

More information



trmusson@gmail.com
2022-06-08

Free Software Foundation Valid XHTML 1.0!