Tagged: Japanese

Exploring with Gentoo Linux (Part 5)

Part 5 - Let's type in Japanese

To be able to type and read in Japanese, input methods and input method editor (IME) need to be installed. For IME, I choose IBM since I'm used to using it. As for input methods, I tried both ibus-anthy and ibus-mozc and I couldn't get the property dialogue for ibus-mozc up and running, so I decide to continue using ibus-anthy.

Disclaimer:
The information in this site is the result of my researches on the Internet and of my experiences. This information below is solely used for my purpose and may not be suitable for others.

Installation:

Installation of ibus as well as its dependencies and Japanese engine, ibus-anthy, is no difficult tasks. # emerge --ask app-i18n/ibus app-i18n/ibus-anthy

Configurations:

Update ~/.xinitrc and include environment variables to set for ibus.

FILE ~/.xinitrc
export XMODIFIERS=@im=ibus export GTK_IM_MODULE=ibus export QT_IM_MODULE=ibus # Use `xim` in case some apps (like Chromium) refuse to work with IBus export GTK_IM_MODULE=xim export QT_IM_MODULE=xim ibus-daemon -drx

Then, start the setup program to do some configurations.$ ibus-setup

All I changed was the keyboard shortcuts and input methods. For keyboard shortcuts, I was hoping Alt+Shift would just work, but it didn't, so I changed it to Alt+Shift+space.

For input methods, I added Japanese - Anthy to enable Japanese input. You might have noticed that its icon is different from the default one. This is because I replaced its default icon with my own.

The configuration of ibus should be done now. You'll see a small EN icon in its systray. That confirms ibus is running now. Left click on the icon will show you the list available input methods, in this case, English and Japanese - Anthy.

Changing Default Anthy Icon:

I thought the default Anthy icon was not pretty and didn't like it. So, I decided to change it to my own. After searching for the icon in the system, I found it in /usr/share/ibus-anthy/icons/. It's called ibus-anthy.png. I used GIMP to create another icon and replaced it.

That's all!
-gibb

Building My Work Environment (Part 5)

Part 5 - Show Me Japanese in my Terminal

At this moment, any Japanese characters will show up as little rectangle shapes or some gibberish characters. This is, by default, because Slackware uses en_US as its locale. Locale is set using an environment variable, $LANG, and it is set in /etc/profile.d/lang.sh for system wide configuration.

I'd like to be able to read Japanese in terminals for myself, and don't need to apply this for the whole system. All I need to do is to export $LANG in .bashrc.

Disclaimer:
The information in this site is the result of my researches in the Internet and of my experiences. This information below is solely used for my purpose and may not be suitable for others.

The locale for Japanese can be found by running the following command:$ locale -a | grep -i jp ja_JP.eucjp ja_JP.utf8

The Japanese locale for my system is jp_JP.utf8 (or jp_JP.UTF-8). To apply this in my environment, update .bashrc:$ nvim ~/.bashrc ----------------------------------------- export LANG=ja_JP.UTF-8

After this, either logout and back-in or source .bashrc will display Japanese characters properly in terminal.

However, this brings a bit of problem in my status bar. Time/date is displaying in Japanese as well. This is not what I wanted.

To fix this, I forced i3pystatus to use the en_US locale in its configuration file.$ nvim ~/.config/i3/i3pystatusconfig.py ----------------------------------------- from i3pystatus import Status import os # Setting LANG to en_US to avoid # showing dates in Japanese os.environ['LANG'] = 'en_US' ...

After saving the file, $Mod+Shift+r will change date/time in English.

In next article, let's talk about enabling Japanese input.

That's all!
-gibb