Insert Pali and Sanskrit Characters with diacritical marks on Discourse and operating systems

For Linux users there is a very good set of macros for LibreOffice called ComposeSpecialCharacters to be found as a simple .oxt file at extensions.openoffice.org/en/project/compose-special-characters

One just loads the file and it sets it all up for you. Therafter you can set a shortcut key (I have always used CTL-z) and then when you type, eg. “a-” “t.” or “n~” and press CTL-z, it converts them to ā ṭ ñ respectively. It only works when you press the shortcut key, so it does not interfere with typing normal English, and since it is a LibreOffice system, it can work just as well in Windows, using LibreOffice. It also provides French accents, and quite a number of other useful but awkward characters, even Greek.

In Windows there is a very powerful program called Keyman, produced by a company called Tavultesoft, for a very wide range of languages and scripts, amongst them a Sanskrit/Pali (Romanised) keyboard. The program is free for up to two keyboards, so one could have Pali and French, for example, and all for free. The system offers you a choice of keyboards on the Tool Bar, and one can switch with a click to the keyboard of one’s choice. It is a very efficient system, and typing in a foreign script can be effectively as fast as typing English - depending on your skills, of course! They keep it free for up to 2 keyboards because it is used by a lot of missionaries to translate the Bible into various languages, and they do not want to victimise them.

1 Like

One thing I forgot to mention about the Tavultesoft Keyman program that could be of interest to some members or visitors to this site is that among the amazingly wide selection of scripts it contains are all the modern S.E. Asian and Indian scripts.

1 Like

Some time ago I created a custom Pāli Linux keyboard layout, you might try it out if you need a keyboard layout to type in Pāli. There are instructions on installation in the README file.

The key bindings are:
Right-ALT + a = ā
RALT + i = ī
RALT + u = ū
RALT + g = ṅ
RALT + n = ñ
RALT + t = ṭ
RALT + d = ḍ
RALT + h = ṇ
RALT + l = ḷ
RALT + m = ṃ

And the github repository:
https://github.com/tuvok/pali

1 Like

Palipad is back online! With some minor issues

Thanks so much, this is a nice implementation. @blake, can we see if this is suitable to be dropped into Discourse?

We still have the issue that upstream Discourse is rewriting their editor with CommonMark, and there is no clear arrival date.

I don’t think it’s possible to drop in palipad here. I think you need to either customize Discourse or write a plugin for it.

1 Like

I’d like to offer another option for those using GNU/linux systems.

following http://www.thanhsiang.org/faqing/node/220

If you have any sort of “gui”/WM(window-manager), not even necessarily a full fledged DE (desktop environment) like LXDE, Gnome, MATE, etc., and chances are you do if you’re reading this in a modern web browser (and not an old text-based browser like lynx, for instance). Then you already have the X Windows System installed.

Just check to make sure you also have a utility called xmodmap (this method depends on it), which is included in the package named x11-server-utils in the debian repository (and most likely in the *buntu repositories of which the core packages are just Debian forks… but you should really be using Trisquel if you want a fully free/libre (as in freedom) ubuntu distro). The config for xmodmap can be invoked in the .xinitrc file residing in the user’s home directory.
sudo apt-get install x11-server-utils

Ok,so to check if this method will work for you, check that xmodmap is invoked in your .xinitrc file:
nano ~/.xinitrc
(or use whatever text editor you prefer)

check for the presence of the line:
xmodmap ~/.Xmodmap
now we know the location of the xmodmap config file

now edit that file:
nano ~/.Xmodmap
the relevant lines for adding IAST diacritics I’ve pasted below for good measure:

keycode 133 = Mode_switch
clear mod3
add mod3 = Mode_switch

keycode 38 = a A 0x01000101 0x01000100
keycode 31 = i I 0x0100012B 0x0100012A
keycode 39 = s S 0x01001E63 0x01001E62
keycode 30 = u U 0x0100016B 0x0100016A
keycode 40 = d D 0x01001E0D 0x01001E0C
keycode 42 = g G 0x01001E45 0x01001E44
keycode 43 = h H 0x01001E25 0x01001E24
keycode 44 = j J 0x010000F1 0x010000D1
keycode 45 = k K 0x01001E41 0x01001E40
keycode 46 = l L 0x01001E37 0x01001E36
keycode 58 = m M 0x01001E43 0x01001E42

