r92876 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92875‎ | r92876 | r92877 >
Date:18:57, 22 July 2011
Author:junaidpv
Status:ok
Tags:
Comment:
Add Nepali transliteration and InScript schemes
Modified paths:
  • /trunk/extensions/Narayam/Narayam.i18n.php (modified) (history)
  • /trunk/extensions/Narayam/Narayam.php (modified) (history)
  • /trunk/extensions/Narayam/ext.narayam.rules.ne-inscript.js (added) (history)
  • /trunk/extensions/Narayam/ext.narayam.rules.ne.js (added) (history)

Diff [purge]

Index: trunk/extensions/Narayam/ext.narayam.rules.ne-inscript.js
@@ -0,0 +1,118 @@
 2+/**
 3+ * InScript regular expression rules table for Nepali script
 4+ * According to CDAC's "Enhanced InScript Keyboard Layout 5.2"
 5+ * @author Bhawani Gautam ([[user:Bhawani Gautam]])
 6+ * License: GPLv3, CC-BY-SA 3.0
 7+ */
 8+
 9+// normal rules
 10+var rules = [
 11+['X', '', 'ँ'],
 12+['x', '', 'ं'],
 13+['_', '', 'ः'],
 14+['D', '', 'अ'],
 15+['E', '', 'आ'],
 16+['F', '', 'इ'],
 17+['R', '', 'ई'],
 18+['G', '', 'उ'],
 19+['T', '', 'ऊ'],
 20+['\\+', '', 'ृ'],
 21+['S', '', 'ए'],
 22+['W', '', 'ऐ'],
 23+['A', '', 'ओ'],
 24+['Q', '', 'औ'],
 25+['k', '', 'क'],
 26+['K', '', 'ख'],
 27+['i', '', 'ग'],
 28+['I', '', 'घ'],
 29+['U', '', 'ङ'],
 30+['\\;', '', 'च'],
 31+['\\:', '', 'छ'],
 32+['p', '', 'ज'],
 33+['P', '', 'झ'],
 34+['\\}', '', 'ञ'],
 35+["'", '', 'ट'],
 36+['"', '', 'ठ'],
 37+['\\[', '','ड'],
 38+['\\{', '','ढ'],
 39+['C', '', 'ण'],
 40+['l', '', 'त'],
 41+['L', '', 'थ'],
 42+['o', '', 'द'],
 43+['O', '', 'ध'],
 44+['v', '', 'न'],
 45+['h', '', 'प'],
 46+['H', '', 'फ'],
 47+['y', '', 'ब'],
 48+['Y', '', 'भ'],
 49+['c', '', 'म'],
 50+['\\?', '','य'],
 51+['j', '', 'र'],
 52+['J', '', 'द्य'],
 53+['n', '', 'ल'],
 54+['N', '', 'ळ'],
 55+['b', '', 'व'],
 56+['M', '', 'श'],
 57+['\\<', '','ष'],
 58+['m', '', 'स'],
 59+['u', '', 'ह'],
 60+['\\]', '','़'],
 61+['e', '', 'ा'],
 62+['f', '', 'ि'],
 63+['r', '', 'ी'],
 64+['g', '', 'ु'],
 65+['t', '', 'ू'],
 66+['\\=', '','ृ'],
 67+['\\\\', '', 'ॄ'],
 68+['s', '', 'े'],
 69+['w', '', 'ै'],
 70+['a', '', 'ो'],
 71+['q', '', 'ौ'],
 72+['d', '', '्'],
 73+['\\|', '', 'ॠ'],
 74+['/', '', 'य'],
 75+['\\>', '', '।'],
 76+['0', '','०'],
 77+['1', '','१'],
 78+['2', '', '२'],
 79+['3', '', '३'],
 80+['4', '', '४'],
 81+['5', '', '५'],
 82+['6', '', '६'],
 83+['7', '', '७'],
 84+['8', '', '८'],
 85+['9', '', '९'],
 86+['\\@', '', 'ॅ'],
 87+['\\#', '','्र'],
 88+['\\$', '','र्'],
 89+['\\%', '','ज्ञ'],
 90+['\\^', '','त्र'],
 91+['\\&', '', 'क्ष'],
 92+['\\*', '', 'श्र'],
 93+['\\(', '', '\u200D'],
 94+['\\)', '', '\u200C']
 95+];
 96+
 97+// Extended layout for InScript. Works in Firefox only
 98+var rules_x = [
 99+['F', '', 'ऌ'],
 100+['\\>', '','ऽ'],
 101+['X', '', 'ॐ'],
 102+['e', '', '\0951'],
 103+['d', '', '\u0952'],
 104+['R', '', 'ॡ'],
 105+['f', '', 'ॢ'],
 106+['r', '', 'ॣ'],
 107+['\\.', '', '॥'],
 108+['\\@', '','ॅ'],
 109+['4', '', '₹']
 110+];
 111+
 112+jQuery.narayam.addScheme( 'ne-inscript', {
 113+ 'namemsg': 'narayam-ne-inscript',
 114+ 'extended_keyboard': true,
 115+ 'lookbackLength': 0,
 116+ 'keyBufferLength': 0,
 117+ 'rules': rules,
 118+ 'rules_x': rules_x
 119+} );
