This page mentions issues with Ubuntu LTS 6.06 specific to New Zealand, and should be considered a stop gap measure to get you up and running until the NZ dictionaries are available from the repositories.
This page is brought to you by the New Zealand LoCo team.
New Zealand customisation script
This script, written by John McPherson, will set your PC up for the en_NZ locale, and install en_NZ dictionaries for OpenOffice.org and myspell.
How to use
Click Applications -> Accessories -> Text Editor. Copy the below code into the editor:
VERSION="20060729"
# should work with ubuntu 5.10 (Breezy) and 6.06 (Dapper)
echo "## Locale Settings ($VERSION) ##"
#### locale
#means correct date formatting etc in locale-aware apps.
GENLOCALE=0
echo -n 'Checking if en_NZ locale is set up: '
# 6.06 dapper and later use this file
enlangfile=/var/lib/locales/supported.d/en
# 5.10 breezy and earlier used this file
if ! test -f $enlangfile; then enlangfile=/etc/locale.gen ; fi
if ! grep -q '^en_NZ[\. ]UTF-8' $enlangfile ; then
echo 'not set up.'
# could do "dpkg-reconfigure locales" and select en_NZ.UTF-8 but that
# requires user intervention
echo 'Adding UTF-8 version of en_NZ locale.'
echo 'en_NZ.UTF-8 UTF-8' >> $enlangfile
GENLOCALE=1
else
echo 'already available.'
fi
# dunno where other distros put this file
nz_locale_file=/usr/share/i18n/locales/en_NZ
if test -r $nz_locale_file ; then
echo -n 'Checking if en_NZ locale has AM/PM time strings set: '
if grep -q '^am_pm\W*""' $nz_locale_file ; then
echo 'missing. Now fixing'
perl -i -pe '
s/^am_pm\s+"".*/am_pm "<U0041><U004D>";"<U0050><U004D>"/
||
s!^t_fmt_ampm\s+"".*!t_fmt_ampm "<U0025><U0049><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/\n<U0025><U0070>"!' $nz_locale_file
GENLOCALE=1
else
echo 'ok'
fi
fi
if test $GENLOCALE -eq 1; then
echo 'Updating the en_NZ locale.'
locale-gen
fi
echo -n 'Setting en_NZ (UTF-8) as the default locale: '
# used to be /etc/environment (for debian sarge and ubuntu breezy),
# has dapper and later changed? (not sure where I got this idea from...)
# use /usr/sbin/update-locale instead?
localefile=/etc/default/locale
if test ! -r $localefile ; then
#touch $localefile
localefile=/etc/environment
fi
if test ! -r $localefile ; then
touch $localefile
fi
if ! grep -q 'en_NZ\.UTF-8' $localefile ;
then
echo 'LANG=en_NZ.UTF-8' >> $localefile
echo 'done'
echo '(this will take effect from your next login)'
else
echo 'already set'
fi
echo
echo '## Dictionary Settings ##'
### spelling/dictionaries
# wordlist (/usr/share/dict/words)
echo -n 'Checking British English word list: '
if ! dpkg -l wbritish > /dev/null 2>&1 ; then
echo 'need to install'
apt-get install wbritish wamerican-
else
echo 'already installed'
# set as default? using debconf somehow?
fi
# we install myspell-en-gb as well as manually install the NZ one because
# this one is nicely packaged and has the necessary 'Provides:' headers
# myspell (used by openoffice and mozilla)
echo -n 'Checking British English dictionary (myspell format): '
if ! dpkg -l myspell-en-gb > /dev/null 2>&1 ; then
echo 'need to install'
apt-get install myspell-en-gb
else
echo 'already installed'
fi
# do update-alternatives to make sure we point to the correct one?
# novell's suse linux professional 9.3 has myspell-new-zealand:
# /suse/noarch/myspell-new-zealand-20030907-6.noarch.rpm
# similarly, mandriva has myspell-en_NZ
echo -n 'Checking for New Zealand English dictionary (myspell format): '
if ! test -r /usr/share/myspell/dicts/en_NZ.dic; then
echo 'need to install'
( cd /usr/share/myspell/dicts &&
echo 'Grabbing files via FTP:' &&
wget ftp://ftp.services.openoffice.org/pub/OpenOffice.org/contrib/dictionaries/en_NZ.zip && unzip en_NZ.zip
)
else
echo 'already installed'
fi
# this file currently has hyph_en_US in it?!
#ftp://ftp.services.openoffice.org/pub/OpenOffice.org/contrib/dictionaries/hyph_en_NZ.zip
# openoffice's dictionary
# (openoffice uses "myspell" format dictionaries) -
if dpkg -l openoffice.org > /dev/null 2>&1 ;
then
if ! dpkg -l openoffice.org-thesaurus-en-us > /dev/null 2>&1 ;
then
# dapper has an Australian thesaurus in universe
echo 'Installing Thesaurus (en-AU only for now)'
apt-get install openoffice.org-thesaurus-en-au
fi
echo -n 'Setting up OpenOffice.org to use NZ dictionary: '
#for hyphenation, either apt-get install the myspell-en-gb above, or grab
#openoffice's hyph_en_NZ)
#add the following to /etc/openoffice/dictionary.lst
if ! grep -q en_NZ /etc/openoffice/dictionary.lst ;
then
cat >> /etc/openoffice/dictionary.lst <<EOF
# added explicitly for NZ English
DICT en NZ en_NZ
HYPH en NZ hyph_en_GB
THES en NZ th_en_AU_v2
EOF
echo 'done'
else
echo 'already set up'
fi
else
echo 'Openoffice.org not installed, not setting up dictionaries'
fi
exitSave the file in your home folder as ubuntu-nz-setup.sh
Open a terminal (Applications -> Accessories -> Terminal)
- Enter the following command (you will be prompted for your password:)
sudo sh ./ubuntu-nz-setup.sh
Maori spellcheckers
Click Applications -> Accessories -> Text Editor. Copy the below code into the editor:
#/bin/sh cd /usr/share/myspell/dicts echo 'Downloading dictionary files from OpenOffice mirror...' wget ftp://ftp.services.openoffice.org/pub/OpenOffice.org/contrib/dictionaries/mi_NZ.zip echo 'Extacting Dictionary Files...' unzip mi_NZ.zip echo "Tweaking openoffice dictionary config file - /etc/openoffice/dictionary.lst" cat >> /etc/openoffice/dictionary.lst <<EOF # added explicitly for NZ Maori DICT en NZ en_NZ EOF echo 'Install Complete'
Save the file in your home folder as fix-ooo-en-mi.sh
Open a terminal (Applications -> Accessories -> Terminal)
- Enter the following command (you will be prompted for your password:)
sudo sh ./fix-ooo-en-mi.sh
Setting defaults in OpenOffice.org
If you selected New Zealand as your location when you installed Ubuntu, then OpenOffice.org should already default to English (New Zealand).
If not, you can change it via the Tools menu -> Options -> Language Settings -> Languages.
Change the "Default languages for documents/Western" setting.
See also
Long Term Solutions
English Translation Team
If your are interested in localisation, the en_GB translation team is looking for people to help with en_GB/AU/NZ-esque translations.
Things to do (aka brain dump)
- Get OOo en_NZ and mi_NZ dictionaries packaged for Universe.
- Get a thesaurus working - is there an OOo thesaurus for NZ?