keycode 25 = w W 0x0100015B 0x0100015A
keycode 57 = n N 0x01001E47 0x01001E46
keycode 27 = r R 0x01001E5B 0x01001E5A
keycode 28 = t T 0x01001E6D 0x01001E6C

keycode 13 = 4 dollar 0x01001E5D 0x01001E5C

You can use and mod1-5, the above example uses mod3. The above example also uses keycode 133 which is the left WIN key, personally, I’m using the right alt key for diacritical characters which is keycode 108 for my keyboard. Going down the list of keybindings holding Alt_R yields:
āīṣūḍṅḥñṁḷṃśṇṛṭṝ

1 Like

I followed this link and clicked on Unix (Linux) installation instructions and it brought me straight here again! :grin:

Another possible one for Windows / Mac is from Gandhari .org: ebmp.org - This website is for sale! - ebmp Resources and Information.

The Adelaide ‘nerdy-nuns’ are using Unicode-extended keyboards for both mac and windows 10 with great success. In windows their seems to be nothing extra to install. The mac link as above.

I’m still looking for a good way to type retrofex letters on my iPhone. I am reluctant to install a keyboard app as they have security risks attached. Stalking your keystrokes. Does anyone know an iOS native keyboard that has retro flex letters?

2 Likes

This will be of interest to the linux-using Pali scholars out there (and there actually seem to be several of you!).

I’ve written up a 4-page “Readme” to add a new “keymap” so that you can easily make all the Pali diacritics in Linux. You hold Right-Alt, then press the keys you’d expect, such as A, D, i, L, M, N, etc.

Bindings are all explained inside the .odt file (inside the attached zip file).

I’ve only shared this with a couple of Monk buddies so far (who used it on their own laptops), but I feel it’s time to show it to a wider audience. I’ve been using this and tweaking it for a few years now and I’m happy with where I’ve gotten it.

You need to at least have an Orange belt in Linux to follow these directions. :martial_arts_uniform: Especially Part 2 of the “Readme”, when you most likely aren’t specifically using the Distribution Xubuntu (which I was using when I wrote the document).

These directions are known to work well so far in:

  • Xubuntu 16.04
  • Ubuntu 16.04
  • Manjaro Gnome 17
  • Should also work in Ubuntu 18.04 when it comes out, since x.org will be the default, not Wayland.

Note: These directions are for x.org. Not tested in Wayland yet.

Pali_keymap_linux_xorg.zip (1.6 MB)

3 Likes

Dear Ven. Pasanna,
does that mean that in Win 10 you …

  • press down ALT (keeping it pressed down)
  • type ‘+’ followed by the hex character code of the unicode character
  • release the ALT key

I am currently looking for a solution under WIN 10, so I would just like to clarify, if I understood the method you are using correctly…

Thanks so much and with much mettā,
Robert

1 Like

Hi Robert,
I thought so, but I just setup the monastery win 10 machines and couldn’t find the correct extended keyboard. I ended up installing the one linked somewhere above by Ven. Anandajoti. It gives some annoying ‘not an official windows app’ messages which we ignore. Ideally I’d make it a startup item but with the warnings I can’t figure out how :frowning:

I swear I’ve forgotten all my tech smarts since moving to the forest.

Dear synesius,

thanks a lot for this hint re Keyman Desktop. Apparently, the software has become full freeware now.

In dire need of a flexible keyboard solution for Win 10, I gave Keyman Desktop 9 a go. Based on the very well documented tutorial I modified the tutorial’s French keyboard layout for English hardware-keyboards to a German-Pāli keyboard-layout, which works with a German hardware-keyboard using Keyman Developer (also freeware).

The current link to the website is: https://keyman.com/

With kind regards,
Robert

P.S.: For anyone who wants to “program” her or his own keyboard layout. Just start from the tutorial, which is really good. Then for the Pāli diachritics you could for instance use a lines like:

  • “+ [SHIFT RALT ‘a’] > U+0100”
  • “+ [RALT ‘a’] > U+0101”

Then for example typing Right-ALT-Key (which is AltGr on German keyboard) and ‘a’ would result in writing the letter ‘ā’, while additionally using SHIFT-key would result in ‘Ā’. You could also use the Left-ALT-Key:

  • “+ [SHIFT LALT ‘a’] > U+0100”
  • “+ [LALT ‘a’] > U+0101”