\ No newline at end of file
Index: trunk/extensions/Narayam/ext.narayam.rules.ne.js
@@ -0,0 +1,164 @@
 2+/**
 3+ * Trasliteration regular expression rules table for Nepali
 4+ * @author Junaid P V ([[user:Junaidpv]]) and Bhawani Gautam ([[user:Bhawani Gautam]])
 5+ * @date 2011-07-22
 6+ * License: GPLv3, CC-BY-SA 3.0
 7+ */
 8+
 9+ // Normal rules
 10+var rules = [
 11+['क्h','c','च्'],
 12+['\\\\([A-Za-z\\>_~\\.0-9])','\\\\','$1'],
 13+
 14+['([क-ह]़?)्a', '','$1'],
 15+['([क-ह]़?)्A', '','$1ा'],
 16+['([क-ह]़?)a', '','$1ा'],
 17+['([क-ह]़?)्i', '','$1ि'],
 18+['([क-ह]़?)(्I|िi|ेe)', '','$1ी'],
 19+['([क-ह]़?)्u', '','$1ु'],
 20+['([क-ह]़?)(ुu|्U|ोo)', '','$1ू'],
 21+['([क-ह]़?)्R', '','$1ृ'],
 22+['([क-ह]़?)ृR', '','$1ॄ'],
 23+['([क-ह]़?)्ळ्l', '','$1ॢ'],
 24+['([क-ह]़?)ॢl', '','$1ॣ'],
 25+['([क-ह]़?)ॆ\\^', '','$1ॅ'],
 26+['([क-ह]़?)्e', '','$1े'],
 27+['([क-ह]़?)्E', '','$1े'],
 28+['([क-ह]़?)ॊ\\^', '','$1ॉ'],
 29+['([क-ह]़?)i', '','$1ै'],
 30+['([क-ह]़?)्o', '','$1ो'],
 31+['([क-ह]़?)्O', '','$1ो'],
 32+['([क-ह]़?)u', '','$1ौ'],
 33+['([क-ह]़?)ृa', '','$1्ऱ'],
 34+['([क-ह]़?)ृA', '','$1्ऱा'],
 35+['([क-ह]़?)ृi', '','$1्ऱि'],
 36+['([क-ह]़?)ृI', '','$1्ऱी'],
 37+['([क-ह]़?)ृu', '','$1्ऱु'],
 38+['([क-ह]़?)ृU', '','$1्ऱू'],
 39+['([क-ह]़?)ृ\\^', '','$1्ऱॅ'],
 40+['([क-ह]़?)ृe', '','$1्ऱे'],
 41+['([क-ह]़?)ृE', '','$1्ऱे'],
 42+['([क-ह]़?)ृo', '','$1्ऱो'],
 43+['([क-ह]़?)ृO', '','$1्ऱो'],
 44+['([क-ह]़?)ृ\\~', '','$1्ऱ्'],
 45+['([क-ह])्\\`', '','$1़्'],
 46+
 47+['अa', '','आ'],
 48+['(ओo|उu)', '','ऊ'],
 49+['ऎ\\^', '','ऍ'],
 50+['अi', '','ऐ'],
 51+['अ\\^', '','ॲ'],
 52+['(इi|एe)', '','ई'],
 53+['ऒ\\^', '','ऑ'],
 54+['अu', '','औ'],
 55+['र्rय्', '','र्‍य्'],
 56+['ड़्h', '','ढ़्'],
 57+['ऋR', '','ॠ'],
 58+['ळ्l', '','ऌ'],
 59+['ऌl', '','ॡ'],
 60+['ं\\^', '','ँ'],
 61+['ंM', '','ँ'],
 62+['ओM', '','ॐ'],
 63+['ड्D', '','ड़्'],
 64+['क्h', '','ख्'],
 65+['ग्h', '','घ्'],
 66+['G', '','ङ्'],
 67+['च्h', '','छ्'],
 68+['ज्h', '','झ्'],
 69+['न्j', '','ञ्'],
 70+['ट्h', '','ठ्'],
 71+['ड्h', '','ढ्'],
 72+['त्h', '','थ्'],
 73+['द्h', '','ध्'],
 74+['प्h', '','फ्'],
 75+['ब्h', '','भ्'],
 76+['ऋa', '','ऱ'],
 77+['ऋA', '','ऱा'],
 78+['ऋi', '','ऱि'],
 79+['ऋI', '','ऱी'],
 80+['ऋu', '','ऱु'],
 81+['ऋU', '','ऱू'],
 82+['ऋ\\^', '','ऱॅ'],
 83+['ऋe', '','ऱे'],
 84+['ऋE', '','ऱे'],
 85+['ऋo', '','ऱो'],
 86+['ऋO', '','ऱो'],
 87+['ऋ\\~', '','ऱ्'],
 88+
 89+['स्h', '','श्'],
 90+['श्h', '','ष्'],
 91+['क़्h', '','ख़्'],
 92+['ज़्h', '','ऴ्'],
 93+['।\\.', '','॥'],
 94+
 95+['a', '','अ'],
 96+['b', '','ब्'],
 97+['c', '','क्'],
 98+['d', '','द्'],
 99+['e', '','ए'],
 100+['(f|F)', '','फ़्'],
 101+['g', '','ग्'],
 102+['h', '','ह्'],
 103+['i', '','इ'],
 104+['j', '','ज्'],
 105+['k', '','क्'],
 106+['l', '','ल्'],
 107+['m', '','म्'],
 108+['n', '','न्'],
 109+['o', '','ओ'],
 110+['p', '','प्'],
 111+['q', '','क़्'],
 112+['r', '','र्'],
 113+['s', '','स्'],
 114+['t', '','त्'],
 115+['u', '','उ'],
 116+['(v|w)', '','व्'],
 117+['x', '','क्ष्'],
 118+['y', '','य्'],
 119+['(z|Z)', '','ज़्'],
 120+['A', '','आ'],
 121+['B', '','ब्ब्'],
 122+['C', '','क्क्'],
 123+['D', '','ड्'],
 124+['E', '','ए'],
 125+//'F', '','फ्'],
 126+['H', '','ः'],
 127+['I', '','ई'],
 128+['J', '','ज्ज्'],
 129+['K', '','क्क्'],
 130+['L', '','ळ्'],
 131+['M', '','ं'],
 132+['N', '','ण्'],
 133+['O', '','ओ'],
 134+['P', '','प्प्'],
 135+//'Q', '','अ'],
 136+['R', '','ऋ'],
 137+['S', '','श्'],
 138+['T', '','ट्'],
 139+['U', '','ऊ'],
 140+['(V|W)', '','व्व्'],
 141+['X', '','क्ष्'],
 142+['Y', '','य्य्'],
 143+//'z', '','अ'
 144+['0', '','०'],
 145+['1', '','१'],
 146+['2', '','२'],
 147+['3', '','३'],
 148+['4', '','४'],
 149+['5', '','५'],
 150+['6', '','६'],
 151+['7', '','७'],
 152+['8', '','८'],
 153+['9', '','९'],
 154+['\\.', '','।'],
 155+['//', '','ऽ'],
 156+['\\`', '','़']
 157+];
 158+
 159+jQuery.narayam.addScheme( 'ne', {
 160+ 'namemsg': 'narayam-ne',
 161+ 'extended_keyboard': false,
 162+ 'lookbackLength': 4,
 163+ 'keyBufferLength': 1,
 164+ 'rules': rules
 165+} );
