View previous topic :: View next topic |
Author |
Message |
Sudrien Apprentice
Joined: 01 Oct 2003 Posts: 207 Location: Michigan
|
Posted: Tue Dec 07, 2004 3:52 pm Post subject: HOWTO: Enabling Japanese (or: CJK in KDE & Gnome) |
|
|
This is a static version of Enabling Japanese at the Gentoo Wiki. A pervious version is archived here. This contents of this page was updated on 3 Febuary 2006.
Enabling Japanese
Support is available in the Desktop Environments forum. Make sure to include all the appropriate versions of things - like kde-3.3.4.
Of all languages to learn, Japanese is known as one of the most challenging - not because of the spoken language, but the written language. The objective of this HOWTO is to make your gentoo box work with that written language. For this, there are two sections: Japanese Fonts, and Japanese Input. Those setting up input should, of course, set up their fonts first. New installations will want to make sure they have the proper USE flags set, as outlined below.
---
Japanese Fonts
You simply want to read the stuff, say, in Mozilla Firefox. You need to install fonts - A good sign that you have not installed the proper fonts is that the following characters appear as boxes with numbers inside: 日本語フォント
emerge media-fonts/kochi-substitute For Japanese
emerge media-fonts/arphicfonts For Chinese
emerge media-fonts/baekmuk-fonts For Korean
It never hurts to get them all.
There are other cjk and unicode fonts available in the portage tree, to be found with emerge search fonts, with some notible exceptions: Bitstream Cyberbit, available in an ebuild outside of portage, due to questions in licensing. Arial Unicode MS is another great font, which you may or may not have access to. There have been reports of errors in emulators while using this font, but this same procedure can be followed for any Microsoft-provided truetype fonts you may find:
Find a copy of aruniupd.exe - online availability changes.
Code: | cabextract aruniupd.exe |
For system-wide installation use
Code: | cp *.ttf /usr/share/fonts/ |
for local installation (no root access)
Then
Programs will probably have to be restarted to access new fonts.
Arial Unicode MS is now available to your system. Web browsers like Firefox should probably have this mentioned in their settings. Specifically, in Mozilla Firefox, look at See Preferences >> General >> Fonts & colors >> Fonts for: Japanese
Java 1.4.x
This has been tested on blackdown-jdk-1.4.2.03 :
Code: | cd $JAVA_HOME/jre/lib/
cp font.properties font.properties.old
cat font.properties.ja | sed "s/-watanabe-mincho/-misc-Kochi Mincho-medium/g" | sed "s/-wadalab-gothic-medium/-misc-Kochi Gothic-medium/g" > font.properties
echo 'appendedfontpath=/usr/share/fonts/kochi-substitute' >> font.properties
/usr/sbin/env-update && source /etc/profile |
Java 1.5 (unverified)
frostschutz says:
According to some docs I've read, Java 1.5 is supposed to support 'fallback fonts' without having to add them explicitely to fonts.properties. So all you have to do is to create a .../jre/lib/fonts/fallback/ directory and put at least one unicode font with Japanese support in there (or, since these fonts tend to get very big, just a symlink to an existing font in your /usr/share/fonts/ directory).
Japanese Input
Fonts are not enough for you? Good. Let's prep your system for input support. It should be noted that this process is quite similar for Chinese, Korean, and a host of other languages.
Setting Locale
Using japanese characters means using character sets outside the normal POSIX range; Unicode characters. To input them, you need to allow their use on your system.
Code: | locale
LANG=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=
|
All of the entries should be either blank or say "POSIX", unless your locale has been previously set. If so, you need to figure out where. ; )
Code: | locale -a
de_DE.utf8
en_GB.utf8
en_US.utf8
fr_FR.utf8
ja_JP.utf8
|
Gives a list of all the unicode locales availble on your system. This list can be expanded or limited by editing your needed locales, should you be missing an entry. Uou are choosing the language you want your menus to be in, NOT the one you are currently setting up input for. For example, a Frenchmen wanting to write japanese would choose fr_FR.utf8 from this list.
Now, continuing with the Frenchman example:
Code: | echo LANG="fr_FR.UTF-8" >> /etc/env.d/02locale
env-update
>>> Regenerating /etc/ld.so.cache...
source /etc/profile |
Notice the change from utf8 to UTF-8. It is required since all UTF 8 enabled locales are specified in terms of UTF-8 and not utf8. Make sure it has taken effect.
Code: | locale
LANG=fr_FR.UTF-8
LC_CTYPE="fr_FR.UTF-8"
LC_NUMERIC="fr_FR.UTF-8"
LC_TIME="fr_FR.UTF-8"
LC_COLLATE="fr_FR.UTF-8"
LC_MONETARY="fr_FR.UTF-8"
LC_MESSAGES="fr_FR.UTF-8"
LC_PAPER="fr_FR.UTF-8"
LC_NAME="fr_FR.UTF-8"
LC_ADDRESS="fr_FR.UTF-8"
LC_TELEPHONE="fr_FR.UTF-8"
LC_MEASUREMENT="fr_FR.UTF-8"
LC_IDENTIFICATION="fr_FR.UTF-8"
LC_ALL=
|
If not, restart, reboot, and ask questions afterwards.
Ok, one answer: /etc/env.d/02locale is used because of precident, and outlined as such in Using UTF-8 in Gentoo, a good thing to read if you have issues at this point or later.
Setting USE flags
Next, you need to add the following USE flags to your make.conf, if they do not already exist:
cjk - standing for 'Chinese Japanese Korean' - gives support for Hanzi-inspired characters ( two byte, kanji, the reason you get al those accented 'a's).
nls - 'native language support' - supposedly for enabling other languages in your interface, the nls flag could be used by some ebuilds as an 'other language support'; Enabled this as a one of many safeguards to ensure that Japanese locality is compiled in.
immqt-bc - lets Qt handle different input methods.
-immqt - This is explicitly disabled because it conflicts with immqt-bc. Setting this flag would require recompiling all programs that depends on Qt3, and has broken in the past. THis recomendation will change with Qt4.
unicode - Unicode is the pot every character is thrown in (except cursive Hebrew, apparently ^.^; )
With these flags set in your /etc/make.conf, you should make sure all your currently portage-installed packages have the correct support built in. New systems should make sure to do this early (if not recompiling all packages), to avoid rebuilding as much software packages as possible.
Code: | emerge world --newuse |
Input Methods
Now, Japanese has both kana and kanji - you need a dictionary to give you possible kanji. Anthy is different from other systems available because it does not require any services to be started.
Now that the dictionary is installed, an additional input method will be built.
UIM, the Universal Input Manager, is what routes keyboard input.
On its own, UIM is enough (under gtk+) to handle Japanese input. You can check this from the text entry context menu of most gtk+ programs (excluding firefox), in which UIM-anthy will be one of the new choices. UIM, in fact, becomes the defauilt gtk+ input method once installed - and it has a Gnome control panel available if you are satisfied with switching methods via keyboard. (qt requires an export QT_IM_MODULE=uim statement)
Graphical Input Method selection
SCIM, the Smart Common Input Method, provides a taskbar icon and menu for switching between input methods. It is especially good for computers with more than two methods available - or for people that prefer mouse access.
Qt needs an aditional step to use scim - emerge scim-qtimm. GTK+-only users do not need to do this though.
Now that everything is installed, we just need to tell everything to use scim. The following can go in /etc/xprofile for all users, or your own ~/.xprofile.
Code: | export XMODIFIERS=@im=SCIM
export XMODIFIER=@im=SCIM
export GTK_IM_MODULE=scim
export QT_IM_MODULE=scim |
Wrapping up
To actually use your input method, you will at have to env-update; source /etc/profile and restart X11; you may possibly have to reboot.
Once you have done so, start up a text editing program like kwrite or gedit. A keyboard icon will appear in the system tray, that lets you select from your different input methods.
Once you are using an input method, like uim-anthy, there several modes to choose from: raw input, hiragana, katakana, half-width katakana, and a typewriter-like variation of the latin alphabet. Start typing in Hiragana mode, and you text will be converted as the appropriate kana are found. The spacebar brings up a list of possible kanji and cycles through it, and hitting enter accepts and uses the replacement. More keyboard combinations are at uim-anthy.
Notes
CJK fonts sometimes cause xorg-x11 compiled with the flag hardened to fail when starting up. Reference
"To enable UTF-8 on the console, you should edit /etc/rc.conf and set UNICODE="yes", and also read the comments in that file"
"Alternate WMs" Reference
GMplayer just doesn't, okay?
If you get letters that are inconsistant with the font you expected, you are not using raw input mode. Try some other modes.
The SCIM button can seem to flash or temporatily dissapear. This is because scim keeps settings per program - firefox input could be in Japanese while Gedit is in another language.
Gjiten & Kiten (part of kedu) are japanese dictionary programs, using EDICT. Gjiten is more comprehensive, but requires you to manualy install dictionaries. Nihongo Benkyo is another possibility, Bug 112894 for ebuilds
We'll get to Qt4 when KDE does.
See also
HOWTO Make your system use unicode/utf-8
Inputting Japanese text in Linux and some BSDs
Linux Internationalization HOWTO
SCIM wiki
Anthy Wiki (Japanese)
UIM
More on Chinese fonts
---
Support is available in the Desktop Environments forum. Make sure to include all the appropriate versions of things - like kde-3.3.4.
Last edited by Sudrien on Fri Dec 15, 2006 3:58 pm; edited 35 times in total |
|
Back to top |
|
|
Radi Tux's lil' helper
Joined: 09 Jul 2002 Posts: 108
|
Posted: Wed Dec 08, 2004 2:51 pm Post subject: |
|
|
thanks for the howto.
i was looking for a programm like scim for quite a while. For Konfiguration Issues and kde integration you can add
to your howto.
i put the language variables into the /etc/xprofile file.
Code: |
export LANG=de_DE.UTF-8
export LC_CTYPE=ja_JP.UTF-8 # this modification is needed if you want to use openoffice with scim!!!!!!!!
export XMODIFIERS=@im=SCIM
export GTK_IM_MODULE=scim
export QT_IM_SWITCHER=imsw-multi
export QT_IM_MODULE=scim
|
This is also working if you use kdm or gdm |
|
Back to top |
|
|
Sudrien Apprentice
Joined: 01 Oct 2003 Posts: 207 Location: Michigan
|
Posted: Wed Dec 08, 2004 5:34 pm Post subject: |
|
|
Thanks, Radi.
Content deleted due to ebuild changes
I don't think the QT_IM_SWITCHER really needed - imsw-multi is the default, is it not?
-Sud.
Last edited by Sudrien on Fri May 20, 2005 2:25 am; edited 1 time in total |
|
Back to top |
|
|
Vanquirius Retired Dev
Joined: 14 Jun 2002 Posts: 1297 Location: Ethereal plains
|
Posted: Fri Dec 10, 2004 2:20 am Post subject: |
|
|
どもーありがと!
I can finally type Japanese in Firefox (火の狐), whoo−hoo. And converting kana to Kanji works as a charm too! No more nasty Kanjipad ;−) _________________ Hello. |
|
Back to top |
|
|
RyoHazuki n00b
Joined: 16 Nov 2004 Posts: 39 Location: Tokyo, Japan
|
Posted: Mon Dec 13, 2004 1:53 am Post subject: |
|
|
Guys,
Sorry for the lame question..
but do you think this may also work for Gnome?
I am despertly in need to write japanese under Gnome.
Cheers,
Ryo |
|
Back to top |
|
|
Vanquirius Retired Dev
Joined: 14 Jun 2002 Posts: 1297 Location: Ethereal plains
|
Posted: Mon Dec 13, 2004 2:12 am Post subject: |
|
|
Second line of this thread, click on the link. _________________ Hello. |
|
Back to top |
|
|
RyoHazuki n00b
Joined: 16 Nov 2004 Posts: 39 Location: Tokyo, Japan
|
Posted: Mon Dec 13, 2004 2:15 am Post subject: |
|
|
Vanquirius wrote: | Second line of this thread, click on the link. |
Obrigado!
silly me. |
|
Back to top |
|
|
Sudrien Apprentice
Joined: 01 Oct 2003 Posts: 207 Location: Michigan
|
Posted: Mon Dec 13, 2004 5:35 pm Post subject: |
|
|
RyoHazuki wrote: |
but do you think this may also work for Gnome?
|
Actually, this should work under Gnome, and any other setup with a standard system tray. I had it working under my (custom) Xfce4 setup for a while, although uim-anthy is all I really need. But many people like buttons.
-Sud. |
|
Back to top |
|
|
Sudrien Apprentice
Joined: 01 Oct 2003 Posts: 207 Location: Michigan
|
Posted: Thu Jan 13, 2005 6:40 pm Post subject: |
|
|
I'm offically recomending this thread over the old one now.
-Sud. _________________ ... |
|
Back to top |
|
|
rshadow Apprentice
Joined: 28 Nov 2003 Posts: 176
|
Posted: Fri Jan 14, 2005 10:37 am Post subject: |
|
|
Anybody know the LC_CTYPE for Korean? I've been trying to get a korean input solution for the wife for a very long time. |
|
Back to top |
|
|
Sudrien Apprentice
Joined: 01 Oct 2003 Posts: 207 Location: Michigan
|
Posted: Sat Jan 15, 2005 4:28 am Post subject: |
|
|
rshadow wrote: | Anybody know the LC_CTYPE for Korean? I've been trying to get a korean input solution for the wife for a very long time. |
I believe ko_KR.utf8 us the one you want (check the capitolization, that can matter).
Uim should include at least one korean input. Just skip the anthy/canna stuff, and you should be set. (Should, as in I-don't-know-any-korean)
-Sud. _________________ ... |
|
Back to top |
|
|
hiroki Guru
Joined: 29 Jul 2003 Posts: 327 Location: @home in germany
|
Posted: Sat Jan 15, 2005 12:04 pm Post subject: |
|
|
hi!
i'm using SCIM for a long time now (for inputting japanese, chinese and korean). but.. there is just one problem with it. and as i read your howto i think you might have that problem too.
setting LC_CTYPE=ja_JP.UTF-8 causes my JAVA-apps to run in japanese, too!! i have no explanation why LC_CTYPE changes the interface-language, but myjava-apps are now in japanese. at least those, that have a japanese translation available! only when i set LC_CTYPE back to de_DE i have the usual german/english interface. but this again makes it impossible to use SCIM in that special application i start with de_DE as LC_CTYPE.
any solutions for that??
thx |
|
Back to top |
|
|
yaneurabeya Veteran
Joined: 13 May 2004 Posts: 1754 Location: Seattle
|
Posted: Sat Jan 15, 2005 10:14 pm Post subject: |
|
|
Borrowing a Naruto key phrase:
すげぃだってばよ! やっと俺がリナックスでも日本語で書けるじゃあん。
One question though... Where might the text-config be so I can change the char map for this sucker? The key input options (even when I can change them) sort of suck for the scim config. I can't get any of the good function keys to work under XFCE and my options are sort of limited to ALT, SHIFT, CRTL, SPACE, and RELEASE. |
|
Back to top |
|
|
Sudrien Apprentice
Joined: 01 Oct 2003 Posts: 207 Location: Michigan
|
Posted: Sun Jan 16, 2005 3:43 am Post subject: |
|
|
hiroki: As far as I know, setting LC_CTYPE differently is only needed for Openoffice-1.x, to get around a known issue. You should not need to set it in any other case (which would include openoffice-ximian, which I would recomend if at all possible). Your input methods tend to ignore these values, since they are for other languages already.
For future refernce, what input methods do you prefer?
yaneurabeya: Um... What? My japanese isn't what it could be. But for key mapping, you need to understand this: scim is only the means to choose your input method. Yes, it does have some methods of its own, but if you are using the uim-anthy or uim-canna of this tutorial, you will have to look up uim configuration.
And pass informative links back to the community.
-Sud. _________________ ... |
|
Back to top |
|
|
hiroki Guru
Joined: 29 Jul 2003 Posts: 327 Location: @home in germany
|
Posted: Sun Jan 16, 2005 12:17 pm Post subject: |
|
|
Sudrien wrote: | hiroki: As far as I know, setting LC_CTYPE differently is only needed for Openoffice-1.x, to get around a known issue. You should not need to set it in any other case (which would include openoffice-ximian, which I would recomend if at all possible). Your input methods tend to ignore these values, since they are for other languages already. |
well, I use OpenOffice (not ximianized version). And I additionally have an OpenOffice-2-beta installed. So I'm going to try whether OpenOffice2 still needs this LC_CTYPE-flag or not. If so I'll have to keep it and watch all my JAVA-apps running in Japanese [urg] and of not, I'llkick it out. A Japanese interface is not that bad, it's just that some apps use fonts, that cannot display Japanese characters and then show lots of ugly boxes
Otherwise it would be OK.
Sudrien wrote: |
For future refernce, what input methods do you prefer?
|
I use SCIM in order to access the following input methods:
Japanese -> SKK
Chinese -> SmartPinyin, WuBi (When I only know the Japanese reading of a character and therefore need to type it just by knowing it shape/components)
Korean -> Romaja
PS:
harharrrrr, OpenOffice2 doesn't need LC_CTYPE to be set in order to allow SCIM to work.. yeeeehaaaaa
/me is thinking about trying ximian openoffice though...
/me wonders whether it's better?
but /me definately likes (loves?) OOO2
PS2:
sorry, it was all wrong... I cannot use SCIM without LC_CTYPE set anymore... neither in OOO nor in i.e. Xterm...
PS3:
OK, now it's enough!
I just simply unset LC_CTYPE, I guess that was wrong. So setting it to de_DE.UTF-8 [and LC_ALL, too, and LANG, too] helped. workes fine, for all apps! yippieh!!!
PS4:
OMG! Won't this end! I discovered that with LC_CTYPE=de_DE.UTF-8 I cannot type Japanese [or generally speaking: use SCIM] when launching an xterm from another xterm. So typing "xterm" [enter] in an already running xterm will end in a new xterm that cannot use SCIM >< |
|
Back to top |
|
|
hiroki Guru
Joined: 29 Jul 2003 Posts: 327 Location: @home in germany
|
Posted: Sun Jan 16, 2005 10:04 pm Post subject: |
|
|
OK
I don't know why, but over here it does not work without LC_CTYPE=ja_JP.utf8
I have nooo idea why. If LC_CTYPE is not modified from the default (POSIX?) or set to de_DE.utf8 I cannot type Japanese [use SCIM], I can only use it in GTK-apps. (but not in Xterm, or qt-apps, etc.)
WHY? |
|
Back to top |
|
|
erwan Apprentice
Joined: 01 Jun 2003 Posts: 150 Location: Tokyo
|
Posted: Mon Jan 17, 2005 7:21 am Post subject: |
|
|
Well, I think the LC_CTYPE thing is not specific to OpenOffice but to any non-Gtk+2 non-Qt application.
However, I have a problem with these X applications, for example Java applications. When I hit Ctrl+space the SCIM bar actually appears but I can only select English/European, not Japanese. It is working fine in both Gtk+2 and Qt applications, and I have LC_CTYPE set to ja_JP.UTF-8. _________________ See me on Jabber: erwan@im.loisant.org |
|
Back to top |
|
|
vyzivus Apprentice
Joined: 05 Jul 2004 Posts: 173 Location: Slovakia
|
Posted: Mon Jan 24, 2005 3:06 pm Post subject: |
|
|
T-5h: I needed to type five sentences in japanese (I'm using UIM)
T-4h: Aha, so gcc-3.4.3 is the source of anthy's dementness! WTF? Butterfly effect totally sucks to this Like, "I fart here" VS "dark force conquers hundred planets" is more connected than this crap. Oh well. I'd love to use canna, if I may, oh the great UIM.
T-3h: UIM does not support canna (my .uim file:
Code: | (define default-im-name 'canna)
(define-key generic-on-key? '("<Shift><Control> "))
(define-key generic-off-key? '("<Shift><Control> ")) |
uim-im-whatever offers only anthy (plus skk plus other things obviously from second reality)
T-2.5h: A little lunch would be wise.
T-2h: SCIM is nice but I don't need to click through 5 menus to change the keyboard, thank you. Ctrl+Shift+Space is enough for me.
T-1h: SCIM supports anthy and UIM, which supports only anthy.
NOW: UIM still does not support canna. AAAAAAAAAAAAAAAAAAAAAARRRRRRRRRRRRRRGHHHHHHHH!!!!!!!!!!!!!!! _________________ I thought what I'd do was, I'd pretend I was one of those deaf-mutes or should I? |
|
Back to top |
|
|
Sudrien Apprentice
Joined: 01 Oct 2003 Posts: 207 Location: Michigan
|
Posted: Mon Jan 24, 2005 7:16 pm Post subject: |
|
|
UIM-Canna will be created with emerge uim only when canna has already been installed.
-Sud. _________________ ... |
|
Back to top |
|
|
2crazy n00b
Joined: 07 Apr 2003 Posts: 54
|
Posted: Tue Jan 25, 2005 4:03 am Post subject: |
|
|
Hi all,
say, what backend are you using? I'm asking because neither of them converts hiragana into kanji the way was used to with im-ja. Since im-ja doesn't work with gtk+ 2.6, I switched to scim.
I tried skk, wnn, anthy, or the generic tables, no real kanji conversion
Am I missing somthing here? Hirgana/Katakana are working just fine though.
Thanks |
|
Back to top |
|
|
Sudrien Apprentice
Joined: 01 Oct 2003 Posts: 207 Location: Michigan
|
Posted: Tue Jan 25, 2005 4:09 am Post subject: |
|
|
The standard keys are: Shift+space ひらがな, which will be underlined. then you continue hitting the spacebar for kanji options,a nd enter to confirm.
If you're using GTK 2.6, I'd suggest canna. make sure the init script is running.
-Sud. _________________ ... |
|
Back to top |
|
|
yaneurabeya Veteran
Joined: 13 May 2004 Posts: 1754 Location: Seattle
|
Posted: Thu Feb 03, 2005 6:48 am Post subject: |
|
|
Just thought I might mention my findings from this thread: https://forums.gentoo.org/viewtopic.php?p=2050028#2050028 . In short, if certain programs like Mozilla stop working, recompile scim and scim-uim.
Also, it seems as if anthy works fine with gcc 3.4.3 now, but I'm not 100% sure...
//Edit: It doesn't work after all. |
|
Back to top |
|
|
yaneurabeya Veteran
Joined: 13 May 2004 Posts: 1754 Location: Seattle
|
Posted: Sun Feb 06, 2005 9:14 am Post subject: |
|
|
やった!GCC 3.4.3を使って、Anthy 5900-r1でまた日本語で書けるようになちゃったひょ~~!!! ^0^.
Translation: emerge anthy-5900-r1 if you have gcc-3.4.3 .
Add app-i18n/anthy ~x86 to /etc/portage/package.keywords.
They did change the conversion tables a bit though. Can't get 小さい「い」 by typing 'li' like in previous versions of anthy and Windows IME. So, just out of curiousity, is there any way to fix this Sud ? |
|
Back to top |
|
|
hiroki Guru
Joined: 29 Jul 2003 Posts: 327 Location: @home in germany
|
Posted: Sun Feb 06, 2005 4:27 pm Post subject: |
|
|
yaneurabeya wrote: | Can't get 小さい「い」 by typing 'li' like in previous versions of anthy and Windows IME. So, just out of curiousity, is there any way to fix this Sud ? |
maybe you should try "xi"... also works for "xtsu"? (ぃ|い)(っ|つ) |
|
Back to top |
|
|
yaneurabeya Veteran
Joined: 13 May 2004 Posts: 1754 Location: Seattle
|
Posted: Sun Feb 06, 2005 10:52 pm Post subject: |
|
|
hiroki wrote: | maybe you should try "xi"... also works for "xtsu"? (ぃ|い)(っ|つ) |
Awesome, thanks for the tip . Now what about the dot (in Windows can be referenced with the forward slash key)? |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|