if you prefer this. So you only need to know the HEX Character Codes (see the attached document) and then you can quite comfortably design your individual keyboard layout.

HEX_Character_Codes.pdf (174.8 KB)

Dear Ven Pasanna,

I was successful using the solution suggested by synesius above: Keyman Desktop 9. I created my own keyboard layout using Keyman Developer, which is very well documented and quite straightforward. If you want to give this a try, I am happy to share the keyboard layout. In this case, just drop me a message, with an email, where I can send the short program of the layout and the compiled keyboard. (When I first read “programming” I was a little worried, because this can be difficult if the language is not documented. But Keyman Developer is very well documented and with an example program at hand you have your individual solution in an hour or so…)

Another option, which is less flexible, is to use the Palikeyboard, which I had used under Win 7 and described above. Despite a few error messages, it successfully installs under Win 10 if the .msi is executed. Also, if you still have a Win 7 machine at hand, you can use the ‘Microsoft Keyboard Layout Creator’ create your own keyboard there and install it under Win 10. However, maximum flexibility is only achieved with Keyman Desktop / Developer, because the ‘MKLC’ has some restrictions (for example the Left-ALT-Key cannot be used in a keyboard shortcut for a diachtitcal character).

With much mettā,
Robert

Hi!

I’m currently typing a manuscript for suttacentral and have made a Autohotkey script to do the Velthuis replacement on the fly. It’s my first time using this program, and I’m not sure if I’ve included all necessary characters, but it seems to work well.

You can install Autohotkey and use (and edit) the .ahk file, or simply take the .exe, which is a standalone, but uneditable. Both files are in the attached zip. Unfortunately it’s Windows-only.

Press f1 to toggle the replacement on/off.


The script:

 :?*:aa::ā
:?*:ii::ī
:?*:uu::ū
:?*:.t::ṭ
:?*:.m::ṁ
:?*:.n::ṇ
:?*:.d::ḍ
:?*:.l::ḷ
:?*:"n::ṅ
:?*:"s::ś
:?*:.s::ṣ
:?*:.r::ṛ
:?*:~n::ñ
f1::suspend

velthuis autohotkey 2018_06_24.zip (533.2 KB)

2 Likes

Be careful with those AHK scripts, ime they can get triggered when you’re not intending to use them and mess things up. Better to fix things at a “lower” level imo.

This is indeed true, especially for "s::ś and "n::ṅ. So for emails and general use this is not always the best system to use. But of course you can set up keys without those ones.

You can suspend this script, so it doesn’t get triggered when you don’t need Pali diacritics. But yeah, you’re right. There must be more beautiful ways to script this. In the keyboard layout United States International you can type "e and get ë. But if you do "(space)e you get "e. I’ve used this all my life. This is how I’d like it with "s and .n and such as well, but can’t (yet) be bothered to find out how. (.n needs a change, because otherwise it creates suttacentralṇet! :wink: )

Since I had similar problems with "s, I replaced it (using Autohotkey) with ''s (two single quotes). No more problems! And I made a new toggle switch, CTRL+f11.

velthuis autohotkey 2018_06_26.zip (533.2 KB)

:?*:aa::ā
:?*:ii::ī
:?*:uu::ū
:?*:.t::ṭ
:?*:.m::ṁ
:?*:.n::ṇ
:?*:.d::ḍ
:?*:.l::ḷ
:?*:''n::ṅ
:?*:''s::ś
:?*:''r::ṝ
:?*:''l::ḹ
:?*:.s::ṣ
:?*:.r::ṛ
:?*:~n::ñ
:?*:.h::ḥ
^f11::suspend

Edit: in case somebody else is interested. What I meant is called “dead keys”. Here’s an .ahk file that is probably editable to make it work with Velthuis Pali replacement. I’m happy for now, though. :slight_smile:

2 Likes

Thanks for posting! On OS X 10.8.5 it showed up without restart.

For anyone on a Mac using Dvorak, here’s a keymap modified from the one posted by @Robert_Grosch:
PaliDvorak_MAC.zip (18.5 KB)

1 Like

Does anyone know how to type Pali diacritics with Chrome OS? I can’t run Linux apps on my Chromebook, and I can’t use .exe files either.