Skip to content

Commit

Permalink
Small improvements in my-xkb layout (#652)
Browse files Browse the repository at this point in the history
1. Add comments with explicit characters
   for easier understanding of the rules code.
2. Remove the whole patterns_x section, which is
   just outputting the same characters that would
   be shown if the input method is disabled.
3. Remove some rules that output the same characters.
4. Add some tests, and add test names.

I verified these with the xkb keyboard on Ubuntu.

Co-authored-by: Santhosh Thottingal <[email protected]>
  • Loading branch information
amire80 and santhoshtr authored Nov 12, 2021
1 parent 175481f commit 52c07d7
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 188 deletions.
270 changes: 83 additions & 187 deletions rules/my/my-xkb.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,200 +9,96 @@
URL: 'http://github.com/wikimedia/jquery.ime',
author: 'Parag Nemade',
license: 'GPLv3',
version: '1.0',
version: '1.01',
patterns: [
[ '`', '\u1050' ],
[ '\\~', '\u100e' ],
[ '1', '\u1041' ],
[ '\\!', '\u100D' ],
[ '2', '\u1042' ],
[ '\\@', '\u1052' ],
[ '3', '\u1043' ],
[ '\\#', '\u100B' ],
[ '4', '\u1044' ],
[ '\\$', '\u1053' ],
[ '5', '\u1045' ],
[ '\\%', '\u1054' ],
[ '6', '\u1046' ],
[ '\\^', '\u1055' ],
[ '7', '\u1047' ],
[ '\\&', '\u101B' ],
[ '8', '\u1048' ],
[ '\\*', '\u002A' ],
[ '9', '\u1049' ],
[ '\\(', '(' ],
[ '0', '\u1040' ],
[ '\\)', ')' ],
[ '`', '\u1050' ], // ၐ SHA
[ '\\~', '\u100e' ], // ဎ DDHA
[ '1', '\u1041' ], // ၁ DIGIT ONE
[ '\\!', '\u100D' ], // ဍ DDA
[ '2', '\u1042' ], // ၂ DIGIT TWO
[ '\\@', '\u1052' ], // VOCALIC R
[ '3', '\u1043' ], // ၃ DIGIT THREE
[ '\\#', '\u100B' ], // TTA
[ '4', '\u1044' ], // ၄ DIGIT FOUR
[ '\\$', '\u1053' ], // VOCALIC RR
[ '5', '\u1045' ], // ၅ DIGIT FIVE
[ '\\%', '\u1054' ], // VOCALIC L
[ '6', '\u1046' ], // ၆ DIGIT SIX
[ '\\^', '\u1055' ], // ၕ VOL
[ '7', '\u1047' ], // ၇ DIGIT SEVEN
[ '\\&', '\u101B' ], // ရ RA
[ '8', '\u1048' ], // ၇ DIGIT EIGHT
[ '9', '\u1049' ], // ၉ DIGIT NINE
[ '0', '\u1040' ], // ၀ DIGIT ZERO

[ 'q', '\u1006' ],
[ 'Q', '\u1008' ],
[ 'w', '\u1010' ],
[ 'W', '\u101D' ],
[ 'e', '\u1014' ],
[ 'E', '\u1023' ],
[ 'r', '\u1019' ],
[ 'R', '\u104E' ],
[ 't', '\u1021' ],
[ 'T', '\u1024' ],
[ 'y', '\u1015' ],
[ 'Y', '\u104C' ],
[ 'u', '\u1000' ],
[ 'U', '\u1025' ],
[ 'i', '\u1004' ],
[ 'I', '\u104D' ],
[ 'o', '\u101E' ],
[ 'O', '\u103F' ],
[ 'p', '\u1005' ],
[ 'P', '\u100F' ],
[ '\\[', '\u101F' ],
[ '\\{', '\u1027' ],
[ '\\]', '\u1029' ],
[ '\\}', '\u102A' ],
[ 'q', '\u1006' ], // ဆ CHA
[ 'Q', '\u1008' ], // ဈ JHA
[ 'w', '\u1010' ], // တ TA
[ 'W', '\u101D' ], // ဝ WA
[ 'e', '\u1014' ], // န NA
[ 'E', '\u1023' ], // ဣ I
[ 'r', '\u1019' ], // မ MA
[ 'R', '\u104E' ], // ၎ AFOREMENTIONED
[ 't', '\u1021' ], // အ A
[ 'T', '\u1024' ], // ဤ II
[ 'y', '\u1015' ], // ပ PA
[ 'Y', '\u104C' ], // ၌ LOCATIVE
[ 'u', '\u1000' ], // က KA
[ 'U', '\u1025' ], // ဥ U
[ 'i', '\u1004' ], // င NGA
[ 'I', '\u104D' ], // ၍ COMPLETED
[ 'o', '\u101E' ], // သ SA
[ 'O', '\u103F' ], // ဿ GREAT SA
[ 'p', '\u1005' ], // စ CA
[ 'P', '\u100F' ], // ဏ NNA
[ '\\[', '\u101F' ], // ဟ HA
[ '\\{', '\u1027' ], // ဧ E
[ '\\]', '\u1029' ], // ဩ O
[ '\\}', '\u102A' ], // ဪ AU

[ '\\\\', '\u104F' ],
[ '\\|', '\u1051' ],
[ '\\\\', '\u104F' ], // ၏ GENITIVE
[ '\\|', '\u1051' ], // ၑ SSA

[ 'a', '\u1031' ],
[ 'A', '\u1017' ],
[ 's', '\u103B' ],
[ 'S', '\u103E' ],
[ 'd', '\u102D' ],
[ 'D', '\u102E' ],
[ 'f', '\u103A' ],
[ 'F', '\u1039' ],
[ 'g', '\u102B' ],
[ 'G', '\u103D' ],
[ 'h', '\u1037' ],
[ 'H', '\u1036' ],
[ 'j', '\u103C' ],
[ 'J', '\u1032' ],
[ 'k', '\u102F' ],
[ 'K', '\u1012' ],
[ 'l', '\u1030' ],
[ 'L', '\u1013' ],
[ 'a', '\u1031' ], // ေSIGN E
[ 'A', '\u1017' ], // ဗ BA
[ 's', '\u103B' ], // ျ SIGN MEDIAL YA
[ 'S', '\u103E' ], // ှ SIGN MEDIAL HA
[ 'd', '\u102D' ], // ိ SIGN I
[ 'D', '\u102E' ], // ီ SIGN II
[ 'f', '\u103A' ], // ် ASAT
[ 'F', '\u1039' ], // ္ VIRAMA
[ 'g', '\u102B' ], // ါ SIGN TALL A
[ 'G', '\u103D' ], // ွ SIGN MEDIAL WA
[ 'h', '\u1037' ], // ့ SIGN DOT BELOW
[ 'H', '\u1036' ], // ံ ANUSVARA
[ 'j', '\u103C' ], // ြ MEDIAL RA
[ 'J', '\u1032' ], // ဲ SIGN AI
[ 'k', '\u102F' ], // ု SIGN U
[ 'K', '\u1012' ], // ဒ DA
[ 'l', '\u1030' ], // ူ SIGN UU
[ 'L', '\u1013' ], // ဓ DHA

[ ';', '\u1038' ],
[ ':', '\u1002' ],
[ ';', '\u1038' ], // း VISARGA
[ ':', '\u1002' ], // ဂ GA

[ '\'', '\'' ],
[ '"', '"' ],
[ 'z', '\u1016' ], // ဖ PHA
[ 'Z', '\u1007' ], // ဇ JA
[ 'x', '\u1011' ], // ထ THA
[ 'X', '\u100C' ], // ဌ TTHA
[ 'c', '\u1001' ], // ခ KHA
[ 'C', '\u1003' ], // ဃ GHA
[ 'v', '\u101C' ], // လ LA
[ 'V', '\u1020' ], // ဠ LLA
[ 'b', '\u1018' ], // ဘ BHA
[ 'B', '\u101A' ], // ယ YA
[ 'n', '\u100A' ], // ည NNYA
[ 'N', '\u1009' ], // ဉ NYA
[ 'm', '\u102C' ], // ာ SIGN AA
[ 'M', '\u1026' ], // ဦ UU

[ 'z', '\u1016' ],
[ 'Z', '\u1007' ],
[ 'x', '\u1011' ],
[ 'X', '\u100C' ],
[ 'c', '\u1001' ],
[ 'C', '\u1003' ],
[ 'v', '\u101C' ],
[ 'V', '\u1020' ],
[ 'b', '\u1018' ],
[ 'B', '\u101A' ],
[ 'n', '\u100A' ],
[ 'N', '\u1009' ],
[ 'm', '\u102C' ],
[ 'M', '\u1026' ],

[ ',', ',' ],
[ '\\<', '\u104A' ],
[ '\\.', '.' ],
[ '\\>', '\u104B' ],
[ '/', '/' ],
[ '\\?', '?' ]
],
patterns_x: [
[ '`', '`' ],
[ '\\~', '~' ],
[ '1', '1' ],
[ '\\!', '!' ],
[ '2', '2' ],
[ '\\@', '@' ],
[ '3', '3' ],
[ '\\#', '#' ],
[ '4', '4' ],
[ '\\$', '$' ],
[ '5', '5' ],
[ '\\%', '%' ],
[ '6', '6' ],
[ '\\^', '^' ],
[ '7', '7' ],
[ '\\&', '&' ],
[ '8', '8' ],
[ '\\*', '*' ],
[ '9', '9' ],
[ '\\(', '(' ],
[ '0', '0' ],
[ '\\)', ')' ],
[ '\\-', '-' ],
[ '\\_', '_' ],
[ '\\=', '=' ],
[ '\\+', '+' ],

[ 'q', 'q' ],
[ 'Q', 'Q' ],
[ 'w', 'w' ],
[ 'W', 'W' ],
[ 'e', 'e' ],
[ 'E', 'E' ],
[ 'r', 'r' ],
[ 'R', 'R' ],
[ 't', 't' ],
[ 'T', 'T' ],
[ 'y', 'y' ],
[ 'Y', 'Y' ],
[ 'u', 'u' ],
[ 'U', 'U' ],
[ 'i', 'i' ],
[ 'I', 'I' ],
[ 'o', 'o' ],
[ 'O', 'O' ],
[ 'p', 'p' ],
[ 'P', 'P' ],
[ 'a', 'a' ],
[ 'S', 'S' ],
[ 's', 's' ],
[ 'S', 'S' ],
[ 'd', 'd' ],
[ 'D', 'D' ],
[ 'f', 'f' ],
[ 'F', 'F' ],
[ 'g', 'g' ],
[ 'G', 'G' ],
[ 'h', 'h' ],
[ 'H', 'H' ],
[ 'j', 'j' ],
[ 'J', 'J' ],
[ 'k', 'k' ],
[ 'K', 'K' ],
[ 'l', 'l' ],
[ 'L', 'L' ],
[ 'z', 'z' ],
[ 'Z', 'Z' ],
[ 'x', 'x' ],
[ 'X', 'X' ],
[ 'c', 'c' ],
[ 'C', 'C' ],
[ 'v', 'v' ],
[ 'V', 'V' ],
[ 'b', 'b' ],
[ 'B', 'B' ],
[ 'n', 'n' ],
[ 'N', 'N' ],
[ 'm', 'm' ],
[ 'M', 'M' ],
[ ',', ',' ],
[ '\\<', '<' ],
[ '\\.', '.' ],
[ '\\>', '>' ],
[ ';', ';' ],
[ ':', ':' ],
[ '\'', '\'' ],
[ '"', '"' ],
[ '\\[', '[' ],
[ '\\{', '{' ],
[ '\\]', ']' ],
[ '\\}', '}' ],
[ '\\\\', '\\' ],
[ '\\|', '|' ] ]
[ '\\<', '\u104A' ], // ၊ SIGN LITTLE SECTION
[ '\\>', '\u104B' ], // ။ SIGN SECTION
]
};

