2

Hello I'm trying to setup my Raspberry Pi for writing and I do plan on doing everything in terminal and maybe using the desktop if I need to do a bit of web browsing for research.

My problem is that I need to be able to switch back and forth from Korean to English while working in vi/nano.

I tried this suggestion by putting the following code into ~/.bashrc but it didn't work

setxkbmap -option grp:switch,grp:alt_shift_toggle,grp_led:scroll us,kr

Then when that didn't work I tried setting my etc/default/keyboard to

XKBLAYOUT="us,kr"
XKBOPTIONS=grp:ctrl_shift_toggle,lv3:ralt_switch,terminate:ctrl_alt_bksp,grp_led:scroll"

I got those suggestions from this site and a link he posted, but they're not working for me. I came from Ubuntu where its was super easy to change the language via the GUI and preferences that way so this way is new to me.

2

I think you find that those things work with X11 and not from a Linux console - I believe you will want to Read The Fine Man-pages to look at the command line program locale(1)1 and then set (and export) the relevant environment variables for the editor program to detect. i.e. type man locale.

locale -a should report all the locales available for you and changing the right variable (probably LANG for the system environment - where you are and the standards for your location; and LANGUAGE for what you want to enter) to what you want before starting your program should change your settings, i.e. on my Debian PC:

stephen@ripley:~$ locale -a
C
C.UTF-8
en_GB.utf8
POSIX
stephen@ripley:~$ locale
LANG=en_GB.UTF-8
LANGUAGE=en_GB:en
LC_CTYPE="en_GB.UTF-8"
LC_NUMERIC="en_GB.UTF-8"
LC_TIME="en_GB.UTF-8"
LC_COLLATE="en_GB.UTF-8"
LC_MONETARY="en_GB.UTF-8"
LC_MESSAGES="en_GB.UTF-8"
LC_PAPER="en_GB.UTF-8"
LC_NAME="en_GB.UTF-8"
LC_ADDRESS="en_GB.UTF-8"
LC_TELEPHONE="en_GB.UTF-8"
LC_MEASUREMENT="en_GB.UTF-8"
LC_IDENTIFICATION="en_GB.UTF-8"
LC_ALL=
stephen@ripley:~$ date
Tue Dec  8 14:57:49 GMT 2015

Now I haven't got the Korean locale currently installed but a quick

stephen@ripley:~$ sudo apt-get install locales-all
fixed that for me, so I can then do:

stephen@ripley:~$ export LANG=ko_KR.uft8
stephen@ripley:~$ export LANGUAGE=ko_KR.uft8
stephen@ripley:~$ date
2015. 12. 08. (화) 15:09:37 GMT
stephen@ripley:~$ locale
LANG=ko_KR.utf8
LANGUAGE=ko_KR.utf8
LC_CTYPE="ko_KR.utf8"
LC_NUMERIC="ko_KR.utf8"
LC_TIME="ko_KR.utf8"
LC_COLLATE="ko_KR.utf8"
LC_MONETARY="ko_KR.utf8"
LC_MESSAGES="ko_KR.utf8"
LC_PAPER="ko_KR.utf8"
LC_NAME="ko_KR.utf8"
LC_ADDRESS="ko_KR.utf8"
LC_TELEPHONE="ko_KR.utf8"
LC_MEASUREMENT="ko_KR.utf8"
LC_IDENTIFICATION="ko_KR.utf8"
LC_ALL=

Some of the bigger applications have their own localisation packages for each locale e.g. the Iceweasel (Debian branded FireFox web browser) but this should get you pointed in the right direction.

I did also need to install vim (and some dependencies as well) as the vim-tiny I found was installed and aliased to vi did not seem to be internationalised. I do not have any Pis up and running to test the situation for Raspbian.

All the locales together do take up a bit of space so you may want to run a command to remove the unneeded ones - I found localepurge in my Debian PC, I hope that made it across into Raspbian and that this gives you some pointers...!

1The convention for Unixes is to specify the "section" of the manual with ( and ) around the section number (or number with a letter suffix for some cases) - and Section 1 is all about command line programs!

  • 1
    Your thinking was correct: setxkbmap - set the keyboard using the X Keyboard Extension from man setxkbmap :-P – Diederik de Haas Dec 8 '15 at 16:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.