Extension:Narayam

What can this extension do?
Narayam is a Mediawiki extension that helps to add different language input methods for the various text input fields quickly. The primary users of this extension are from wikis that use non-latin scripts. As of now, typing solutions are developed only for few Indic scripts (Malayalam, Tamil, Bengali, Sanskrit, and Hindi). You can ask at the |talk page to have a typing solution developed for your language.

Usage
The primary aim is to allow users to input text in the wiki without the support of any external typing tools.

Download instructions
Download Narayam and put it in to a directory names  under   Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.

Installation
To install this extension, add the following to LocalSettings.php:

Bengali

 * Avro (Phonetic)
 * InScript
 * National Keyboard

Esperanto

 * Esperanto x-code transcription

Kannada

 * Transliteration
 * InScript

Malayalam

 * Transliteration (Mozhi)
 * InScript

Odiya

 * Transliteration
 * InScript

Sanskrit

 * Transliteration
 * InScript

Sinhala

 * Singlish (Partial phonetic)
 * Wijesekara

Tamil

 * Transliteration
 * Tami99

Developing More Schemes
More input methods can be added by writing scheme data. Schemes should be in a special format, by following that format any one can develop their own input methods.

A scheme consists of rules used for transliteration. A rule is an array of three strings. The first string is a regex that is matched against the input string (the last few characters before the cursor followed by the character the user entered), the second string is a regex that is matched against the end of the key buffer (the last few keys the user pressed), and the third string is the replacement string (may contain placeholders like $1 for subexpressions). You do not need to add $ to the end of either of the regexes so they match at the end, this is done automagically.

The transliteration algorithm processes the rules in the order they are specified, and applies the first rule that matches. For a rule to match, both the first and second regex have to match (the first for the input, the second for the key buffer). Most rules do not use the keybuffer and specify an empty string as the second regex.

The scheme data object must have the following keys:
 * namemsg: Message key for the name of the scheme
 * extended_keyboard: Whether this scheme has an extended ruleset (bool)
 * lookbackLength: Number of characters before the cursor to include when matching the first regex of each rule. This is usually the maximum number of characters a rule regex can match minus one.
 * keyBufferLength: Length of the key buffer. May be zero if not needed
 * rules: Array of rules, which themselves are arrays of three strings.
 * rules_x: Extended ruleset. This is used instead of the normal ruleset when Alt is held. This key is only required if extended_keyboard is true

Let's consider sample parts from Sanskrit Transliteration scheme, since it utilize most features of rules.

In this map

['a', '','अ'],

['b', '','ब्'],

are direct maps, that is, when we type 'a' it will produce 'अ' in the text field.

Known Issues
Extended keyboards seems to do work only within Firefox. Also, browsers do not provide way to differentiate normal Alt and AltGr key events.