\ No newline at end of file
Index: trunk/extensions/Narayam/Narayam.i18n.php
@@ -25,6 +25,8 @@
2626 'narayam-kn-inscript' => 'Kannada InScript',
2727 'narayam-ml' => 'Malayalam Transliteration',
2828 'narayam-ml-inscript' => 'Malayalam InScript',
 29+ 'narayam-ne' => 'Nepali Transliteration',
 30+ 'narayam-ne-inscript' => 'Nepali InScript',
2931 'narayam-or' => 'Oriya Transliteration',
3032 'narayam-or-inscript' => 'Oriya InScript',
3133 'narayam-sa' => 'Sanskrit Transliteration',
Index: trunk/extensions/Narayam/Narayam.php
@@ -64,6 +64,10 @@
6565 'ml' => 'ext.narayam.rules.ml',
6666 'ml-inscript' => 'ext.narayam.rules.ml-inscript',
6767 ),
 68+ 'ne' => array(
 69+ 'ne' => 'ext.narayam.rules.ne',
 70+ 'ne-inscript' => 'ext.narayam.rules.ne-inscript',
 71+ ),
6872 'or' => array(
6973 'or' => 'ext.narayam.rules.or',
7074 'or-inscript' => 'ext.narayam.rules.or-inscript',
@@ -177,6 +181,16 @@
178182 'messages' => array( 'narayam-ml-inscript' ),
179183 'dependencies' => 'ext.narayam.core',
180184 );
 185+$wgResourceModules['ext.narayam.rules.ne'] = $narayamTpl + array(
 186+ 'scripts' => 'ext.narayam.rules.ne.js',
 187+ 'messages' => array( 'narayam-ne' ),
 188+ 'dependencies' => 'ext.narayam.core',
 189+);
 190+$wgResourceModules['ext.narayam.rules.ne-inscript'] = $narayamTpl + array(
 191+ 'scripts' => 'ext.narayam.rules.ne-inscript.js',
 192+ 'messages' => array( 'narayam-ne-inscript' ),
 193+ 'dependencies' => 'ext.narayam.core',
 194+);
181195 $wgResourceModules['ext.narayam.rules.or'] = $narayamTpl + array(
182196 'scripts' => 'ext.narayam.rules.or.js',
183197 'messages' => array( 'narayam-or' ),

Status & tagging log