pa-transliteration.js 3.73 KB
Newer Older
priyank's avatar
priyank committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
( function ( $ ) {
	'use strict';

	var paTransliteration = {
		id: 'pa-transliteration',
		name: 'Punjabi Transliteration',
		description: 'Punjabi transliteration',
		date: '2012-10-16',
		URL: 'http://github.com/wikimedia/jquery.ime',
		author: 'Amir E. Aharoni, inputs from Saurabh Choudhary and Surinder Wadhawan',
		license: 'GPLv3',
		version: '1.0',
		contextLength: 2,
		maxKeyLength: 4,
		/* Semi-automatically created from the Hindi transliteration mapping using
		 * the following Perl substitution:
		 * s{(?<deva_letter>[ऀ-ॿ])}{chr(ord($+{deva_letter}) + 0x100)}xmsge;
		 */
		patterns: [
			['ਕ੍h', 'c', 'ਚ੍'],
			['\\\\([A-Za-z\\>_~\\.0-9])', '\\\\', '$1'],

			// ਕ-ਹ is the main range of Indic letters.
			// ੜ is an additional unique Gurmukhi letter.
			['([ਕ-ਹੜ]਼?)੍a', '$1'], // Short [a] after a consonant with virama removes the virama
			['([ਕ-ਹੜ]਼?)੍A', '$1ਾ'], // Long [a] after a consonant with virama removes the virama and adds long [a]
			['([ਕ-ਹੜ]਼?)a', '$1ਾ'], // 'aa' gives long [a] - short [a] after a consonant without virama adds long [a]
			['([ਕ-ਹੜ]਼?)੍i', '$1ਿ'],
			['([ਕ-ਹੜ]਼?)(ਿi|੍I|ੇe)', '$1ੀ'], // 'ii', 'I' and 'ee' give long [i].
			['([ਕ-ਹੜ]਼?)੍u', '$1ੁ'],
			['([ਕ-ਹੜ]਼?)(ੁu|੍U|ੋo)', '$1ੂ'], // 'uu', 'U' and 'oo' give long [u].
			['([ਕ-ਹੜ]਼?)੍e', '$1ੇ'],
			['([ਕ-ਹੜ]਼?)(i|੍E)', '$1ੈ'], // 'i' after a consonant without virama or 'E' after a consonant with Virama gives "ai"
			['([ਕ-ਹੜ]਼?)੍[oO]', '$1ੋ'],
			['([ਕ-ਹੜ]਼?)u', '$1ੌ'], // 'u' after a consonant without virama gives "au"
			['([ਕ-ਹੜ])੍\\`', '$1਼੍'], // '`' (backtick) after a consonant with virama adds a nukta before the virama

			['ਅa', ''], // aa
			['(ਓo|ਉu)', ''], //oo, uu
			['ਅi', ''], // ai
			['\\^', ''], // a^ (iri - base for vowels)
			['\\^', ''], // u^ (ura - base for vowels)
			['(ਏe|ਇi)', ''], // ee, ii
			['ਅu', ''], // au
			['ਂ[Mm^]', ''], // bindi + 'm', 'M', or '^' -> Adak bindi
			['ਣ੍N', ''], // Tippi - nasalization

			['ਕ੍h', 'ਖ੍'], // kh
			['ਗ੍h', 'ਘ੍'], // gh
			['ਨ੍g', 'ਙ੍'], // ng
			['ਚ੍h', 'ਛ੍'], // ch
			['ਜ੍h', 'ਝ੍'], // jh
			['ਨ੍j', 'ਞ੍'], // nj
			['ਟ੍h', 'ਠ੍'], // Th
			['ਡ੍h', 'ਢ੍'], // Dh
			['ਤ੍h', 'ਥ੍'], // th
			['ਦ੍h', 'ਧ੍'], // dh
			['ਪ੍h', 'ਫ੍'], // ph
			['ਬ੍h', 'ਭ੍'], // bh

			['ਸ੍h', 'ਸ਼੍'], // sh
			['ਕ਼੍h', 'ਖ਼੍'], // k + nukta + h

			['a', ''],
			['b', 'ਬ੍'],
			['c', 'ਚ੍'],
			['d', 'ਦ੍'],
			['e', ''],
			['f', 'ਫ੍'],
			['F', 'ਫ਼੍'], // With nukta
			['g', 'ਗ੍'],
			['h', 'ਹ੍'],
			['i', ''],
			['j', 'ਜ੍'],
			['k', 'ਕ੍'],
			['l', 'ਲ੍'],
			['m', 'ਮ੍'],
			['n', 'ਨ੍'],
			['o', ''],
			['p', 'ਪ੍'],
			['q', ''], // Udaat
			['r', 'ਰ੍'],
			['s', 'ਸ੍'],
			['t', 'ਤ੍'],
			['u', ''],
			['(v|w)', 'ਵ੍'],
			['y', 'ਯ੍'],
			['z', ''], // Addak - gemination
			['A', ''],
			['D', 'ਡ੍'],
			['H', ''], // Visarga
			['I', ''],
			['M', ''], // Bindi
			['N', 'ਣ੍'],
			['R', 'ੜ੍'], // Rra
			['S', 'ਸ਼੍'],
			['T', 'ਟ੍'],
			['U', ''],
			['X', ''], // Ek onkar
			['Y', ''], // Yakash
			['0', ''],
			['1', ''],
			['2', ''],
			['3', ''],
			['4', ''],
			['5', ''],
			['6', ''],
			['7', ''],
			['8', ''],
			['9', ''],
			['~', ''], // Virama
			['\\`', ''], // Nukta

			['\\.', ''], // Double danda, must be before single danda
			['\\.', '']] // Danda
	};

	$.ime.register( paTransliteration );
}( jQuery ) );