eo-transliteration.js 846 Bytes
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
( function ( $ ) {
	'use strict';

	function prepareRules () {
		var rules = [], chars;

		chars = {
			C: 'Ĉ',
			G: 'Ĝ',
			H: 'Ĥ',
			J: 'Ĵ',
			S: 'Ŝ',
			U: 'Ŭ',
			c: 'ĉ',
			g: 'ĝ',
			h: 'ĥ',
			j: 'ĵ',
			s: 'ŝ',
			u: 'ŭ'
		};

		$.each( chars, function ( ascii, accented ) {
			rules.push( [ ascii + '[Xx]', ascii, accented ] );
			rules.push( [ accented + '([Xx])', '[Xx]', ascii + '$1' ] );
		} );

		return rules;
	}

	var eoTransliteration = {
		id: 'eo-transliteration',
		name: 'Esperanto Transliteration',
		description: 'Esperanto x-code transliteration',
		date: '2012-10-10',
		URL: 'http://github.com/wikimedia/jquery.ime',
		author: 'Brion Vibber',
		license: 'GPLv3',
		version: '1.0',
		contextLength: 1,
		maxKeyLength: 1,
		patterns: prepareRules()
	};

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