How to configure an English Japanese capable Debian.
This howto is a step by step guide to configure a working Debian
english system, with the capability of displaying
AND writing japanese. I gathered information from various sources (see
at the end of the
document) that already wrote on the issue and tried succesfully to get
such a system working but, as
far
as I know, none of them is complete. Therefore, this document is aimed
at giving
all the clues to properly set up a japanese capable english
operating
system.
Notes: Since english isn't my native language, please apologize for my
bad english. Any help on that matter is most welcome. Besides, if you
want to
add some information, such as "French japanese capable OS" or "Russian
japanese capable OS", just go ahead and send me an email: I'll be
pleased to add such information. Adding specific information about
other distributions is appreciated, too.
Note: I installed the Etch pre release version, and all this document
is about Etch (more or less). If you want some informations for woody
or sarge, please see the version 1.1 of this document.
1.Packages installation
You need a bunch of package to be able to use japanese (from Debian
Reference):
- install Kana-to-Kanji conversion system and dictionary (for
Japanese):
canna – Local server ("free-beer" license), or
freewnn-jserver – Network-extensible server
(Public Domain)
- install Japanese input method system (for Japanese):
kinput2-canna – for X, or
kinput2-canna-wnn – for X, and
im-switch
- Install compatible terminals (for all):
xterm – X (for ISO-8859-1 and UTF-8),
kterm – X (for Japanese EUC), and
mlterm – X (multilingual).
rxvt-ml - X (multilingual).
- Install japanese font:
ttf-kochi-gothic – X (for ISO-8859-1 and UTF-8),
ttf-kochi-mincho – X (for Japanese EUC), and
- xfonts-intl-japanese
gsfonts-wadalab-mincho - X (multilingual).
The list seems to be the minimum requirement. You may need additional
fonts,
and the best way to find out is to use apt-cache (such like "aptitude
search mincho" or "aptitude search kochi")
- LaTeX and CJK installation (if needed)
- latex-cjk-japanese (or latex-cjk-all)
- hbf-kanji48
- Configuration
I might have forgotten some packages, feel free to mail me if you
notice something is missing
Since I'm familiar with canna and kinput2, I suggest you use it, too.
2. Locales installation
You must add to your system the proper locales:
en_US.UTF-8
ja_JP.UTF-8
You may need some older ISO charsets if you use old softwares which still don't understand UTF-8.
To do this, just type dpkg-reconfigure locales and follow the
instructions. The tool will generate all the locale you checked in.
3. User local configuration
Please be aware that japanese is not possible on purely console mode,
unless you have an advanced text mode AND a special software.
My goal is to set up the japanese under X so this part won't be in this document.
You'll need to use the set-language-env
script. Select the "8 : ja (Nihongo,Japanese)" and answer all
questions default (it is written in japanese and I'm not able to
translate it)
The set-language-env
script will modify your .bashrc, .bash_profile and .xsession files.
The system is quite clever:
- If your terminal is japanese capable, you will have a japanese
locale
- If not, it falls back to C locale.
This system is very useful to Japanese speaking users,but it is not
suitable for English speaking users who need a system which responds in
english, not in japanese. Besides, if the terminal you use to launch X
with startx isn't japanese capable, your X Window session won't be as
well.
So you need to change a few things.
add this at the start of your .xsession, just after the line:
export LANG
#force EN menu and error displaying
LANGUAGE=en_US.UTF-8
export LANGUAGE
You'll still have Japanese locales ON, but all the common display will
be in english.
4. *dm tuning
It should work out of the box this the .xsession is the only change you must make.
5. Startx and X tuning.
If you prefer use startx, just do this:
edit your .xinitrc file and add this, just before window manager.
# Start Japanese environment
export LANG=ja_JP.UTF-8
LANGUAGE=en_US.UTF-8
export LANGUAGE
# Start Japanese input
XMODIFIERS="@im=kinput2"
export XMODIFIERS
kinput2 -xim -kinput -canna &
xmodmap -e 'keycode 115 = Kanji'
[window manager - mine is fvwm2]
All the locales will be set to japanese but, to keep the English
menu, we add LANGUAGE set up to en_US locale. You can probably use your own
locale as well (such as French) but you may have some problems with
accents and kanji - it must work perfectly with the UTF-8 charset.
At this stage, we launch the kinput2 software which can handle japanese
entry, and we add the left Windows Key as "Kanji Key". The default
{Shift space} remains, but
since the Windows key is unused...
List of the Windows Keys codes.
left Windows key: 115
right Windows key : 116
right Window menu key : 117
Note: I tried to do the same with the Default Gnome's Window Manager
but the Windows Keys seem to be redesigned for the WM itself.
In this case, the [kanji key] is SHIFT SPACE only.
6. fvwm2 tuning
Well, it's not really tuning, but the font in the configuration sample
files aren't japanese capable, so you need to change them. I suggest
-misc-fixed-*-*-*-*-14-*-*-*-*-*-*-* instead, which is quite similar.
You may notice that the japanese isn't properly handled in the
FvwmPager, and I still don't know why.
7. Others window managers
If you use the default gnome WM, it must work out of the box.
8. X software
If everything goes smooth, you must be able to launch your favorite
software with
japanese writing enabled.
Note: if you launch it from a xterm, it will not work! You need to
launch it from the fvwm2 menu.
a. Terminal.
To test if it works, launch a kterm or a krxvt and type this:
ga[kanji key]ga[enter]
You must get this:

If you've followed this document, [kanji key] must be {Shift space} or
the left Windows key.
The basic use of kinput2 is quite simple.
- Switch into Kanji mode (hit the Kanji key): You are in the normal
mode.

- Start typing: you are in hiragana mode. Type watashi, you will
see this:

- Then, hit the space key. it becomes this:

It suggests the most used kanji at first.
- Re hit space and you'll have a new window which which contains
more kanji:

- After selecting the correct kanji by hitting space, press enter.
You
are back to normal mode. You can continue typing some japanese or hit
kanji key again to get back to english.
Please notice you can't hit the kanji key in hiragana mode, or
you'll loose what you're typing. I suggest you hit enter at each
Japanese word to avoid mistakes.
b.LaTeX-CJK
For basic information about LaTeX, please go to the main website.
CJK stands for Chinese Japanese Korean. We'll see here how to use LaTeX
to write Japanese.
After installing the cjk-latex package, don't forget to run texconfig
in
the root account to have all stuff OK.
Then, to start a Japanese text, type this before:
\begin{CJK*}{JIS}{song}
and \end{CJK*} at the end.
Please notice you might have some errors if you use XEmacs
(never try with emacs): XEmacs is often puzzled with charset, and
especially with Japanese ones. Try using vim instead.
Besides, using accents in a CJK section coded in JIS, EUC or SJIS will
make some odd things. I've never tried the UTF8 subsystem, though.
Anyway, I think - at this time - the most standard is to use a JIS/EUC
charset and forge the accents, like \'e instead of é.
To test if LaTeX works, feel free to download this example.
It's one of my japanese texts I've made for my japanese course (I'd
learning japanese): This is BAD japanese (very bad) but there is
useful CJK commands in it, and basics cases are shown. Please refer to
/usr/share/doc/cjk-latex/commands.doc.gz and
/usr/share/doc/cjk-latex/ruby.doc.gz for details.
c.Various X softwares
Here are some others examples:
- Gimp 2.2. It works perfectly if you select the japanese capable
fonts.

- Firefox: It should work out of the box

I've wrote "edogawa" in the search field. Please note the "a"
hiragana in the small window below, which tells you you are in japanese
mode.
You can download the 2.1 version at OpenOffice.org. It's a free
download.
OOo needs some Asian languages tuning: Go to Tools -> Options

At the first launch, "Searching in" and "Asian Layout" may not be
displayed. You must first check "Asian languages support", select
"Japanese" in "Default languages for documents" and click OK.
Then, you MUST see "Searching in" and "Asian Layout".
After that, go to "Text document" and "Basic Fonts" (both): you must
set up the proper default font for English (first one) AND japanese. I
suggest you use the "Mincho" font.
There is a special issue about OOo: The Japanese isn't properly handled
by the default UI font, so you will have something like this:

Yeah, quite ugly.
Here comes the hint (Thanks to Takamichi Akiyama from
discuss@ja.openoffice.org)

You need to TYPE "Andale Sans UI" in the "Font" field even if the font
is not in the
listbox.
Use Mincho in the "Replace with" listbox under Linux, and "MS Mincho"
under Windows XP.
And you will have this:

You can see that both the window manager (fvwm2) and OpenOffice fully
understand japanese. We've done it!
Please note that this hint works under Windows XP.
You can test your OOo configuration with this file,
which is the OOo file in the latest screenshot.
Note: To make furigana in the 1.1 version, select the kanji and pull down "Format ->
ruby": you will be able to add furigana in your text like the latest
example.
In the 2.X version, please use "Format -> Asian phonetic guide"
10. Printing.
Not tested at this time. please get back for the 1.3 version which must be released soon.
Although the printing with OpenOffice works perfectly well, it won't
work with Mozilla.
I still haven't found a way to directly print with mozilla.
By the way, you can use PS file output, and I've done some test with
the PS conversion, and the
result depends on the page charset and
default charset you use.
- This one
must work.
- This one
must not, since the charset page is false (iso-8859-1) and must be a
Japanese one. As a workaround this, simply go to view -> Charset
Coding -> iso-2022-jp.
When the PS file looks good on your system, use ps2ps to force the
Japanese font, and print the resulted file. It MUST work.
For plain text, I've found one way, but need to pass through
a2psj and ps2ps, so I've made a very simple bash script:
#!/bin/sh
#Small script to print japanese text on printer.
#Usage: lprj [text file] [-P[printer]]
FILE=`echo $USER`-`date +%s`.ps
a2psj $1 >/tmp/$FILE
ps2ps /tmp/$FILE - |lpr $2
There are probably plenty of better methods, mail me if you have
something better (wonder if I must mind deleting the tmp file)
This is the end.
And you must have a quite useful Japanese capable english operating
system.
Feel free to mail me
(text only email) if you want to add something, comment or anything.
References and usefull links.
If you have made some similar document about another distribution, feel
free to mail me, I'll be glad to add it.
I use all of this documents to make mine, it may be useful for others.
Debian: Basic
japanese configuration under Debian (Osamu Aoki -
) .
Debian: Some
usefull hints (debian ML -
).
Debian: How to
set up pine/pico in japanese (JWS -
).
Mozilla/Kinput2: Default
key for kinput2 under mozilla (Katsuhiko
Momoi -
).
Mozilla/X: Use of
xmodmap, use of xinitrc (laeren
-
).
X tuning: Some
clues about xmodmap (various -
).
Gnome: Prise en charge
du japonais sous debian (Charles Plessy -
)
OOo: Basic
use (Jim Breen -
).
OOo: Figure
out which debian fonts I need (Noriaki
Sato -
).
OOo: I've
found
the hint but Takamichi Akiyama told me the way to make it (OOo -
).
OOo: Good
way to find out which font on
your
system is japanese capable under OOo (discuss@ja.openoffice.org -
).
OOo: How
to configure furigana (OOo -
).
Thanks
- Takamichi Akiyama, who have resolved my OOo problem
- G. Roderick Singleton, for redirected me on the
discuss@ja.openoffice.org mailing list
- Charles Plessy, for the hint about Gnome setup
- Michel Givon, for greatly improving English
Changelog
January, 6th 2007: Version 1.2
- Updating document for Etch relase. Olders versions is no longer supported but the version 1.1 remains available.
August, 15 2004: Version 1.1
- Improving English (Thanks to Michel Givon)
- Adding a Gnome part (Thanks to Charles Plessy)
May, 30 2004. Version 1:
Back to index.
Guillaume "LoneWolf" Estival.