Skip to content

Commit

Permalink
Jawi keyboard (#757)
Browse files Browse the repository at this point in the history
* Jawi keyboard

* jquery.ime.test.fixtures.js: Fix syntax error

* misc

-fix escape char
-test more complex combinations

* Update jquery.ime.test.fixtures.js

* Update id-jawi.js

change contextlength and maxkeylength to 1

---------

Co-authored-by: Abijeet Patro <abijeetpatro@gmail.com>
Co-authored-by: SrishAkaTux <ssethi@wikimedia.org>
  • Loading branch information
3 people committed Sep 9, 2024
1 parent 76a0db2 commit 5c4cf36
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 0 deletions.
50 changes: 50 additions & 0 deletions rules/id/id-jawi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
( function ( $ ) {
'use strict';
var jawiKeyboard = {
id: 'id-jawi',
name: 'Jawi keyboard',
description: 'Jawi keyboard for Indonesian Wikisource',
date: '2023-09-21',
URL: 'https://www.mediawiki.org/wiki/Help:Extension:UniversalLanguageSelector/Input_methods/jawi-keyboard',
author: 'Benny Lin, Pungkas, Michael',
license: 'GPLv3',
version: '1.0',
contextLength: 1,
maxKeyLength: 1,
patterns: [
[ '\\\\([A-Za-z\\>_~\\.0-9])', '', '$1' ], //escape characters
[ '(a|A)', '', 'ا' ], //alif
[ '(b|B)', '', 'ب' ], //ba
[ '(c|C)', '', 'ﭺ' ], //ca
[ '(d|D)', '', 'د' ], //dal
[ '(e|E)', '', 'َ' ], //fathah -a
[ '(f|F)', '', 'ف' ], //fa
[ '(g|G)', '', 'ݢ' ], //gaf
[ '(h|H)', '', 'ه' ], //ha
[ '(ݢ|ڬ)(h|H)', '(g|G)', 'غ' ], //ghain
[ 'ت(h|H)', '(t|T)', 'ة' ], //tāʔ marbūṭa
[ 'ى(h|H)', '(k|K)', 'خ' ], //ẖ, kha
[ '(i|I)', '', 'ِ' ], //kasrah/kasroh -i
[ '(j|J)', '', 'ج' ], //jim
[ '(k|K)', '', 'ى' ], //kaf
[ '(l|L)', '', 'ل' ], //lam
[ '(m|M)', '', 'م' ], //mim
[ '(n|N)', '', 'ن' ], //nun
[ '(o|O)', '', 'ْ' ], //sukun
[ '(p|P)', '', 'ڤ' ], //pa
[ '(q|Q)', '', 'ق' ], //qaf
[ '(r|R)', '', 'ر' ], //ra
[ '(s|S)', '', 'س' ], //sin
[ '(t|T)', '', 'ت' ], //ta
[ '(u|U)', '', 'ُ' ], //dhammah/dhomah -u
[ '(v|V)', '', 'ؤ' ], //va
[ '(w|W)', '', 'و' ], //wau
[ '(x|X)', '', 'ء' ], // ʾʔhamza
[ '(y|Y)', '', 'ي' ], //ya
[ '(z|Z)', '', 'ز' ], //zai
[ '`', '', 'ع' ] // 'ain
]
};

$.ime.register( jawiKeyboard );
}( jQuery ) );
8 changes: 8 additions & 0 deletions src/jquery.ime.inputmethods.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,10 @@
name: 'Ibibio - tilde',
source: 'rules/ibb/ibb-tilde.js'
},
'id-jawi': {
name: 'Jawi Keyboard',
source: 'rules/id/id-jawi.js'
},
'ig-tilde': {
name: 'Igbo - tilde',
source: 'rules/ig/ig-tilde.js'
Expand Down Expand Up @@ -1262,6 +1266,10 @@
autonym: 'ibibio',
inputmethods: [ 'ibb-tilde' ]
},
id: {
autonym: 'Jawi',
inputmethods: [ 'id-jawi' ]
},
ig: {
autonym: 'Igbo',
inputmethods: [ 'ig-tilde' ]
Expand Down
33 changes: 33 additions & 0 deletions test/jquery.ime.test.fixtures.js
Original file line number Diff line number Diff line change
Expand Up @@ -2279,6 +2279,39 @@ var palochkaVariants = {
{ input: 'a~/e~\\i~^o~-u~v', output: 'áèîōǔ', description: 'Ibibio tilde áèîōǔ' }
]
},
{
description: 'Jawi test',
inputmethod: 'id-jawi',
tests: [
{ input: 'jwi', output: 'جوِ', description: 'jawi' },
{ input: 'a', output: 'ا', description: 'Jawi alif' },
{ input: 'b', output: 'ب', description: 'Jawi ba' },
{ input: 'c', output: 'ﭺ', description: 'Jawi ca' },
{ input: 'd', output: 'د', description: 'Jawi dal' },
{ input: 'e', output: 'َ', description: 'Jawi fathah -a' },
{ input: 'f', output: 'ف', description: 'Jawi fa' },
{ input: 'g', output: 'ݢ', description: 'Jawi gaf' },
{ input: 'h', output: 'ه', description: 'Jawi ha' },
{ input: 'i', output: 'ِ', description: 'Jawi kasrah -i' },
{ input: 'j', output: 'ج', description: 'Jawi jim' },
{ input: 'k', output: 'ى', description: 'Jawi kaf' },
{ input: 'l', output: 'ل', description: 'Jawi lam' },
{ input: 'm', output: 'م', description: 'Jawi mim' },
{ input: 'n', output: 'ن', description: 'Jawi nun' },
{ input: 'o', output: 'ْ', description: 'Jawi sukun' },
{ input: 'p', output: 'ڤ', description: 'Jawi pa' },
{ input: 'q', output: 'ق', description: 'Jawi qaf' },
{ input: 'r', output: 'ر', description: 'Jawi ra' },
{ input: 's', output: 'س', description: 'Jawi sin' },
{ input: 't', output: 'ت', description: 'Jawi ta' },
{ input: 'u', output: 'ُ', description: 'Jawi dhammah -u' },
{ input: 'v', output: 'ؤ', description: 'Jawi va' },
{ input: 'w', output: 'و', description: 'Jawi wau' },
{ input: 'x', output: 'ء', description: 'Jawi hamza' },
{ input: 'y', output: 'ي', description: 'Jawi ya' },
{ input: 'z', output: 'ز', description: 'Jawi zai' }
]
},
{
description: 'Igbo tilde test',
inputmethod: 'ig-tilde',
Expand Down

0 comments on commit 5c4cf36

Please sign in to comment.