Update: Since this post was written, Ubuntu has come a long way with preconfiguring the input method editor, SCIM, for us. It is now ready to go practically out of the box. All you need to do is go to:
System > Administration > Language Support, check the box for
Hindi, click
Apply and then select the box for
Enable support to enter complex characters. Click
Apply and
OK. In a terminal type:
Code:
sudo aptitude install scim-m17n m17n-db m17n-lib-bin
hit enter, and once m17n is installed, logout and log back in, and SCIM should be up and running. There is now a great page for SCIM documentation
here, which should be your first stop if the above does not get SCIM running (with a keyboard on your panel). I'll put the now-obsolete steps previously required for SCIM configuration in a quote below for those on older versions of Ubuntu (or other varieties of Debian), for the sake of reference. Continue below the quote for specific instructions on my recommendations for better Sanskrit input.
Quote:
For anyone having difficulty setting up their system to handle Sanskrit input, I'd like to point you to the relevant documentation and provide a few tips to save you a few hours of googling and trial and error. General disclaimer: I am still a linux beginner and I've never written an official "tips and tricks" post before, so 1. caveat emptor and 2. all suggestions / feedback / improvements welcome!
Devanagari - देवनागरी
This has worked well in Ubuntu for some time now, it just requires a little system configuration (less now than previously). Before beginning, you might want to check out the SCIM documentation for Ubuntu here and here.
- Go to: System > Administration > Language Support, check the box for Hindi, click Apply and then the select box for Enable support to enter complex characters. Proceed to Step 2.
- That should have pulled in both the Scim input method editor and the Devanagari fonts packages necessary for unicode input. For those on other Debian systems, who lack the helpful Ubuntu menu mentioned above, you can manually install the packages with the following:
Code:
sudo aptitude install ttf-devanagari-fonts scim-qtimm scim-tables-additional scim-bridge scim-m17n m17n-lib-bin m17n-db scim-bridge-client-qt4 skim im-switch
- Configure your system by entering the following commands in a terminal (for those not in the US, enter the appropriate language / country codes in place of "en_US"):
Code:
im-switch -z en_US -s scim
export XMODIFIERS=@im=SCIM
export GTK_IM_MODULE=scim
export QT_IM_MODULE=scim
Note: A more general alternative to the first command is simply "im-switch -z all_ALL -s scim" which may be preferable depending on your language setup. Also, it should no longer be necessary, but if in the end SCIM does not work properly at startup, you could also add the last three lines of code above to the .bashrc file in your home directory and restart X.
- Set up SCIM to run at startup by going to System > Preferences > Sessions > Startup Program > + Add > Command and enter
|
That should be it for the basic set up. If you were to restart X or reboot at this point, you should be able to type in Devanagari with ease using SCIM / m17n. However, I would recommend first tweaking your input method, because although the hi-itrans transliteration scheme is by far the most user-friendly of those available (in being relatively phonetic), it has a few problems. One is that the combination "rh" is designed to yield ऱ् rather than र्ह् . Similarly there is no transliteration for the double daṇḍa (used at the end of stanzas, etc., i.e. — ॥ — requiring that one use the less elegant combination of two daṇḍas — ।। . Also, there are several keystroke combinations in the Itrans scheme which to me at least seem either unintuitive or a little unwieldy: e.g., "R^i" for ऋ .
UPDATE: This how-to used to describe a method for setting up a
new input method for Sanskrit, which had the advantage of not being overwritten by updates to m17n. With more recent versions of Ubuntu, however, that method no longer seems to work. Thus, I've rewritten the instructions below for a quick edit of the existing phonetic Devanāgarī input to make it more suited to Sanskrit input. When you update m17n, you'll just have to redo this one quick edit below--not as clean as the prior method, but it's nevertheless quick and easy.
- Exit SCIM (if you've already rebooted) and save a backup of your original input file (in your home directory):
Code:
cp /usr/share/m17n/hi-itrans.mim ~/
- then open that file for editing: type in a terminal
Code:
sudo gedit /usr/share/m17n/hi-itrans.mim
- Overwrite the contents of the file with the quote below. Select all (Ctrl-a) in that file and copy / paste the following quote into the hi-itrans file:
Quote:
;; hi-itrans.mim -- Hindi input method with ITRANS method
;; Copyright (C) 2003, 2004, 2005
;; National Institute of Advanced Industrial Science and Technology (AIST)
;; Registration Number H15PRO112
;; This file is part of the m17n database; a sub-part of the m17n
;; library.
;; The m17n library is free software; you can redistribute it and/or
;; modify it under the terms of the GNU Lesser General Public License
;; as published by the Free Software Foundation; either version 2.1 of
;; the License, or (at your option) any later version.
;; The m17n library is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; Lesser General Public License for more details.
;; You should have received a copy of the GNU Lesser General Public
;; License along with the m17n library; if not, write to the Free
;; Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
;; 02111-1307, USA.
(input-method hi itrans)
(description "Hindi input method by ITRANS transliteration.
For the detail of ITRANS, see the page:
<http://www.aczoom.com/itrans/>
")
(title "क")
(map
(starter
(".") ("~") ("#") ("$") ("^") ("*") ((S-\ )) ((C-@))
("0") ("1") ("2") ("3") ("4")
("5") ("6") ("7") ("8") ("9")
("A") ("C") ("D") ("G") ("H") ("I") ("J") ("K") ("L")
("M") ("N") ("O") ("R") ("S") ("T") ("U") ("Y")
("a") ("b") ("c") ("d") ("e") ("f") ("g") ("h") ("i")
("j") ("k") ("l") ("m") ("n") ("o") ("p") ("q") ("r")
("s") ("t") ("u") ("v") ("w") ("x") ("y") ("z"))
(consonant
("k" "क्")
("kh" "ख्")
("g" "ग्")
("gh" "घ्")
("~N" "ङ्")
("c" "च्")
("ch" "छ्")
("j" "ज्")
("jh" "झ्")
("~n" "ञ्")
(".t" "ट्")
("T" "ट्")
(".th" "ठ्")
("Th" "ठ्")
(".d" "ड्")
("D" "ड्")
(".dh" "ढ्")
("Dh" "ढ्")
(".n" "ण्")
("N" "ण्")
("t" "त्")
("th" "थ्")
("d" "द्")
("dh" "ध्")
("n" "न्")
("xn" "ऩ्")
("p" "प्")
("ph" "फ्")
("b" "ब्")
("bh" "भ्")
("m" "म्")
("y" "य्")
("r" "र्")
("xr" "ऱ्")
("l" "ल्")
("L" "ळ्")
("ld" "ळ्")
("v" "व्")
("w" "व्")
("sh" "श्")
("Sh" "ष्")
(".s" "ष्")
("s" "स्")
("h" "ह्")
("q" "क़्")
("K" "ख़्")
("xg" "ग़्")
("xj" "ज़्")
("z" "ज़्")
(".D" "ड़्")
(".Dh" "ढ़्")
("f" "फ़्")
("Y" "य़्")
("yh" "य़्")
("GY" "ज्ञ्")
("dny" "ज्ञ्"))
(independent
("a" "अ")
("aa" "आ")
("A" "आ")
("i" "इ")
("ii" "ई")
("I" "ई")
("u" "उ")
("uu" "ऊ")
("U" "ऊ")
(".r" "ऋ")
("RRi" "ऋ")
("R^i" "ऋ")
("LLi" "ऌ")
("L^i" "ऌ")
(".l" "ऌ")
(".c" "ऍ")
("e.c" "ऍ")
("E" "ऎ")
("e" "ए")
("ai" "ऐ")
("o.c" "ऑ")
("O" "ऒ")
("o" "ओ")
("au" "औ")
("RRI" "ॠ")
("R^I" "ॠ")
(".R" "ॠ")
("LLI" "ॡ")
("L^I" "ॡ")
(".L" "ॡ")
(".N" "ँ")
(".m" "ं")
("M" "ं")
("H" "ः")
(".a" "ऽ")
(".h" "्")
("AUM" "ॐ")
("OM" "ॐ")
(".." "।")
(".," "॥")
("0" "०")
("1" "१")
("2" "२")
("3" "३")
("4" "४")
("5" "५")
("6" "६")
("7" "७")
("8" "८")
("9" "९")
("#" "्र")
("$" "र्")
("^" "त्र")
("*" "श्र")
("]" "़")
((S-\ ) "*")
((C-@) "*"))
(dependent
("a" (delete @-) "")
("aa" (delete @-) "ा")
("A" (delete @-) "ा")
("i" (delete @-) "ि")
("ii" (delete @-) "ी")
("I" (delete @-) "ी")
("u" (delete @-) "ु")
("uu" (delete @-) "ू")
("U" (delete @-) "ू")
("RRi" (delete @-) "ृ")
("R^i" (delete @-) "ृ")
(".r" (delete @-) "ृ")
("LLi" (delete @-) "ॢ")
("L^i" (delete @-) "ॢ")
(".l" (delete @-) "ॢ")
(".c" (delete @-) "ॅ")
("e.c" (delete @-) "ॅ")
("E" (delete @-) "ॆ")
("e" (delete @-) "े")
("ai" (delete @-) "ै")
("o.c" (delete @-) "ॉ")
("O" (delete @-) "ॊ")
("o" (delete @-) "ो")
("au" (delete @-) "ौ")
("RRI" (delete @-) "ॄ")
("R^I" (delete @-) "ॄ")
(".R" (delete @-) "ॄ")
("LLI" (delete @-) "ॣ")
(".L" (delete @-) "ॣ")
("L^I" (delete @-) "ॣ"))
(return
((Return)))
(backspace
((BackSpace) (undo))))
(state
(init
(starter (pushback 1) (shift intermediate)))
(intermediate
(consonant (shift second))
(independent (shift finish))
(backspace)
(return (shift init)))
(second
(consonant)
(dependent (shift finish))
(backspace)
(return (shift init)))
(finish
(return)
(t (shift init))))
;; Local Variables:
;; coding: utf-8
;; mode: lisp
;; End:
|
- Hold back m17n-db. One neat trick is to hold back the m17n library package so that it won't update and overwrite your edits (you'll be warned first before dist-upgrades). To do that, enter in a terminal:
Code:
echo "m17n-lib-bin hold" | sudo dpkg --set-selections
and upgrades will bypass m17n, thus preserving your edits. If you opt not to hold that file, you'll just need to repeat the two steps above after updates to m17n to restore a more phonetic input in hi-itrans. For more information on holding and releasing packages, see here.
- You should feel free, btw, to tweak the above keyboard map to your tastes, just be sure not to create any conflicts in the process!
Reboot for your changes to take effect and then configure SCIM as necessary using "SCIM Setup" and select "hi-itrans" for phonetic Devanagari input. You can then select from among your newly installed Devanagari fonts (AksharYogini, Chandas, Gargi, Kalimati, Nakula, Sahadeva, Samanata and Sarai). For a very readable font with a decent set of ligatures, I like Kalimati, though for Sanskrit I tend to use Chandas because of its unparalleled ligature set.
Transliteration
Unlike Devanagari, there seems to be a relative dearth of information available for an intuitive system-wide Sanskrit transliteration input method. I have now found several different ways of going about this, two of which are listed below:
SCIM/m17n or
Xmodmap. I highly recommend the first alternative.
1st Alternative: SCIM/m17n
The best way to enable an inutitive Sanskrit transliteration input method is to create a new one using SCIM/m17n. The pdf referred to above has the necessary documentation. I will describe my setup below, by way of example.
- Exit SCIM.
- Create a new input method file, e.g.,
Code:
sudo gedit /usr/share/m17n/sa-translit.mim
and enter the appropriate file preamble and desired keystroke combinations. The following is the complete content of my file which can be easily copied and pasted and tweaked according to your taste. Save it, before closing the file:
Quote:
;;; <li> sa-translit.mim
;;;
;;; Input method for Sanskrit transliteration using the ITRANS scheme.
(title "sa-translit")
(map
(trans
("aa" "ā")
("AA" "Ā")
("ii" "ī")
("II" "Ī")
("uu" "ū")
("UU" "Ū")
(".r" "ṛ")
(".R" "Ṛ")
(".rr" "ṝ")
(".RR" "Ṝ")
(".l" "ḷ")
(".L" "Ḷ")
(".ll" "ḹ")
(".LL" "Ḹ")
(".M" "ṁ")
(".m" "ṃ")
(".h" "ḥ")
(".H" "Ḥ")
(";n" "ṅ")
(";N" "Ṅ")
("~n" "ñ")
("~N" "Ñ")
(".t" "ṭ")
(".T" "Ṭ")
(".d" "ḍ")
(".D" "Ḍ")
(".n" "ṇ")
(".N" "Ṇ")
(";s" "ś")
(";S" "Ś")
(".s" "ṣ")
(".S" "Ṣ")
))
(state
(init
(trans)))
|
- Enter the name of our new input file in the m17n database file.
- In a terminal enter
Code:
sudo gedit /usr/share/m17n/mdb.dir
- change the following lines
Quote:
(input-method * "*.mim")
;;; </ul>
|
to read
Quote:
(input-method * "*.mim")
(input-method t sa-translit "sa-translit.mim")
;;; </ul>
|
- Save and exit.
Simply restart SCIM at the command line with
or if that fails to load the new input method, "sa-translit," restart X or reboot. Your new transliteration input method should be available under the "Other" category.
2nd Alternative: XModmap
If for whatever reason, you need another method for transliteration, you can use XModmap. I've given instructions for that
here. This method uses less convenient dead keys, however, and is not convienently switchable, unlike m17n.
I hope this post is of use to others in need of Devanagari and transliterated input on linux.
शुभं भवतु । śubhaṃ bhavatu |