I found myself over and over again looking at some Japanese texts (mostly in Emacs) and thinking that it would be nice to have some simple functionality to transcribe regular text with kanji characters into hiragana (I'm still a beginner and know only a handful of kanjis, so this would allow me to read Japanese texts without poring over a dictionary). So how can this be done in Emacs?
I've written before about my Emacs mode for kanji that allows you to point at a character and retrieve its stroke order. I've put in some more work and created wrappers around the excellent Kakasi utility for transcribing Japanese text.
How To Use It?
Once you have
kanji-mode installed (it can be installed from MELPA), you can enable it in a buffer by running M-x kanji-mode. It then provides you with two new key bindings:
- M-s M-h (or M-x kanji-mode-kanji-to-hiragana) - for transcribing kanji to hiragana
- M-s M-r (or M-x kanji-mode-all-to-romaji) - for transcribing Japanese script to romaji
Additionally, both these functions have three modes of operation, depending on the prefix arguments provided:
- No prefix - display results in the minibuffer
-1(M--) - put results in the kill-ring
- Any other prefix - display results in a separate buffer
I hope Emacs fanatics who happen to be Japanese learners will find this addition helpful.