From ab8193faac52701d6499930c6c9de83f25d2b9df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20Laxstr=C3=B6m?= Date: Tue, 16 Aug 2016 10:29:19 +0200 Subject: [PATCH] Update jquery.ime to 10ae4c0 * New Khmer imes * Updates to Urdu ime (T138399) Bug: T138399 Change-Id: I2ead15d6678787f705103329c59e679240580f87 --- lib/jquery.ime/jquery.ime.js | 10 +- lib/jquery.ime/rules/km/km-nidakyk.js | 262 +++++++++++++++++++++++++ lib/jquery.ime/rules/ur/ur-phonetic.js | 10 - 3 files changed, 271 insertions(+), 11 deletions(-) create mode 100644 lib/jquery.ime/rules/km/km-nidakyk.js diff --git a/lib/jquery.ime/jquery.ime.js b/lib/jquery.ime/jquery.ime.js index cacbaf74..81c23185 100644 --- a/lib/jquery.ime/jquery.ime.js +++ b/lib/jquery.ime/jquery.ime.js @@ -1,4 +1,4 @@ -/*! jquery.ime - v0.1.0+20160712 +/*! jquery.ime - v0.1.0+20160816 * https://github.com/wikimedia/jquery.ime * Copyright (c) 2016 Santhosh Thottingal; Licensed GPL, MIT */ ( function ( $ ) { @@ -2020,6 +2020,10 @@ name: 'Кирил', source: 'rules/kk/kk-kbd.js' }, + 'km-nidakyk': { + name: 'ក្តារ​ចុច​យូនីកូដ​ខ្មែរ (NiDA)', + source: 'rules/km/km-nidakyk.js' + }, 'kn-inscript': { name: 'ಇನ್ಸ್ಕ್ರಿಪ್ಟ್', source: 'rules/kn/kn-inscript.js' @@ -2494,6 +2498,10 @@ autonym: 'Қазақша', inputmethods: [ 'kk-kbd', 'kk-arabic' ] }, + km: { + autonym: 'ភាសា​ខ្មែរ', + inputmethods: [ 'km-nidakyk' ] + }, kn: { autonym: 'ಕನ್ನಡ', inputmethods: [ 'kn-transliteration', 'kn-inscript', 'kn-kgp', 'kn-inscript2' ] diff --git a/lib/jquery.ime/rules/km/km-nidakyk.js b/lib/jquery.ime/rules/km/km-nidakyk.js new file mode 100644 index 00000000..6042c273 --- /dev/null +++ b/lib/jquery.ime/rules/km/km-nidakyk.js @@ -0,0 +1,262 @@ +( function ( $ ) { + 'use strict'; + + // This is an implementation of NiDA standard Khmer Unicode keyboard v1.0, + // with some key combinations to normalize or correct combining sequences + var kmNIDA = { + id: 'km-nidakyk', + name: 'ក្តារ​ចុច​យូនីកូដ​ខ្មែរ (NiDA)', + description: 'NiDA Standard Khmer Unicode Keyboard', + date: '2016-07-07', + URL: 'http://www.nida.gov.kh/files/documents/How_to_type_Khmer_Unicode_ver1_1km.pdf', + author: 'Ang Iongchun', + license: 'Public domain', + version: '1.0', + + // previous input keys to memory, for contextual rules + contextLength: 1, // default: 0 + + // previous output to memory, for normalization of consonant + // shifters + // maxKeyLength: 7, // default: 1 + + // Shift-Space has the same scan code with Space, + // hence the rule here + patterns_shift: [ + [ ' ', ' ' ] // normal space + ], + + patterns: [ + // NOTE: Contextual rules must appear before rules + // without context to avoid collisions. + // Make sure contextLength is large enough for + // these rules. + + // correction for two-part dependent vowels + [ '\u17c1a', 'e', '\u17c4' ], // ​េ + ​ា -> ​ោ (o) + [ '\u17b6e', 'a', '\u17c4' ], // ​ា + ​េ -> ​ោ (o) + [ '\u17c1I', 'e', '\u17be' ], // ​េ + ​ី -> ​ើ (;) + [ '\u17b8e', 'I', '\u17be' ], // ​ី + ​េ -> ​ើ (;) + + // normalize common combination of dependent vowels and + // modifiers + [ '\u17c6a', 'M', '\u17b6\u17c6' ], // ​ាំ, Ma -> aM + [ '\u17c6u', 'M', '\u17bb\u17c6' ], // ​ុំ, Mu -> uM + [ '\u17c7e', 'H', '\u17c1\u17c7' ], // ​េះ, He -> eH + [ '\u17c7u', 'H', '\u17bb\u17c7' ], // ​ុះ, Hu -> uH + [ '\u17c7o', 'H', '\u17c4\u17c7' ], // ​ោះ, Ho -> oH + + // Unicode 4.0: normalize consonant shifter before + // subscript consonants and their optional following + // robats: (SR?)+Z?C -> Z?C(SR?)+ + /* XXX: Not compatible with Unicode 3.0, which places + consonant shifters after subscript consonants. + Make sure maxKeyLength is large enough for this rule. + [ '((?:\u17d2.\u17cc?)+)((:?\u200c|\u200d)?)/', '$2\u17ca$1' ], // ៊ + [ '((?:\u17d2.\u17cc?)+)((:?\u200c|\u200d)?)\"', '$2\u17c9$1' ], // ​៉ + */ + + // consonants + [ 'q', 'ឆ' ], + [ 'r', 'រ' ], + [ 't', 'ត' ], + [ 'y', 'យ' ], + [ 'p', 'ផ' ], + [ 's', 'ស' ], + [ 'd', 'ដ' ], + [ 'f', 'ថ' ], + [ 'g', 'ង' ], + [ 'h', 'ហ' ], + [ 'j', '\u17d2' ], // coeng + [ 'k', 'ក' ], + [ 'l', 'ល' ], + [ 'z', 'ឋ' ], + [ 'x', 'ខ' ], + [ 'c', 'ច' ], + [ 'v', 'វ' ], + [ 'b', 'ប' ], + [ 'n', 'ន' ], + [ 'm', 'ម' ], + [ 'Q', 'ឈ' ], + [ 'T', 'ទ' ], + [ 'P', 'ភ' ], + [ 'D', 'ឌ' ], + [ 'F', 'ធ' ], + [ 'G', 'អ' ], + [ 'J', 'ញ' ], + [ 'K', 'គ' ], + [ 'L', 'ឡ' ], + [ 'Z', 'ឍ' ], + [ 'X', 'ឃ' ], + [ 'C', 'ជ' ], + [ 'B', 'ព' ], + [ 'N', 'ណ' ], + + // independent vowels + [ '-', 'ឥ' ], + [ '=', 'ឲ' ], + [ '\\]', 'ឪ' ], + [ '\\\\', 'ឮ' ], + [ 'R', 'ឬ' ], + [ '\\}', 'ឧ' ], + [ '\\|', 'ឭ' ], + + // dependent vowels and modifiers + [ 'w', '\u17b9' ], // ​ឹ + [ 'e', '\u17c1' ], // ​េ + [ 'u', '\u17bb' ], // ​ុ + [ 'i', '\u17b7' ], // ​ិ + [ 'o', '\u17c4' ], // ​ោ + [ 'a', '\u17b6' ], // ​ា + [ 'W', '\u17ba' ], // ​ឺ + [ 'E', '\u17c2' ], // ​ែ + [ 'Y', '\u17bd' ], // ​ួ + [ 'U', '\u17bc' ], // ​ូ + [ 'I', '\u17b8' ], // ​ី + [ 'O', '\u17c5' ], // ​ៅ + [ 'A', '\u17b6\u17c6' ], // ​ាំ + [ 'S', '\u17c3' ], // ​ៃ + [ 'H', '\u17c7' ], // ​ះ + [ 'V', '\u17c1\u17c7' ], // ​េះ + [ 'M', '\u17c6' ], // ​ំ + [ '\\[', '\u17c0' ], // ​ៀ + [ ';', '\u17be' ], // ​ើ + [ '\'', '\u17cb' ], // ​់ + [ ',', '\u17bb\u17c6' ], // ​ុា + [ '/', '\u17ca' ], // ​៊ + [ ':', '\u17c4\u17c7' ], // ​ោះ + [ '\"', '\u17c9' ], // ​៉ + [ '<', '\u17bb\u17c7' ], // ​ុះ + [ '\\^', '\u17cd' ], // ​៍ + [ '&', '\u17d0' ], // ​័ + [ '\\*', '\u17cf' ], // ​៏ + [ '_', '\u17cc' ], // ​៌ + [ '\\{', '\u17bf' ], // ​ឿ + + // digits + [ '1', '១' ], + [ '2', '២' ], + [ '3', '៣' ], + [ '4', '៤' ], + [ '5', '៥' ], + [ '6', '៦' ], + [ '7', '៧' ], + [ '8', '៨' ], + [ '9', '៩' ], + [ '0', '០' ], + + // spaces + [ ' ', '\u200b' ], // ZWSP: zero-width space + + // symbols + [ '`', '«' ], + [ '\\.', '។' ], + [ '>', '៕' ], + [ '~', '»' ], + [ '\\!', '!' ], + [ '@', 'ៗ' ], + [ '#', '\"' ], + [ '\\$', '៛' ], + [ '%', '%' ], + [ '\\(', '(' ], + [ '\\)', ')' ], + [ '\\+', '=' ], + [ '\\?', '?' ] + ], + + // AltGr patterns + patterns_x: [ + // independent vowels + [ 'e', 'ឯ' ], + [ 'r', 'ឫ' ], + [ 'i', 'ឦ' ], + [ 'o', 'ឱ' ], + [ 'p', 'ឰ' ], + [ '\\[', 'ឩ' ], + [ '\\]', 'ឳ' ], + + // modifiers + [ '3', '\u17d1' ], // ​៑ + [ '=', '\u17ce' ], // ​៎ + [ '\'', '\u17c8' ], // ​ៈ + + // symbols + [ '2', '@' ], + [ '4', '$' ], + [ '5', '€' ], + [ '6', '៙' ], + [ '7', '៚' ], + [ '8', '*' ], + [ '9', '{' ], + [ '0', '}' ], + [ '-', 'x' ], + [ '\\\\', '\\' ], + [ ';', '៖' ], + [ ',', ',' ], + [ '\\.', '.' ], + [ '/', '/' ], + + // spaces + [ ' ', '\u00a0' ], // NBSP: non-breakable space + + // joiners + [ '`', '\u200d' ], // ZWJ: zero width joiner + [ '1', '\u200c' ], // ZWNJ: zero width non-joiner + + // old Khmer, Sanskrit, Pali + [ 'b', 'ឞ' ], + [ 'k', 'ឝ' ], + [ 't', 'ឨ' ], + [ 'q', 'ៜ' ], + [ 'w', '\u17dd' ], // ​៝ + + // divination signs (digits) + [ '\\!', '៱' ], // shift-1 + [ '@', '៲' ], // shift-2 + [ '#', '៳' ], // shift-3 + [ '\\$', '៴' ], // shift-4 + [ '%', '៵' ], // shift-5 + [ '\\^', '៶' ], // shift-6 + [ '&', '៷' ], // shift-7 + [ '\\*', '៸' ], // shift-8 + [ '\\(', '៹' ], // shift-9 + [ '\\)', '៰' ], // shift-0 + + // lunar dates + [ 'Q', '᧠' ], // shift-q + [ 'W', '᧡' ], // shift-w + [ 'E', '᧢' ], // shift-e + [ 'R', '᧣' ], // shift-r + [ 'T', '᧤' ], // shift-t + [ 'Y', '᧥' ], // shift-y + [ 'U', '᧦' ], // shift-u + [ 'I', '᧧' ], // shift-i + [ 'O', '᧨' ], // shift-o + [ 'P', '᧩' ], // shift-p + [ '\\{', '᧪' ], // shift-[ + [ '\\}', '᧫' ], // shift-] + [ 'A', '᧬' ], // shift-a + [ 'S', '᧭' ], // shift-s + [ 'D', '᧮' ], // shift-d + [ 'F', '᧯' ], // shift-f + [ 'G', '᧰' ], // shift-g + [ 'H', '᧱' ], // shift-h + [ 'J', '᧲' ], // shift-j + [ 'K', '᧳' ], // shift-k + [ 'L', '᧴' ], // shift-l + [ ':', '᧵' ], // shift-; + [ '\"', '᧶' ], // shift-' + [ 'Z', '᧷' ], // shift-z + [ 'X', '᧸' ], // shift-x + [ 'C', '᧹' ], // shift-c + [ 'V', '᧺' ], // shift-v + [ 'B', '᧻' ], // shift-b + [ 'N', '᧼' ], // shift-n + [ 'M', '᧽' ], // shift-m + [ '<', '᧾' ], // shift-, + [ '>', '᧿' ] // shift-. + ] + }; + + $.ime.register( kmNIDA ); +}( jQuery ) ); diff --git a/lib/jquery.ime/rules/ur/ur-phonetic.js b/lib/jquery.ime/rules/ur/ur-phonetic.js index 0635f411..65de2b0c 100644 --- a/lib/jquery.ime/rules/ur/ur-phonetic.js +++ b/lib/jquery.ime/rules/ur/ur-phonetic.js @@ -12,20 +12,10 @@ version: '1.0', patterns: [ [ '!', '!' ], - [ '1', '۱' ], - [ '2', '۲' ], [ '\\#', '/' ], - [ '3', '۳' ], /* Yeh with hamza above */ [ '\\$', 'ئ' ], - [ '4', '۴' ], - [ '5', '۵' ], - [ '6', '۶' ], - [ '7', '۷' ], - [ '8', '۸' ], [ '\\(', ')' ], - [ '9', '۹' ], [ '\\)', '(' ], - [ '0', '۰' ], [ '\\_" "ّ' ], /* Alef with hamza above */ [ '\\-', 'أ' ], /* Alef with madda above */ [ '\\+', 'آ' ],