Files
mediawiki-extensions-Univer…/lib/jquery.ime/rules
Amir E. Aharoni a682cd3f59 Update jquery.uls and .ime from upstream
jquery.uls:
* Localisation updates.
* Change font-size unit from px to em
  See https://github.com/wikimedia/jquery.uls/pull/408
* Update language-data:
  See https://github.com/wikimedia/jquery.uls/pull/412
* Minor internal JS code cleanup for eslint.
Updating to
fe46a2f7ce

jquery.ime
* In API calls, accept langCodes that have no input methods
  See https://github.com/wikimedia/jquery.ime/pull/460
* Add a layout for the General Alphabet of Cameroon Languages
Updating to
ac21ea1b4a

Change-Id: I2be4ee30f649f6a906e776c37afa0ebdf2dc454f
2022-02-08 17:05:09 +02:00
..
2019-05-21 14:45:50 +03:00
2019-05-10 21:44:55 +03:00
2016-04-12 11:52:46 +05:30
2020-11-04 14:22:43 +02:00
2017-05-04 09:33:57 +03:00
2014-05-28 09:37:45 +00:00
2020-06-14 15:51:50 +03:00
2016-04-12 11:52:46 +05:30
2019-05-10 21:44:55 +03:00
2022-01-17 16:54:04 +05:30
2013-08-19 04:40:08 +00:00
2019-05-10 21:44:55 +03:00
2013-10-29 14:08:52 +01:00
2019-05-10 21:44:55 +03:00
2018-12-08 18:15:15 +02:00
2022-01-17 16:54:04 +05:30
2020-01-06 07:02:34 +00:00
2016-04-12 11:52:46 +05:30
2019-05-10 21:44:55 +03:00
2016-04-12 11:52:46 +05:30
2013-08-19 04:40:08 +00:00
2018-12-08 18:15:15 +02:00
2022-01-17 16:54:04 +05:30
2016-04-12 11:52:46 +05:30
2018-12-11 09:30:00 +02:00
2018-12-03 14:35:51 +02:00
2020-10-02 20:45:12 +03:00
2013-04-23 16:03:28 +03:00
2016-04-12 11:52:46 +05:30
2016-04-12 11:52:46 +05:30
2020-12-23 13:33:52 +00:00
2016-04-12 11:52:46 +05:30
2016-04-12 11:52:46 +05:30
2016-04-12 11:52:46 +05:30
2020-12-07 15:51:10 +02:00
2016-04-12 11:52:46 +05:30
2016-04-12 11:52:46 +05:30
2016-04-12 11:52:46 +05:30
2016-04-12 11:52:46 +05:30
2021-01-15 16:14:58 +02:00
2019-05-21 14:45:50 +03:00
2016-07-12 10:43:35 +00:00
2016-04-12 11:52:46 +05:30
2016-04-12 11:52:46 +05:30
2013-08-19 04:40:08 +00:00
2016-04-12 11:52:46 +05:30
2016-04-12 11:52:46 +05:30
2019-05-15 10:43:00 +03:00
2020-04-07 13:34:22 +03:00
2019-05-10 21:44:55 +03:00
2019-05-10 21:44:55 +03:00

jQuery.ime Input method specification

Input methods are defined in javascript files. An input method is a javascript object and it is passed to $.ime.register() method to register with jquery.ime

eg: $.ime.register( hebrewStandardKeyboard );

Input methods can be built by reusing parts of other methods, this is especially interesting for complex patterns. If rules are reused then the methods must be loaded first. This is done through configurations in jquery.ime.inputmethods.js.

For examples on reuse, see the rules "nb-normforms" or "hi-inscript".

Metadata fields

id: A mandatory unique identifier that represents the input method. eg: "hindi-inscript"

name: A mandatory short name for the input method. eg: "Hindi InScript"

Note that the names used in the menu comes from jquery.ime.inputmethods.js

description: An optional short description about the input method. eg: "keyboard layout as per inscript standard"

date: An optional string to represent when this input method was written. Format should be: yyyy-mm-dd

author: An optional string containing the authors name. Can contain email address as well. eg: "Santhosh Thottingal, <santhosh.thottingal@gmail.com>"

URL: A mandatory string containing URL for source where keyboard is defined, information about trademark restrictions if any, layout and help.

license: An optional string containing licence information. Eg: "CC-BY-SA" or "GPLv3".

version: An optional string containing version information.

Input method definition

patterns: A regular expression table that maps the original inputs to the target language.

eg:

patterns: [
		[ 'q', '/' ],
		[ 'w', '\'' ],
		[ 'e', 'ק' ],
		[ 'r', 'ר' ],
		[ 't', 'א' ],
		[ 'y', 'ט' ],
		[ 'u', 'ו' ],
		[ 'i', 'ן' ],
		[ 'o', 'ם' ],
		[ 'p', 'פ' ]
		// ...
		// These characters are mirrored in RTL languages
		[ '\\(', ')' ],
		[ '\\)', '(' ],
		[ '\\[', ']' ],
		[ '\\]', '[' ]
	]

Any valid regular expression is possible as first element of each array item.

ex: [ '([ക-ഹ])a', '$1ാ' ] ex: [ '(([ൺ-ൿം])\u200c+)?I', '$2ഐ' ]

In the above example, $1, $1 etc are according to the normal regular expression replace syntax.

The second member of the pattern can be a function as well.

eg:

patterns: [ [ '[a-z]', function ( $1 ) {
			return $1.toUpperCase();
		} ] ]

This rule replace all key strokes to its upper case character.

patterns_x: Defined the same way as ordinary patterns, but active while holding down the alt key or alt graph key. When active the normal patterns will be excluded. These two modifier keys can be handled differently on various hardware. It might be necessary to define ordinary patterns in addition to patterns_x to catch all cases.

patterns_shift: Defined the same way as ordinary patterns, but active while holding down the shift key. When active the normal patterns will still be run, but only after the rules listed in patterns_shift is run.

contextLength: Length of the context to remember. jquery.ime can replace the text based on the previously typed characters.

eg:

	[ 'ൿh', 'c', 'ച്' ]

Note that this pattern definition has 3 members, the middle one is the context. This rule is interpreted as as an override to pattern definitions with 2 members.

The current key is h, previous key is c. For the previous key press c, we have a transliteration ൿ. But if it is followed by h and ൿ is indeed from key press c, replace ൿh with ച്

To make this work, we need to remember the previous key strokes. How many of them we need to remember? contextLength should have that value.

This is optional field with default value 0. ie, we don't remember previous key strokes by default.

maxKeyLength: While trying to find possible matches, we need to know how many characters from the current typing location(cursor) should be used before giving up.

maxKeyLength defines it. Normally it is the length of largest regex sequence in the patterns.

This field is optional and default value is 1.

Examples

For complete examples, please refer the existing input method definitions.

Documentation of input methods are available at mw:Help:Extension:UniversalLanguageSelector/Input methods