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

Post a comment

You may use the following HTML:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>