How to Install Gujarati and Hindi Language Support in Linux

If you like my Gujarati Phonetic or Hindi Phonetic keyboard layouts for Windows and you also use Linux, I have created these phonetic keyboard layouts for Linux as well. There is one limitation in Linux. You cannot type multiple characters with one keypress. Hence, in Linux, Shift+M does nothing while in Windows Shift+M types હ્મ, which is a combination of 3 characters (હ + ્ + મ). All of the keys in Windows which type multiple characters are omited in the Linux version.

Installing the layout in Linux is a bit more complicated since it's not really an installation program like in Windows. But if you're familiar with Linux, you probably know how to get around the OS. You will need root access to certain folders and files. However, one benefit is that the keyboard is easier to modify since the key maps is a text file which can be edited quited easily with root access.

I've tried many flavors of Linux, including Ubuntu, OpenSUSE, Fedora, and Linux Mint. The method is similar in all these; however, there's one step where the process is different, as you will see below. If it doesn't work, you should try modifying another file for your Linux flavor.

1. Install Gujarati (and Hindi) Language Support

First, you need to add Gujarati language to your Linux. This will install the necessary files and fonts required for Gujarati and Hindi Unicode support.

a) Go to System --> Administration --> Language Support.
Linux Language Support Menu

b) Click Install/Remove Languages.
Linux Language Support Box

c) Select Gujarati and Hindi checkboxes. Let Linux install the languages. Once it finishes, go to next step. You may need to restart.
Linux Language Support Menu

2. Download in.txt File and Rename to in

First, download the file called in.txt found here. This simple text file contains the key maps for Gujarati Phonetic and Hindi Phonetic keyboard layouts. You need to change the filename so it doesn't have the .txt extension after downloading. You will modify your system's in file or replace it with this one. If the file opens in your web browser, then simply copy the content into a new text file and name it in.

3. Modify or Replace in

The keyboard layouts for all Indic languages are found in a file called in located in ./usr/share/X11/xkb/symbols folder. This folder contains keyboard layouts of all languages installed. There are two ways you can install the phonetic layouts. You can either replace the file with the one you downloaded above. Replacing this file will remove the default layouts for all Indic languages and only give you the Gujarati Phonetic and Hindi Phonetic layouts.

in file in Linux

If you want to keep the default layouts of Indic languages and add the phonetic layouts, you need to modify the file using a text editor with root access and add the text in the in file you downloaded. Just add the text found in the in file you downloaded to the end of your system's in file.

4. Making the Layout Appear in Your Keyboard Options

Once you modify or replace the in file, you still will not have an option to choose the layout. You have to add it as an option. You need to add the following line to the file called base.lst, evdev.lst, and xfree86.lst in the folder ./usr/share/X11/xkb/rules/:

guj-ph          in: Gujarati Phonetic
hin-ph          in: Hindi Phonetic

Next, add the following entries to base.xml, evdev.xml, and xfree86.xml files found in folder ./usr/share/X11/xkb/rules/:

<description>Gujarati Phonetic</description>
<description>Hindi Phonetic</description>

Although I mentioned to edit 3 pairs of files (6 total), not each is required to be edited. However, to ensure your keyboard layout shows, I recommended editing all three. There's no harm in editing all of them. After you have edited the files, log off, then log back on for changes to take effect.

5. Adding the Layout to Your Keyboard Options

Lastly, you need to add Gujarati Language to the keyboard options so you can select it when needed. The example below shows how it's done in Ubuntu.

a) Go to System --> Preferences --> Keyboard
Linux Keyboard Selection Menu

b) Then, click on the Layout tab, then click Add...
Linux Keyboard Add

c) Next, add Gujarati Phonetic and Hindi Phonetic layouts by selecting from the dropdown lists. These options will appear if you followed all steps correctly above and after loggin back on again.
Linux Keyboard Add Gujarati

d) Lastly, if you followed all steps correctly, you'll also see it in your language selection icon in the status bar.
Linux Keyboard Add Gujarati

The Gujarati Unicode font usually included with Linux is Lohit-Gujarati.