$.ime.register( myXkb );
Expand Down
3 changes: 2 additions & 1 deletion test/jquery.ime.test.fixtures.js
Original file line number Diff line number Diff line change
Expand Up @@ -4210,6 +4210,7 @@ var palochkaVariants = {
tests: [
{ input: 'QWERTYUIOP', output: 'ဈဝဣ၎ဤ၌ဥ၍ဿဏ', description: 'Myanmar xkb QWERTYUIOP' },
{ input: 'qawsedrftgyhujikolp;', output: 'ဆေတျနိမ်အါပ့ကြငုသူစး', description: 'Myanmar xkb qawsedrftgyhujikolp;' },
{ input: '[]{}', output: 'ဟဩဧဪ', description: 'Myanmar xkb []{}' },
{ input: 'ASD', output: 'ဗှီ', description: 'Myanmar xkb ASD' },
{ input: 'WF', output: 'ဝ္', description: 'Myanmar xkb WF' },
{ input: 'tG', output: 'အွ', description: 'Myanmar xkb tG' },
Expand All @@ -4218,7 +4219,7 @@ var palochkaVariants = {
{ input: 'KL', output: 'ဒဓ', description: 'Myanmar xkb KL' },
{ input: ':"\'', output: 'ဂ"\'', description: 'Myanmar xkb :"\'' },
{ input: 'zxcvbnm,./', output: 'ဖထခလဘညာ,./', description: 'Myanmar xkb zxcvbnm,./' },
{ input: 'ZXCVBNM<>?', output: 'ဇဌဃဠယဉဦ၊။?', description: 'Myanmar xkb ' },
{ input: 'ZXCVBNM<>?', output: 'ဇဌဃဠယဉဦ၊။?', description: 'Myanmar xkb ZXCVBNM<>?' },
{ input: '`~', output: 'ၐဎ', description: 'Myanmar xkb ၐဎ' },
{ input: '1234567890', output: '၁၂၃၄၅၆၇၈၉၀', description: 'Myanmar xkb 1234567890' },
{ input: '!@#$%^&*()', output: 'ဍၒဋၓၔၕရ*()', description: 'Myanmar xkb !@#$%^&*()' }
Expand Down

0 comments on commit 52c07d7

Please sign in to comment.