Bikarhêner:Balyozxane/newentrywiz.js

Zanibe: Piştî weşandinê, ji bo dîtina guhartinan dibe ku hewce be "cache"ya geroka xwe paqij bikî.

  • Firefox / Safari: Pê li Shift û Reload bike an jî Ctrl-F5 an Ctrl-R bike (ji bo Mac: ⌘-R)
  • Google Chrome: Pê li Ctrl-Shift-R (ji bo Mac: ⌘-Shift-R) bike
  • Internet Explorer / Edge: Pê li Ctrl û Refresh bike, an jî Ctrl-F5 bike
  • Opera: Pê li Ctrl-F5 bike.
//Ji orîjînala [[en:User:Yair rand/newentrywiz.js]]
// Hin beş ji [[ca:Usuari:Aleator/novaentrada.js]] û ji [[:en:User:So9q/new-entry-creator.js]] hatine wergirtin
// {{belgekirin}}
// todo: clean, jQuerize, use langmetadata, let users extend this
/* jshint sub:true, shadow:true, undef:true, unused:true, strict:true, forin:true, latedef:true */
/* global jQuery */
// <nowiki>
// Initialize variables
// Support prefilling via GET
function decapitalize(s) {
		if (typeof s !== 'string') return '';
		return s.charAt(0).toLowerCase() + s.slice(1);
}

if (mw.util.getParamValue('ct') == 'true') {
	var necdata = {
		pos: decapitalize(mw.util.getParamValue('pos')),
		pos2: mw.util.getParamValue('pos'),
	};
	var def2 = '[[' + mw.util.getParamValue('def') + ']]';
	var neccode = mw.util.getParamValue('lang');
	var transcription = mw.util.getParamValue('transcription');
	var zayend = mw.util.getParamValue('zayend');
}
else {
	neccode = typeof window.NEC_default_lang == "undefined" ? 'ku' : window.NEC_default_lang;
	var necdata = {
		pos: "navdêr",
		pos2: "Navdêr"
	};	
}

var necdefs = [
	['', [],
		[],
		[],
		[],
		[]
	]
];
var necpost = []; //ji bo beşan

for (var i = 4; i <= 16; ++i) {
	necpost[i] = [];
}

var necpostT = []; //ji bo şablonan

for (var i = 0; i <= 9; ++i) {
	necpostT[i] = [];
}

var necpostlangtext = [];

var title = mw.config.get('wgTitle');

var necinfls = {

	ku: {
		'navdêr': ['{{', '}}', ['Zayend', '', [
				['Nayê zanîn', 'navdêr|ku|z=?'],
				['tune', 'navdêr|ku|z=-'],
				['nêr', 'ku-tewîn-nav|{{subst:PAGENAME}}|nêr}}\n{{navdêr|ku|z=n'],
				['mê', 'ku-tewîn-nav|{{subst:PAGENAME}}|mê}}\n{{navdêr|ku|z=m'],
				['mê û nêr', 'ku-tewîn-nav|{{subst:PAGENAME}}|mê û nêr}}\n{{navdêr|ku|z=mn'],
				['bi gelemperî pirjimar', 'navdêr|ku|j=p+'],
			]],
		],
		'rengdêr': ['{{', '}}', ['Qiyasbarî', '', [
				['qiyasbar', 'ku-tewîn-rd|{{subst:PAGENAME}}}}\n{{rengdêr|ku'],
				['neqiyasbar', 'rengdêr|ku|form=-']
			]],
		],
		'lêker': ['{{lêker|ku', '}}', ['Cure', '', [
				['Navê  zanîn', '|c=?'],
				['gerguhêz', '|c=gh'],
				['xwerû-gerguhêz', '|c=x-gh'],
				['pêkhatî-gerguhêz', '|c=p-gh'],
				['hevedudanî-gerguhêz', '|c=h-gh'],
				['biwêjî-gerguhêz', '|c=b-gh'],
				['negerguhêz', '|c=ngh'],
				['xwerû-negerguhêz', '|c=x-ngh'],
				['pêkhatî-negerguhêz', '|c=p-ngh'],
				['hevedudanî-negerguhêz', '|c=h-ngh'],
				['biwêjî-negerguhêz', '|c=b-ngh']
			]],
		],
		'hoker': ['{{hoker|ku', '}}'
		],
		'serenav': ['{{', '}}', ['Zayend', '', [
				['Nayê zanîn', 'serenav|ku|z=?'],
				['tune', 'serenav|ku|z=-'],
				['nêr', 'ku-tewîn-nav|{{subst:PAGENAME}}|nêr|y}}\n{{serenav|ku|z=n'],
				['mê', 'ku-tewîn-nav|{{subst:PAGENAME}}|mê|y}}\n{{serenav|ku|z=m'],
			]],
		]
		
	},
	ar: {
		'navdêr': ['{{navdêr|ar', '}}',
			['Cuda', '', [
				['tune', ''],
				['input', ' ', '|'],
			]],
			['Translîterasyon', '', [
				['tune', transcription ? "|tr=" + transcription : '' ],
				['input', ' ', '|tr='],
			]],

			['Zayend', '', [
				['Nayê zanîn', zayend ? "|z=" + zayend : '|z=' ],
				['nêr', '|z=n'],
				['mê', '|z=m'],
				['mê û nêr', '|z=mn'],
				['Bi gelemperî pirjimar', '|j=p+'],
			]],

			['Forma mê', '', [
				['tune', ''],
				['input', ' ', '|m='],
			]],

			['Forma mê 2', '', [
				['tune', ''],
				['input', ' ', '|m2='],
			]],

			['Forma mê 3', '', [
				['tune', ''],
				['input', ' ', '|m3='],
			]],
			
			['Pirjimar', '', [
				['tune', ''],
				['(nejimarbar)', '|j=nj'],
				['input', ' ', '|p=']
			]],

			['Pirjimar 2', '', [
				['tune', ''],
				['input', ' ', '|p2='],
			]],

			['Pirjimar 3', '', [
				['tune', ''],
				['input', ' ', '|p3='],
			]]

		],
		'rengdêr': ['{{rengdêr|ar', '}}',
			['Cuda', '', [
				['tune', ''],
				['input', ' ', '|'],
			]],
			['Translîterasyon', '', [
				['tune', transcription ? "|tr=" + transcription : '' ],
				['input', ' ', '|tr='],
			]],

			['Zayend', '', [
				['Nayê zanîn', zayend ? "|z=" + zayend : '|z=' ],
				['nêr', '|z=n'],
				['mê', '|z=m'],
				['mê û nêr', '|z=mn'],
			]],

			['Forma mê', '', [
				['tune', ''],
				['input', ' ', '|m='],
			]],

			['Forma mê 2', '', [
				['tune', ''],
				['input', ' ', '|m2='],
			]],

			['Forma mê 3', '', [
				['tune', ''],
				['input', ' ', '|m3='],
			]],
			
			['Pirjimar', '', [
				['tune', ''],
				['(nejimarbar)', '|j=nj'],
				['input', ' ', '|p=']
			]],

			['Pirjimar 2', '', [
				['tune', ''],
				['input', ' ', '|p2='],
			]],

			['Pirjimar 3', '', [
				['tune', ''],
				['input', ' ', '|p3='],
			]]
		],
		'reh': ['{{ar-reh', '}}',
		],
		'lêker': ['{{lêker|ar', '}}',
			['Cuda', '', [
				['tune', ''],
				['input', ' ', '|'],
			]],
			['Translîterasyon', '', [
				['tune', transcription ? "|tr=" + transcription : '' ],
				['input', ' ', '|tr='],
			]],
		],
		'hoker': ['{{hoker|ar', '}}',
			['Cuda', '', [
				['tune', ''],
				['input', ' ', '|'],
			]],
			['Translîterasyon', '', [
				['tune', transcription ? "|tr=" + transcription : '' ],
				['input', ' ', '|tr='],
			]],
		],
	},
	en: {
		'navdêr': ['{{en-navdêr', '}}', ['Pirjimar', '', [
			[title + 's', ''],
			[title + 'es', '|es'],
			['(nejimarbar)', '|-'],
			['input', 'Yên din: ', '|']
		]], 
		],
		'lêker': ['{{en-lêker', '}}', ['Dema niha ya yekjimar ya kesa seyêm', '', [
				[title + 's', '|' + title + 's'],
				['input', 'Yên din: ', '|']
			]],
			['Partîsîpa niha', '', [
				[title + 'ing', '|' + title + 'ing'],
				['input', 'Yên din: ', '|']
			]],
			['Dema borî', '', [
				[title + 'ed', '|' + title + 'ed'],
				['input', 'Yên din: ', '|']
			]],
			['Partîsîpa borî', '', [
				[title + 'ed', '|' + title + 'ed'],
				['input', 'Yên din: ', '|']
			]]
		],
		'rengdêr': ['{{', '}}', ['Komp û Sûperlatîv', '', [
				['nizanim', 'rengdêr|en'],
				['more ' + title + ' most ' + title, 'en-rengdêr'],
				[title + 'er ' + title + 'est', 'en-rengdêr|er'],
				['more ' + title + ' an ' + title + 'er', 'en-rengdêr|er|more'],
				['(neqiyasbar)', '|-'],
			]],
		],
		'hoker': ['{{hoker|en', '}}'],

		'serenav': ['{{en-serenav', '}}', ['Pirjimar', '', [
			['Tune', ''],
			[title + 's', '|s'],
			['input', 'Yên din: ', '|']
		]]],
	},
	de: {
		'navdêr': ['{{navdêr|de', '}}', ['Zayend', '', [
				['Nayê zanîn', zayend ? "|z=" + zayend : '|z=' ],
				['nêr', '|z=n'],
				['mê', '|z=m'],
				['mê û nêr', '|z=mn'],
				['Bi gelemperî pirjimar', '|j=p+'],
			]],
			['Pirjimar', '', [
				['tune', ''],
				['(nejimarbar)', '|j=nj'],
				['input', ' ', '|p=']
			]]
		],
	},

	fa: {
		'navdêr': ['{{navdêr|fa', '}}',
			['Translîterasyon', '', [
				['tune', transcription ? "|tr=" + transcription : '' ],
				['input', ' ', '|tr='],
			]],
	
			['Pirjimar', '', [
				['tune', ''],
				['(nejimarbar)', '|j=nj'],
				['input', ' ', '|p=']
			]],

			['Pirjimar 2', '', [
				['tune', ''],
				['input', ' ', '|p2='],
			]],

			['Pirjimar 3', '', [
				['tune', ''],
				['input', ' ', '|p3='],
			]]

		],
		'rengdêr': ['{{rengdêr|fa', '}}',
			['Translîterasyon', '', [
				['tune', transcription ? "|tr=" + transcription : '' ],
				['input', ' ', '|tr='],
			]],
		],
		'lêker': ['{{lêker|fa', '}}',
			['Translîterasyon', '', [
				['tune', transcription ? "|tr=" + transcription : '' ],
				['input', ' ', '|tr='],
			]],
		],
		'hoker': ['{{hoker|fa', '}}',
			['Translîterasyon', '', [
				['tune', transcription ? "|tr=" + transcription : '' ],
				['input', ' ', '|tr='],
			]],
		],
	},

	fr: {
		'navdêr': ['{{navdêr|fr', '}}', ['Zayend', '', [
				['Nayê zanîn', zayend ? "|z=" + zayend : '|z=' ],
				['nêr', '|z=n'],
				['mê', '|z=m'],
				['mê û nêr', '|z=mn'],
				['Bi gelemperî pirjimar', '|j=p+'],
			]],
			['Pirjimar', '', [
				['tune', ''],
				[title + 's', '|p=' +title +'s'],
				['(nejimarbar)', '|j=nj'],
				['input', ' ', '|p=']
			]]
		],
	},
};

/*

Notes:
necfunction fills in the edit box
necfunction2 creates the main menu stuff inside the span id'd necblah
necfunction3 doesn't exist
necfunction4 goes to necfunction5 (don't remember what this was for)
necfunction5 creates the inflections options by filling in necinfls
necfunction6 does some extra junk for the infl options input boxes
necdefupdate makes the definitions/example sentence options
necpostbox makes the extra junk ("More details") work (i think)

More recent note: I knew next to nothing about javascript when I originally wrote this, so the code is an utter mess. 
It's also probably never going to be fixed up because really, I'd rather work on making WT:EDIT stuff the primary easy-editing method instead of tools like this.

The necinfls object works like this:
Each language is its own object, containing an object for each pos, which contains the information for that pos.
The first part is the stuff that comes at the beginning of the template, the second is the stuff at the end, the third onward are the available parameters of the template and what stuff they produce.
Each template parameter is an array, which contains the word that shows up at the beginning of the section, then a blank value, and then subarrays of each option.
Each subarray contains the text that shows up in the editor, followed by the text that shows up in the textbox (the wikimarkup). Some onclick javascript can be added to an option as the third parameter in the array.
If the option is an input box, the first parameter should be "input", followed by the editor text (DON'T leave this blank or the whole thing will blow up), followed by the pre-inputbox-value wikimarkup, followed by post-inputbox-value wikimarkup, followed by any extra js. 

Does this make any sense to anyone? :)

Things to do:
1 Get quotations to work right
2 Fix up pronunciation section
3 Add little help thingies
4 Inflection tables
5 Get the example sentence auto-bolding to not stink
6 Build add-section stuff

There are little href=javascript: things littered all over the place because I don't know any other way to make things look like unvisited links without having to actually put anything in the href.

eh, sploot

*/

/* 
nyms 4 'Herwiha', 'Hevmane', 'Dijmane', 'Jêrnav', 'Jornav', 'Nêzîk', 9 
derived 10 'Jê', 'Têkildar', 'Binêre herwiha', 12
etîmolojî 13
dûnde 14 
bi zarava 15
werger 16
*/
var necetym;
var necpron;
var necguharto;
var necheadingorder = ['Bikaranîn', 'Bi alfabeyên din', 'Tewîn', 'Tewandin', 'Herwiha', 'Hevmane', 'Dijmane', 'Jêrnav', 'Jornav', 'Nêzîk', 'Jê', 'Têkildar', 'Binêre herwiha', 'Etîmolojî', 'Dûnde', 'Bi zaravayên din', 'Werger'];
var necinputadvanced = "";
var necposlist = ['Navdêr', 'Lêker', 'Rengdêr', 'Hoker', 'Artîkel', 'Baneşan', 'Biwêj', 'Cînav', 'Daçek', 'Dordaçek', 'Girêdek', 'Gotineke pêşiyan', 'Hejmar', 'Hevok', 'Kurtenav', 'Navgir', 'Paşgir', 'Paşdaçek', 'Pêşgir', 'Pirtik', 'Reh', 'Sembol', 'Serenav', 'Tîp'];
var nectemplate = ['Hevdeng', 'IPA', 'Kîtekirin', 'Deng', 'Kategorî', 'Wîkîpediya', 'Bnr herwiha', 'Wêne', 'Ji', 'Qertaf'];


function necfunction2() {
	/* CREATE OPTIONS */
	var x = "Koda zimanî: <input type=text value='" + neccode + "' id='necinput' onKeyUp='neccode=this.value;necfunction();necfunction4();necfunction()' onblur=if (necCleanLangCode(this.value)){this.value=necCleanLangCode(this.value)};neccode=this.value;document.getElementById('nectransspan').style.display=((this.value=='" + neccode + "')?'':'none');if (/^[a-z]{2,3}(-[a-z\-]{1,7})?$/.test(this.value)){document.getElementById('neclangerror').style.display='none'}else{document.getElementById('neclangerror').style.display=''};necfunction();necfunction4();necfunction();necdefupdate() title='Koda zimanî binivîse, ku ji bo kurdî, en ji bo inglîzî'></input><span id=neclangerror style=display:none;color:red> ERROR: INVALID LANGUAGE CODE</span><br>Cureyê rêzimanê: ";

	for (i = 0; i < 4; ++i) {
		x += "<a id='necinputpos" + necposlist[i] + "' href=javascript: onclick=document.getElementById('necinputpos'+necdata.pos2).style.fontWeight='';necdata.pos2='" + necposlist[i] + "';necdata.pos='" + necposlist[i].toLowerCase() + "';this.style.fontWeight='bold';necfunction4();necfunction()";

		if (!i) {
			x += " style='font-weight:bold'";
		}

		x += ">" + necposlist[i] + "</a>, ";
	}

	x += "<span id='necinputpos'>Yên din: <input type=text onKeyUp=\"document.getElementById('necinputpos'+necdata.pos2).style.fontWeight='';necdata.pos2=this.value;necdata.pos=this.value.toLowerCase().replace(/ /g,'');this.parentNode.setAttribute('ID','necinputpos'+this.value);document.getElementById('necinputpos'+necdata.pos2).style.fontWeight='bold';necfunction();necfunction4()\" /><select onchange=\"document.getElementById('necinputpos'+necdata.pos2).style.fontWeight='';necdata.pos2=this.value;necdata.pos=this.value.toLowerCase().replace(/ /g,'');this.parentNode.setAttribute('ID','necinputpos'+this.value);document.getElementById('necinputpos'+necdata.pos2).style.fontWeight='bold';necfunction();necfunction4()\"><option value=''>Hilbijêre</option>";

	for (i = 0; i < necposlist.length; ++i) {
		if (i > 3) {
			x += "<option>" + necposlist[i] + "</option>";
		}
	}
	x += "</select></span><span id=necinfls></span><br>";
		
	x += "<span id='necdefs'>Mane: <input type=text id='necinput3' onKeyUp=necdefs[0][0]=this.value;necfunction() /><br></span>Agahiyên din: <a href=javascript:necdefs.push(['',[],[],[],[],[]]);necdefupdate();necfunction() title='Maneyeke din binivîse'>Maneyeke din</a>,  <a href=javascript: id=necetymbutton onclick=document.getElementById('necetymspan').style.display='';necetym=document.getElementById('necetyminput').value;necfunction();this.style.fontWeight='bold' title='Etîmolojî lê zêde bike'>Etîmolojî</a>, <a href=javascript: id=necpronbutton onclick=document.getElementById('necpronspan').style.display='';necpron=document.getElementById('necproninput').value;necfunction();this.style.fontWeight='bold' title='Bilêvkirinê lê zêde bike'>Bilêvkirin</a>, <a href=javascript: id=necguhartobutton onclick=document.getElementById('necguhartospan').style.display='';necguharto=document.getElementById('necguhartoinput').value;necfunction();this.style.fontWeight='bold' title='Şablona guharto lê zêde bike'>Guharto</a>. <span id='necetymspan' style='display:none'><br>Etîmolojî: <a href=javascript: onclick=necetym=undefined;document.getElementById('necetymspan').style.display='none';necfunction();document.getElementById('necetymbutton').style.fontWeight='' title='Etîmolojiyê jê bibe'>(Jê bibe)</a><br><textarea id=necetyminput onKeyUp=necetym=this.value;necfunction()></textarea></span><span id=necpronspan style='display:none'><br>Bilêvkirin: <a href=javascript: onclick=necpron=undefined;document.getElementById('necpronspan').style.display='none';necfunction();document.getElementById('necpronbutton').style.fontWeight='' title='Bilêvkirinê jê bibe'>(Jê bibe)</a><br><textarea id=necproninput onKeyUp=necpron=this.value;necfunction()></textarea></span><span id=necguhartospan style='display:none'><br>Guharto: <a href=javascript: onclick=necguharto=undefined;document.getElementById('necguhartospan').style.display='none';necfunction();document.getElementById('necguhartobutton').style.fontWeight='' title='Şablona guhartoyê jê bibe'>(Jê bibe)</a><br><textarea id=necguhartoinput onKeyUp=necguharto=this.value;necfunction()></textarea></span>";

	x += "<br><span id=necpostboxT></span>Şablon: <select onchange=necpostboxT(this.value);this.selectedIndex=0;necfunction()><option select='selected'>Hilbijêre</option>";

	for (i = 0; i < nectemplate.length; ++i) {
			x += "<option value=" + i + ">" + nectemplate[i] + "</option>";
		}

	x += "</select>";
	
	x += "<br>Beşên din: <span id=nectransspan> <a href=javascript: id=necSynonymsbutton onclick=necpost[5][necpost[5].length]=['',''];necpostbox();necfunction();this.style.fontWeight='bold' title='Hevmaneyên peyvê binivîse'>Hevmane</a>, <a href=javascript: id=necSynonymsbutton onclick=necpost[4][necpost[4].length]=['',''];necpostbox();necfunction();this.style.fontWeight='bold' title='Guhartoyên peyvê binivîse'>Herwiha</a>, <span id=nectransspan><a href=javascript: id=nectransbutton onclick=necpost[16][necpost[16].length]=['',''];necpostbox();necfunction();this.style.fontWeight='bold' title='Wergerekê lê zêde bike'>Werger</a>, </span>Yên din: <select onchange=necpostbox(this.value);this.selectedIndex=0;necfunction()><option select='selected'>Hilbijêre</option>";

	for (i = 0; i < necheadingorder.length; ++i) {
		if (i != 4 && i != 5 && i != 16 && i != 13) {
			x += "<option value=" + i + ">" + necheadingorder[i] + "</option>";
		}
	}

	x += "</select><br><span id=necpostbox></span><div style='float:right;'><a href=/w/index.php?title=User_talk:Balyozxane/newentrywiz.js&action=edit&section=new title='Pirsgirêkan nîşan bide'>Pirsgirêk?</a></div>";
	document.getElementById("editform").insertBefore(document.getElementById("necblah"), document.getElementById("editform").firstChild);
	document.getElementById("necblah").innerHTML = x;

	if (document.URL.match("&section=new")) {
		document.getElementById("wpSummaryLabel").parentNode.removeChild(document.getElementById("wpSummaryLabel"));
		document.getElementById("wpSummary").parentNode.removeChild(document.getElementById("wpSummary"));
	}
}


// Fill in the edit box.
function necfunction() {
	var k = "";

	if (document.URL.match("&section=new")) {
		k += "\n{{şêwexirab|sedem=Bi [[WF:NEC]] zimanekî din lê hatiye zêdekirin, heke rêzê zimanî ya alfabetîk rast be vê şablonê rakin.}}\n\n";
	} else {
		var neceditsummary = "([[Bikarhêner:Balyozxane/newentrywiz.js|NEC]]) +" + neccode + ":" + necdata.pos + ": "; //edit summary

		if (necguharto != undefined) {
			neceditsummary += "Guhartoyeke [[" + necguharto + "]]";
		}
		if (def2 != undefined) {
			neceditsummary += "Bi [[Bikarhêner:Balyozxane/CreateTranslation.js|amûrê]] ji wergerên " + def2 + ": ";
			if (transcription != "") {
				neceditsummary += 'tr=' + transcription;
			}
			if (zayend != "") {
				neceditsummary += "|z=" + zayend + " ";
			}
		}		
		for (i = 0; i < necdefs.length; ++i) {
			neceditsummary += ((i != 0) ? ', ' : '') + necdefs[i][0];
		}

		document.getElementById("wpSummary").value = neceditsummary;
	}

	if (necpostT[6][0] != undefined) {
	    k += "{{binêre herwiha";
	    for (i = 0; i < necpostT[6].length; i++) {
	        k += "|" + necpostT[6][i];
	    }
	    k += "}}\n\n";
	}
		
	k += "== {{ziman|" + document.getElementById('necinput').value + "}} ==";


	k += "\n";

	if (necpron != undefined || necpostT[0][0] != undefined || necpostT[3][0] != undefined  || necpostT[2][0] != undefined || necpostT[1][0] != undefined) {
		k += "\n=== Bilêvkirin ===\n";
		if (necpron != undefined) {
		    k += necpron + "\n";
		}
		if (necpostT[1][0] != undefined) {
			for (i = 0; i < necpostT[1].length; ++i) {
				if (necpostT[1][i][0]) {
					k += "* {{IPA|" + neccode + "|" + necpostT[1][i];
				}else{
					k += "* {{" + neccode + "-IPA";
				}
				
				k += "}}\n";
			}
		}


		if (necpostT[3][0] != undefined) {
			for (i = 0; i < necpostT[3].length; ++i) {
				k += "* {{deng|" + neccode + "|" + necpostT[3][i][0] + "|Deng";
				if (necpostT[3][i][1]) {
					k += " (" + necpostT[3][i][1] + ")";
				}	
				k += "}}\n";
			}
		}
		
		if (necpostT[2][0] != undefined) {
		    
		    if (necpostT[2][i]){
		    	k += "* {{kîte";
			    for (i = 0; i < necpostT[2].length; i++) {
			        k += "|" + necpostT[2][i];
			    }
		    }else {
				k += "* {{" + neccode + "-kîte";
		    }
		    k += "}}\n";
		}

		if (necpostT[0][0] != undefined) {
		    k += "* {" + "{hevdeng|" + neccode;
		    for (i = 0; i < necpostT[0].length; i++) {
		        k += "|" + necpostT[0][i];
		    }
		    k += "}}\n";
		}		

	}

	k += "\n=== " + necdata.pos2 + " ===\n";

	if (necpostT[7][0] != undefined) {
		for (i = 0; i < necpostT[7].length; ++i) {
			k += "[[Wêne:" + necpostT[7][i][0] + "|thumb|";
			if (necpostT[7][i][1]) {
				k += necpostT[7][i][1];
			}else {
				k + "'''" + title + "'''";
			}
			k += "]]\n";
		}
	}
	
	if (necpostT[5][0] != undefined) {
		for (i = 0; i < necpostT[5].length; ++i) {
			k += "{{Wîkîpediya";
			if (neccode != 'ku') {
				k += "|ziman=" + neccode;
			}
			if (necpostT[5][i][0]) {
				k += "|" + necpostT[5][i][0];
				if (necpostT[5][i][1]) {
					k +=  "|" + necpostT[5][i][1];
				}
			}
			k += "}}\n";
		}
	}

	if (!neccode) {
		neccode = '';
	}

	if (neccode != '' && necinfls[neccode] && necinfls[neccode][necdata.pos] && necinfls[neccode][necdata.pos][2]) {
		if (necdata[neccode + "-" + necdata.pos + "2"] != "Advanced") {
			if (necinfls[neccode][necdata.pos][0] != undefined) {
				k += necinfls[neccode][necdata.pos][0];
			}

			var x = necinfls[neccode][necdata.pos];

			for (var z = 0; z < x.length; ++z) {
				if (z <= 1) {
					continue;
				}

				var zz = neccode + "-" + necdata.pos + z;

				for (var y = 0; y < x[z][2].length; ++y) // search for inflections
				{
					if (x[z][2][y][0] != "input" && necdata[zz] == x[z][2][y][0]) // is selected option, not input box
					{
						k += x[z][2][y][1];
						break;
					}

					if (x[z][2][y][0] == "input" && necfunction7(x[z][2], necdata[zz]) == false) {
						k += x[z][2][y][2] + necdata[zz];
					}
				}
			}

			if (necinfls[neccode][necdata.pos][1] != undefined) {
				k += necinfls[neccode][necdata.pos][1];
			}
		} else {
			k += necinputadvanced;
		}
	} else {
		if (necinputadvanced) {
			k += necinputadvanced;
		} else {
			if (neccode != '' && necinfls[neccode] && necinfls[neccode][necdata.pos]) {
				k += necinfls[neccode][necdata.pos][0];

				k += necinfls[neccode][necdata.pos][1];
			} else {
				k += '{{' + necdata.pos2.toLowerCase() + '|' + neccode;
					if (def2 != undefined) {
						if (transcription != "") {
							k += '|tr=' + transcription;
						}
						if (zayend != "") {
							k += "|z=" + zayend;
						}					
					}else {
						if ((new LangMetadata()).guessScript(neccode) != 'Latn'){
							k += "|tr=";
						}
					}		
				k += '}}';

			}
		}
	}

	k += "";
		if (necguharto != undefined) {
			for (i = 0; i < necdefs.length && i <1; ++i) {
		    	k += "\n# ";
		// etîket ji bo guhartoyê
				if (necdefs[i][4].length > 0) {
					k += "{{f|" + neccode;
					for (e = 0; e < necdefs[i][4].length; ++e) {
						k += "|" + necdefs[i][4][e];
					}
					k += "}} ";
				}
		    	k += "{{awayekî din|" + neccode + "|" + necguharto;
			    if (necdefs[i][0]) {
			    	k += "|w=" + necdefs[i][0];
			    }

		    	k += '}}';
			}
		}

		if (def2 != undefined) {
			for (i = 0; i < necdefs.length && i <1; ++i) {
				k += '\n# ';
		// etîket ji bo wergeran
				if (necdefs[i][4].length > 0) {
					k += "{{f|" + neccode;
					for (e = 0; e < necdefs[i][4].length; ++e) {
						k += "|" + necdefs[i][4][e];
					}
					k += "}} ";
				}
				k +=def2;
			    if (necdefs[i][0]) {
			    	k += ' {{mane|' + necdefs[i][0] + '}}';
			    }

		// hevmane ji bo wergeran
				if (necdefs[i][3].length > 0) {
					k += "\n#: {{hevmaneyên peyvê|" + neccode;
					for (e = 0; e < necdefs[i][3].length; ++e) {
						k += "|" + necdefs[i][3][e];
					}
					k += "}} ";
				}
		// dijmane ji bo wergeran
				if (necdefs[i][5].length > 0) {
					k += "\n#: {{dijmaneyên peyvê|" + neccode;
					for (e = 0; e < necdefs[i][5].length; ++e) {
						k += "|" + necdefs[i][5][e];
					}
					k += "}} ";
				}
//mînak ji bo wergeran
		for (var l = 0; l < necdefs[i][1].length; ++l) {

			if (neccode == "ku") {
				k += "\n#: {{mk|ku|" + necdefs[i][1][l][0].replace(new RegExp("(" + title + "([^( |,|;|\?|\.|\!)]+)?)", "ig"), "'''$1'''") + "";
			}else {
				k += "\n#: {{mk|" + neccode + "|" + necdefs[i][1][l][0].replace(new RegExp("(" + title + "([^( |,|;|\?|\.|\!)]+)?)", "ig"), "'''$1'''") + "''";
			}
			if (neccode != "ku" && (new LangMetadata()).guessScript(neccode) != 'Latn') {
				k += "|tr=" + necdefs[i][1][l][1] + ""; //transliterasyon 
				k += "|w=" + necdefs[i][1][l][2] + "";
			}else if (neccode != "ku") {
				k += "|w=" + necdefs[i][1][l][2] + "";
			}
			k += "}}";

		}
//jêgirtin ji bo wergeran
		for (l = 0; l < necdefs[i][2].length; ++l) {
			
			k += "\n#* {{jêder-";
			
			// navê şablonê binivîse malper/kitêb/kovar?
			if (necdefs[i][2][l][0]) {
			k += necdefs[i][2][l][0];
			}else {
			k += "kitêb";
			}

			k += "|" + neccode +  "|jêgirtin=";

			k += necdefs[i][2][l][8].replace(new RegExp("(" + title + "([^( |,|;|\?|\.|\!)]+)?)", "ig"), "'''$1'''");

			if (necdefs[i][2][l][1]) {
				k += "|nivîskar=" + necdefs[i][2][l][1];
			}
			
			if (necdefs[i][2][l][2]) {
				k += "|sernav=" + necdefs[i][2][l][2];
			}
			
			if (necdefs[i][2][l][3]) {
				k += "|weşanxane=" + necdefs[i][2][l][3];
			}

			if (necdefs[i][2][l][5]) {
				if (necdefs[i][2][l][0] == 'kovar') {
					k += "|hejmar=" + necdefs[i][2][l][5];
				}else if (necdefs[i][2][l][0] == 'kitêb') {
					k += "|ISBN=" + necdefs[i][2][l][5];
				}else {
					k += "|malper=" + necdefs[i][2][l][5];
				}
			}

			if (necdefs[i][2][l][6]) {
				k += "|url=" + necdefs[i][2][l][6];
			}

			if (necdefs[i][2][l][7]) {
				k += "|sal=" + necdefs[i][2][l][7];
			}

			if (necdefs[i][2][l][4]) {
				k += "|rûpel=" + necdefs[i][2][l][4] + "}}";
			}

			else
				k += "}}";



			if (neccode != "ku") {
				k += "\n#*: " + necdefs[i][2][l][9];
			}
		}


			}
		}

	if (def2 != undefined || necguharto != undefined) {
		i = 1;
	}else {
		i = 0;
	}
	for (i; i < necdefs.length; ++i) {

		k += "\n# ";

// etîket
		if (necdefs[i][4].length > 0) {
			k += "{{f|" + neccode;
			for (e = 0; e < necdefs[i][4].length; ++e) {
				k += "|" + necdefs[i][4][e];
			}
			k += "}} ";
		}

		k += necdefs[i][0];


// hevmane
		if (necdefs[i][3].length > 0) {
			k += "\n#: {{hevmane|" + neccode;
			for (e = 0; e < necdefs[i][3].length; ++e) {
				k += "|" + necdefs[i][3][e];
			}
			k += "}} ";
		}
// dijmane
		if (necdefs[i][5].length > 0) {
			k += "\n#: {{dijmane|" + neccode;
			for (e = 0; e < necdefs[i][5].length; ++e) {
				k += "|" + necdefs[i][5][e];
			}
			k += "}} ";
		}

		for (var l = 0; l < necdefs[i][1].length; ++l) {

			if (neccode == "ku") {
				k += "\n#: {{mk|ku|" + necdefs[i][1][l][0].replace(new RegExp("(" + title + "([^( |,|;|\?|\.|\!)]+)?)", "ig"), "'''$1'''") + "";
			}else {
				k += "\n#: {{mk|" + neccode + "|" + necdefs[i][1][l][0].replace(new RegExp("(" + title + "([^( |,|;|\?|\.|\!)]+)?)", "ig"), "'''$1'''");
			}
			if (neccode != "ku" && (new LangMetadata()).guessScript(neccode) != 'Latn') {
				k += "|tr=" + necdefs[i][1][l][1] + ""; //transliterasyon 
				k += "|w=" + necdefs[i][1][l][2] + "";
			}else if (neccode != "ku") {
				k += "|w=" + necdefs[i][1][l][2] + "";
			}
			k += "}}";
		}

		for (l = 0; l < necdefs[i][2].length; ++l) {
			
			k += "\n#* {{jêder";
			
			// navê şablonê binivîse malper/kitêb/kovar?
			if (necdefs[i][2][l][0]) {
				if (necdefs[i][2][l][0] == 'kitêb' || necdefs[i][2][l][0] == 'kovar' || necdefs[i][2][l][0] == 'malper'){
					k += '-' + necdefs[i][2][l][0];
				}else{
					k += '|' + necdefs[i][2][l][0];
				}	
			}else {
			k += "-kitêb";
			}

			k += "|" + neccode +  "|jêgirtin=";

			k += necdefs[i][2][l][8].replace(new RegExp("(" + title + "([^( |,|;|\?|\.|\!)]+)?)", "ig"), "'''$1'''");

			if (necdefs[i][2][l][1]) {
				k += "|nivîskar=" + necdefs[i][2][l][1];
			}
			
			if (necdefs[i][2][l][2]) {
				k += "|sernav=" + necdefs[i][2][l][2];
			}
			
			if (necdefs[i][2][l][3]) {
				k += "|weşanxane=" + necdefs[i][2][l][3];
			}

			if (necdefs[i][2][l][5]) {
				if (necdefs[i][2][l][0] == 'kovar') {
					k += "|hejmar=" + necdefs[i][2][l][5];
				}else if (necdefs[i][2][l][0] == 'kitêb') {
					k += "|ISBN=" + necdefs[i][2][l][5];
				}else {
					k += "|malper=" + necdefs[i][2][l][5];
				}
			}

			if (necdefs[i][2][l][6]) {
				k += "|url=" + necdefs[i][2][l][6];
			}

			if (necdefs[i][2][l][7]) {
				k += "|sal=" + necdefs[i][2][l][7];
			}

			if (necdefs[i][2][l][4]) {
				k += "|rûpel=" + necdefs[i][2][l][4] + "}}";
			}

			else
				k += "}}";



			if (neccode != "ku") {
				k += "\n#*: " + necdefs[i][2][l][9];
			}
		}
	}

	/* SUBHEADERS */
	for (var o = 0; o <= 3; ++o) {
		if (necpost[o] != undefined) {
			k += "\n\n==== " + necheadingorder[o] + " ====\n" + necpost[o];
		}
	}

	for (o = 4; o <= 6; ++o) {
		if (necpost[o][0] != undefined) {
			k += "\n\n==== " + necheadingorder[o] + " ====";
		}

		for (i = 0; i < necpost[o].length; ++i) {
			k += "\n* {{mane|" + necpost[o][i][0] + "}} ";

			for (var u = 0; u < necpost[o][i].length; ++u) {
				if (u != 0) {
					if (u != 1) {
						k += ", ";
					}

					k += "{{g|" + neccode + "|" + necpost[o][i][u] + "}}";
				}
			}
		}
	}
	
	for (o = 7; o <= 12; ++o) {
		if (necpost[o][0] != undefined) {
			k += "\n\n==== " + necheadingorder[o] + " ====";
		}

		for (i = 0; i < necpost[o].length; ++i) {
			k += "\n* {{g|" + neccode + "|" + necpost[o][i] + "}}";
		} 
	}

	if (necetym != undefined || necpostT[8][0] != undefined|| necpostT[9][0] != undefined) {
		k += "\n\n==== Etîmolojî ====\n";
	}else {
		if (neccode == "ku" && necguharto == undefined)
			k += "\n\n==== Etîmolojî ====\n{{bêetîmolojî}}";
	}
		if (necpostT[8][0] != undefined || necpostT[9][0] != undefined) {
			k += "Ji ";
		}

		for (i = 0; i < necpostT[8].length; ++i) {
			k += "{{";
				if (necpostT[8][i][0]){
					k += necpostT[8][i][0] + '|';
				}else {
					k += "ji|";
				}
			k +=  necpostT[8][i][1] + '|' + neccode;
			k += "|" + necpostT[8][i][2];
				if (necpostT[8][i][3]) {
					k += "|w=" + necpostT[8][i][3];
				}
				if (necpostT[8][i][4]) {
					k += "|tr=" + necpostT[8][i][4];
				}
			k += "}}";

			if (necpostT[8].length > 1 ) {
				k += ", ji ";
			}
		}

		if (necpostT[8][0] != undefined && necpostT[9][0] != undefined) {
			k += " wekheva ";
		}else if (necpostT[8][0] == undefined || necpostT[9][0] == undefined) {
			k += "";
		}
		
		for (i = 0; i < necpostT[9].length; ++i) {
			k += "{{qertaf|" + neccode;
			k += "|" + necpostT[9][i][0];
			k += "|" + necpostT[9][i][1];
				if (necpostT[9][i][2]) {
					k += "|w1=" + necpostT[9][i][2];
				}
				if (necpostT[9][i][3]) {
					k += "|w2=" + necpostT[9][i][3];
				}
				if (necpostT[9][i][4]) {
					k += "|tr1=" + necpostT[9][i][4];
				}
				if (necpostT[9][i][5]) {
					k += "|tr2=" + necpostT[9][i][5];
				}
			k += "}}";
		}
		
	if (necetym != undefined) {
		k += necetym;
	}


	
	var HH=0;//hi ha?
	for (o = 14; o <= 16; ++o) {
		if (necpost[o][0] != undefined) {
			k += "\n\n==== " + necheadingorder[o] + " ====";
		}

		if (o == 14) {
			for (i = 0; i < necpost[14].length; ++i) {
				k += "\n* {{dû|" + necpost[14][i][0];
				k += "|" + necpost[14][i][1] + "}}";
			}
		}else if (o == 15) {
			if (necpost[15] != undefined) {
			for (i = 0; i < necpost[15].length; ++i) {
		        k += "\n* {{Z|" + necpost[15][i][0] + "}}: ";
	        for (var uu in necpost[15][i]) {
		            if (uu != 0) { //concatenar trads
	                if (uu != 1) {
		                    k += ", ";
	                }
		                k += "{{W-|" + necpost[15][i][0] + "|" + necpost[15][i][uu] + "}}";
		            }
		        }
			}
		}
		}else if (o == 16) {
		    HH = 0;
			if (neccode == "ku" && necguharto == undefined && necpost[16].length < 1){
				k += "\n\n==== Werger ====\n{{werger-ser}}\n{{werger-bin}}";
			}
			for (i = 0; i < necpost[16].length; ++i) {
		        if (HH == 0) {
		            k += "\n{{werger-ser}}";
		        }
		        k += "\n* {{Z|" + necpost[16][i][0] + "}}: ";
	        for (var uu in necpost[16][i]) {
		            if (uu != 0) { //concatenar trads
	                if (uu != 1) {
		                    k += ", ";
	                }
		                k += "{{W|" + necpost[16][i][0] + "|" + necpost[16][i][uu] + "}}";
		            }
		        }
		        if (HH == 0) {
		            k += "" + "";
		            HH = 1;
		        }
		    }
		    if (HH == 1) {
		        k += "\n{{werger-bin}}\n";
		    }
		}
	}

	
	if (necpostT[4][0] != undefined) {
	    k += "\n\n{{mijar|" + neccode;
	    for (i = 0; i < necpostT[4].length; i++) {
	        k += "|" + necpostT[4][i];
	    }
	    k += "}}";
	}


	$(document.editform.wpTextbox1).val(k);
}


function necCleanLangCode(lang) // taken from wt:edit
{
	var key = lang.toLowerCase().replace(' ', '');

	var dict = {
		aar: "aa",
		afar: "aa",
		abk: "ab",
		abkhazian: "ab",
		afr: "af",
		afrikaans: "af",
		aka: "ak",
		akan: "ak",
		amh: "am",
		amharic: "am",
		ara: "ar",
		arabic: "ar",
		arg: "an",
		aragonese: "an",
		asm: "as",
		assamese: "as",
		ava: "av",
		avaric: "av",
		ave: "ae",
		avestan: "ae",
		aym: "ay",
		aymara: "ay",
		aze: "az",
		azerbaijani: "az",
		bak: "ba",
		bashkir: "ba",
		bam: "bm",
		bambara: "bm",
		bel: "be",
		belarusian: "be",
		ben: "bn",
		bengali: "bn",
		bis: "bi",
		bislama: "bi",
		bod: "bo",
		tibetan: "bo",
		bos: "bs",
		bosnian: "bs",
		bre: "br",
		breton: "br",
		bul: "bg",
		bulgarian: "bg",
		cat: "ca",
		catalan: "ca",
		ces: "cs",
		czech: "cs",
		cha: "ch",
		chamorro: "ch",
		che: "ce",
		chechen: "ce",
		chu: "cu",
		churchslavic: "cu",
		chv: "cv",
		chuvash: "cv",
		cor: "kw",
		cornish: "kw",
		cos: "co",
		corsican: "co",
		cre: "cr",
		cree: "cr",
		cym: "cy",
		welsh: "cy",
		dan: "da",
		danish: "da",
		deu: "de",
		german: "de",
		div: "dv",
		dhivehi: "dv",
		dzo: "dz",
		dzongkha: "dz",
		ell: "el",
		greek: "el",
		eng: "en",
		english: "en",
		epo: "eo",
		esperanto: "eo",
		est: "et",
		estonian: "et",
		eus: "eu",
		basque: "eu",
		ewe: "ee",
		fao: "fo",
		faroese: "fo",
		fas: "fa",
		persian: "fa",
		fij: "fj",
		fijian: "fj",
		fin: "fi",
		finnish: "fi",
		fra: "fr",
		french: "fr",
		fry: "fy",
		westernfrisian: "fy",
		ful: "ff",
		fulah: "ff",
		gla: "gd",
		scottishgaelic: "gd",
		gle: "ga",
		irish: "ga",
		glg: "gl",
		galician: "gl",
		glv: "gv",
		manx: "gv",
		grn: "gn",
		guarani: "gn",
		guj: "gu",
		gujarati: "gu",
		hat: "ht",
		haitian: "ht",
		hau: "ha",
		hausa: "ha",
		heb: "he",
		hebrew: "he",
		her: "hz",
		herero: "hz",
		hin: "hi",
		hindi: "hi",
		hmo: "ho",
		hirimotu: "ho",
		hrv: "hr",
		croatian: "hr",
		hun: "hu",
		hungarian: "hu",
		hye: "hy",
		armenian: "hy",
		ibo: "ig",
		igbo: "ig",
		ido: "io",
		iii: "ii",
		sichuanyi: "ii",
		iku: "iu",
		inuktitut: "iu",
		ile: "ie",
		interlingue: "ie",
		ina: "ia",
		interlingua: "ia",
		ind: "id",
		indonesian: "id",
		ipk: "ik",
		inupiaq: "ik",
		isl: "is",
		icelandic: "is",
		ita: "it",
		italian: "it",
		jav: "jv",
		javanese: "jv",
		jpn: "ja",
		japanese: "ja",
		kal: "kl",
		kalaallisut: "kl",
		kan: "kn",
		kannada: "kn",
		kas: "ks",
		kashmiri: "ks",
		kat: "ka",
		georgian: "ka",
		kau: "kr",
		kanuri: "kr",
		kaz: "kk",
		kazakh: "kk",
		khm: "km",
		centralkhmer: "km",
		kik: "ki",
		kikuyu: "ki",
		kin: "rw",
		kinyarwanda: "rw",
		kir: "ky",
		kirghiz: "ky",
		kom: "kv",
		komi: "kv",
		kon: "kg",
		kongo: "kg",
		kor: "ko",
		korean: "ko",
		kua: "kj",
		kuanyama: "kj",
		kur: "ku",
		kurdish: "ku",
		lao: "lo",
		lat: "la",
		latin: "la",
		lav: "lv",
		latvian: "lv",
		lim: "li",
		limburgan: "li",
		lin: "ln",
		lingala: "ln",
		lit: "lt",
		lithuanian: "lt",
		ltz: "lb",
		luxembourgish: "lb",
		lub: "lu",
		lubakatanga: "lu",
		lug: "lg",
		ganda: "lg",
		mah: "mh",
		marshallese: "mh",
		mal: "ml",
		malayalam: "ml",
		mar: "mr",
		marathi: "mr",
		mkd: "mk",
		macedonian: "mk",
		mlg: "mg",
		malagasy: "mg",
		mlt: "mt",
		maltese: "mt",
		mon: "mn",
		mongolian: "mn",
		mri: "mi",
		maori: "mi",
		msa: "ms",
		malay: "ms",
		mya: "my",
		burmese: "my",
		nau: "na",
		nauru: "na",
		nav: "nv",
		navajo: "nv",
		nbl: "nr",
		southndebele: "nr",
		nde: "nd",
		northndebele: "nd",
		ndo: "ng",
		ndonga: "ng",
		nep: "ne",
		nepali: "ne",
		nld: "nl",
		dutch: "nl",
		nno: "nn",
		norwegiannynorsk: "nn",
		nob: "nb",
		norwegianbokmal: "nb",
		nor: "no",
		norwegian: "no",
		nya: "ny",
		nyanja: "ny",
		oci: "oc",
		occitan: "oc",
		oji: "oj",
		ojibwa: "oj",
		ori: "or",
		oriya: "or",
		orm: "om",
		oromo: "om",
		oss: "os",
		ossetian: "os",
		pan: "pa",
		panjabi: "pa",
		pli: "pi",
		pali: "pi",
		pol: "pl",
		polish: "pl",
		por: "pt",
		portuguese: "pt",
		pus: "ps",
		pushto: "ps",
		que: "qu",
		quechua: "qu",
		roh: "rm",
		romansh: "rm",
		ron: "ro",
		romanian: "ro",
		run: "rn",
		rundi: "rn",
		rus: "ru",
		russian: "ru",
		sag: "sg",
		sango: "sg",
		san: "sa",
		sanskrit: "sa",
		sin: "si",
		sinhala: "si",
		slk: "sk",
		slovak: "sk",
		slv: "sl",
		slovenian: "sl",
		sme: "se",
		northernsami: "se",
		smo: "sm",
		samoan: "sm",
		sna: "sn",
		shona: "sn",
		snd: "sd",
		sindhi: "sd",
		som: "so",
		somali: "so",
		sot: "st",
		southernsotho: "st",
		spa: "es",
		spanish: "es",
		sqi: "sq",
		albanian: "sq",
		srd: "sc",
		sardinian: "sc",
		srp: "sr",
		serbian: "sr",
		ssw: "ss",
		swati: "ss",
		sun: "su",
		sundanese: "su",
		swa: "sw",
		swahili: "sw",
		swe: "sv",
		swedish: "sv",
		tah: "ty",
		tahitian: "ty",
		tam: "ta",
		tamil: "ta",
		tat: "tt",
		tatar: "tt",
		tel: "te",
		telugu: "te",
		tgk: "tg",
		tajik: "tg",
		tgl: "tl",
		tagalog: "tl",
		tha: "th",
		thai: "th",
		tir: "ti",
		tigrinya: "ti",
		ton: "to",
		tonga: "to",
		tsn: "tn",
		tswana: "tn",
		tso: "ts",
		tsonga: "ts",
		tuk: "tk",
		turkmen: "tk",
		tur: "tr",
		turkish: "tr",
		twi: "tw",
		uig: "ug",
		uighur: "ug",
		ukr: "uk",
		ukrainian: "uk",
		urd: "ur",
		urdu: "ur",
		uzb: "uz",
		uzbek: "uz",
		ven: "ve",
		venda: "ve",
		vie: "vi",
		vietnamese: "vi",
		vol: "vo",
		volapuk: "vo",
		wln: "wa",
		walloon: "wa",
		wol: "wo",
		wolof: "wo",
		xho: "xh",
		xhosa: "xh",
		yid: "yi",
		yiddish: "yi",
		yor: "yo",
		yoruba: "yo",
		zha: "za",
		zhuang: "za",
		zho: "zh",
		chinese: "zh",
		zul: "zu",
		zulu: "zu"
	};

	return dict[key];
}


function necfunction4() {
	if (!neccode) {
		neccode = '';
	}

	if (neccode && necinfls[neccode] && necinfls[neccode][necdata.pos] != undefined && necinfls[neccode][necdata.pos][2] != undefined) {
		necfunction5(necinfls[neccode][necdata.pos]);
	} else {
		var qq = neccode + "-" + necdata.pos + '2';
		var xx = "<span class=msgfornonnewbies ";

		if (necinputadvanced) {
			xx += "style='font-weight:bold' ";
		}

		xx += "><br>Bi koda wîkiyê binivîse: <input type=text value='" + necinputadvanced + "' onKeyUp=\"necinputadvanced=this.value;if (this.value){this.parentNode.style.fontWeight='bold'}else{this.parentNode.style.fontWeight=''};necfunction()\" /></span>";
		document.getElementById("necinfls").innerHTML = xx;
		necfunction();
	}
}


function necfunction5(a) {
	/* INFLECTION OPTIONS */

	var q = "";
	for (var r = 0; r < a.length; ++r) {
		if (r <= 1) {
			continue;
		}
		var qq = neccode + "-" + necdata.pos + r;
		if (necdata[qq] == undefined) {
			if (a[r][2][0][0] == 'input') {
				necdata[qq] = '';
			} else {
				necdata[qq] = a[r][2][0][0];
			}
		}
		q += "<br>" + a[r][0] + ": ";

		for (i = 0; i < a[r][2].length; ++i) {
			if (a[r][2][i][0] != 'input') {
				q += "<a href=javascript: id='necinput" + qq + a[r][2][i][0] + "' onclick=\"";
				if (a[r][2][i][2]) {
					q += a[r][2][i][2] + ";";
				}
				q += "necdata[\'" + qq + "\']=\'" + a[r][2][i][0] + "\';necfunction4();necfunction()\">" + a[r][2][i][0] + "</a>";
				if (i != a[r][2].length - 1) {
					q += ", ";
				}
			} else {
				q += "<span id='necinput" + qq;
				if (necdata[qq] != "Advanced" && necfunction7(a[r][2], necdata[qq]) == false) {
					q += necdata[qq];
				}
				q += "'>" + a[r][2][i][1] + "<input type=text value='' id='";
				q += neccode + "-" + necdata.pos + "-" + r + "-" + i;
				q += "' onKeyUp=";
				if (a[r][2][i][4]) {
					q += a[r][2][i][4] + ";";
				}

				q += "necfunction6('" + qq + "','" + neccode + "-" + necdata.pos + "-" + r + "-" + i + "');";

				q += "necfunction() /></span>";
				if (i != a[r][2].length - 1) {
					q += ", ";
				}
			}
		}


		/* ADVANCED OPTIONS */
		if (r == 2) {
			q += "<br><span id='necinput" + qq + "Advanced' class=msgfornonnewbies><span style=font-weight:normal></span>Bi koda wîkiyê binivîse: <input type=text value='" + necinputadvanced + "' onKeyUp=necinputadvanced=this.value;document.getElementById('necinput" + qq + "'+necdata['" + qq + "']).style.fontWeight='';necdata['" + qq + "']='Advanced';document.getElementById('necinput" + qq + "'+necdata['" + qq + "']).style.fontWeight='bold';necfunction() /></span>";
		}
	}

	document.getElementById("necinfls").innerHTML = q;


	for (var r = 0; r < a.length; ++r) {
		if (r <= 1) {
			continue;
		}

		var qq = neccode + "-" + necdata.pos + r;
		document.getElementById('necinput' + qq + necdata[qq]).style.fontWeight = 'bold';

		if (document.getElementById('necinput' + qq + necdata[qq]).childNodes[1] && necdata[qq] != 'Advanced' && necfunction7(a[r][2], necdata[qq]) == false) {
			document.getElementById('necinput' + qq + necdata[qq]).childNodes[1].value = necdata[qq];
		}
	}
}


function necdefupdate() {
	/* DEFINITIONS */
	var def = "<input class='unselectable' type='button' name='PasteOver' value='[[ + ]]' onmousedown='wikilinkText(); return false'><input class='unselectable' type='button' name='PasteOver' value='|' onmousedown='wikiPipe(); return false'><input class='unselectable' type='button' name='PasteOver' value='{{ + }}' onmousedown='wikiText(); return false'><br>";
    for (i = 0; i < necdefs.length; i++) {
        def += "Mane: <input size=70 type=text value='" + necdefs[i][0] + "' onKeyUp=necdefs[" + i + "][0]=this.value;necfunction() />";
        if (i > 0) {
            def += "<a href=javascript:necdefs.splice(" + i + ",1);uNec() title='Maneyê jê bibe'> (–)</a>";
        }
        def += "<br><span style='padding-left:40px;'></span><a href=javascript:necdefs[" + i + "][1].push(['','','']);uNec() title='Mînakekê lê zêde bike'> (+mînak)</a><a href=javascript:necdefs[" + i + "][2].push(['','','','','','','','','','']);uNec() title='Jêgirtinekê lê zêde bike'> (+jêgirtin)</a><a href=javascript:necdefs[" + i + "][3].push(['']);uNec();document.getElementById('necinputH" + i + "').focus() title='Hevmane lê zêde bike'> (+hevmane)</a><a href=javascript:necdefs[" + i + "][5].push(['']);uNec();document.getElementById('necinputD" + i + "').focus() title='Dijmane lê zêde bike'> (+dijmane)</a><a href=javascript:necdefs[" + i + "][4].push(['']);uNec();document.getElementById('necinputE" + i + "').focus() title='Etîketek lê zêde bike'> (+etîket)</a>";

		if (necdefs[i][3].length > 0){//hevmane
			def += "<br><span style='padding-left:50px;'>Hevmane: </span>";		
	    	for (l = 0; l < necdefs[i][3].length; l++) { 
				def += "<input type=text id='necinputH"+ l +"' size=10 value='" + necdefs[i][3][l][0] + "' onKeyUp=necdefs[" + i + "][3][" + l + "][0]=this.value;necfunction() />";
				
				if (necdefs[i][3].length > 1){
					def += ", ";
				}	
	        }
			def += "<a href=javascript:necdefs[" + i + "][3].push(['']);uNec();document.getElementById('necinputH" + l + "').focus() title='Hevmaneyekê lê zêde bike'> (+)</a>";
			def += "<a href=javascript:necdefs[" + i + "][3].splice(" + (necdefs[i][3].length - 1) + ",1);uNec() title='Hevmaneyê jê bibe'> (–)</a>";
				
		}
 
		if (necdefs[i][5].length > 0){//dijmane
			def += "<br><span style='padding-left:50px;'>Dijmane: </span>";		
	    	for (l = 0; l < necdefs[i][5].length; l++) { 
				def += "<input type=text id='necinputD"+ l +"' size=10 value='" + necdefs[i][5][l][0] + "' onKeyUp=necdefs[" + i + "][5][" + l + "][0]=this.value;necfunction() />";
				
				if (necdefs[i][5].length > 1){
					def += ", ";
				}	
	        }
			def += "<a href=javascript:necdefs[" + i + "][5].push(['']);uNec();document.getElementById('necinputD" + l + "').focus() title='Dijmaneyekê lê zêde bike'> (+)</a>";
			def += "<a href=javascript:necdefs[" + i + "][5].splice(" + (necdefs[i][5].length - 1) + ",1);uNec() title='Dijmaneyê jê bibe'> (–)</a>";
				
		}        

		if (necdefs[i][4].length > 0){//etîket
			def += "<br><span style='padding-left:50px;'>Etîket: </span>";		
	    	for (l = 0; l < necdefs[i][4].length; l++) { 
				def += "<input type=text id='necinputE"+ l +"' size=10 value='" + necdefs[i][4][l][0] + "' onKeyUp=necdefs[" + i + "][4][" + l + "][0]=this.value;necfunction() />";
				
				if (necdefs[i][4].length > 1){
					def += ", ";
				}	
	        }
			def += "<a href=javascript:necdefs[" + i + "][4].push(['']);uNec();document.getElementById('necinputE" + l + "').focus() title='Etîketekê lê zêde bike'> (+)</a>";
			def += "<a href=javascript:necdefs[" + i + "][4].splice(" + (necdefs[i][4].length - 1) + ",1);uNec() title='Etîketê jê bibe'> (–)</a>";
				
		}  
 
        for (l = 0; l < necdefs[i][1].length; l++) { //Exemple
            def += "<br><span style='padding-left:30px;'>Mînak: </span><input type=text size=100 value='" + necdefs[i][1][l][0] + "' onKeyUp=necdefs[" + i + "][1][" + l + "][0]=this.value;necfunction() /><a href=javascript:necdefs[" + i + "][1].splice(" + l + ",1);uNec() title='Mînakê jê bibe'> (–)</a>";
            if (neccode != "ku") {
 				if ((new LangMetadata()).guessScript(neccode) != 'Latn') {
					def += "<br><span style='padding-left:60px;'>Transliterasyon: </span><input type=text size=100 value='" + necdefs[i][1][l][1] + "' onKeyUp=necdefs[" + i + "][1][" + l + "][1]=this.value;necfunction() />";
				}
            	
                def += "<br><span style='padding-left:60px;'>Wergera mînakê: </span><input type=text size=100 value='" + necdefs[i][1][l][2] + "' onKeyUp=necdefs[" + i + "][1][" + l + "][2]=this.value;necfunction() />";
            }
        }

  
        for (l = 0; l < necdefs[i][2].length; l++) { //jêgirtin
            var x = ['Şablon', 'Nivîskar', 'Sernav', 'Weşanxane', 'Rûpel', 'Malper/Hejmar/ISBN', 'URL', 'Sal'];
            var z = [10, 30, 50, 30, 10, 50, 55, 10]; //mides
            def += "<br>";
            for (var y = 0; y < x.length; y++) {
                def += "<span style='padding-left:30px;'>" + x[y] + ": <input type=text size=" + z[y] + " value='" + necdefs[i][2][l][y] + "' onKeyUp=necdefs[" + i + "][2][" + l + "][" + y + "]=this.value;necfunction() /><br> ";
            }
            def += "</span><br><span style='padding-left:30px;'>Jêgirtin: <input type=text size=100 value='" + necdefs[i][2][l][8] + "' onKeyUp=necdefs[" + i + "][2][" + l + "][8]=this.value;necfunction() /><a href=javascript:necdefs[" + i + "][2].splice(" + l + ",1);uNec() title='Jêgirtinê jê bibe'>(–)</a>";
            if (neccode != "ku") {
                def += "<br><span style='padding-left:60px;'>Wergera jêgirtinê: </span><input type=text size=100 value='" + necdefs[i][2][l][9] + "' onKeyUp=necdefs[" + i + "][2][" + l + "][9]=this.value;necfunction() />";
            }
        }
       
		def += "<br>";
	}
	document.getElementById('necdefs').innerHTML = def;
}


function necpostbox(q) {
	if (q != undefined) {
		if ((q > 3 && q <= 6) || q == 14 || q == 15 || q == 16) {
			necpost[q][necpost[q].length] = ['', ''];
		} else if ((q > 6 && q < 13)) {
			necpost[q][necpost[q].length] = '';
		} else {
			necpost[q] = '';
		}
	}
	var m = "";

	/* USAGE NOTES, INFLECTION TABLES */
	for (o = 0; o <= 3; o++) {
		if (necpost[o] != undefined) {
			m += "<span style='padding-left:30px;'>" + necheadingorder[o] + ": <a href=javascript:necpost[" + o + "]=undefined;";
/*			if (!o) {
				m += "document.getElementById('necquotbutton').style.fontWeight='';";
			}*/
			m += "necpostbox();necfunction() title='Vê beşê jê bibe'>(jê bibe)</a></span><br><span style='padding-left:60px;'><textarea onKeyUp=necpost[" + o + "]=this.value;necfunction()>" + necpost[o] + "</textarea></span><br>";
		}
	}
	/* NYMS */
	for (o = 4; o < 7; o++) {
		if (necpost[o][0] != undefined) {
			m += "<span style='padding-left:30px;'>" + necheadingorder[o] + ": <a id=nec" + necheadingorder[o] + "button  href=javascript:necpost[" + o + "][necpost[" + o + "].length]=['',''];necpostbox();necfunction() title=' vê beşê lê zêde bike'>(lê zêde bike)</a></span><br>";
		} else if (o == 5) {
			document.getElementById('necSynonymsbutton').style.fontWeight = '';
		}

		for (i = 0; i < necpost[o].length; ++i) {
			m += "<span style='padding-left:60px;'>Mane: <input type=text value='" + necpost[o][i][0] + "' onKeyUp=necpost[" + o + "][" + i + "][0]=this.value;necfunction() /> " + necheadingorder[o] + ": ";
			for (var u = 0; u < necpost[o][i].length; ++u) {
				if (u != 0) {
					if (u != 1) {
						m += ", ";
					}
					m += "<input type=text size=5 value='" + necpost[o][i][u] + "' onKeyUp=necpost[" + o + "][" + i + "][" + u + "]=this.value;necfunction() />";
				}
			}
			m += "<a href=javascript:necpost[" + o + "][" + i + "].push('');necpostbox();necfunction() title='" + necheadingorder[o] + " lê zêde bike'> (+)</a>";
			if (necpost[o][i].length > 2) {
				m += "<a href=javascript:necpost[" + o + "][" + i + "].splice(" + (necpost[o][i].length - 1) + ",1);necpostbox();necfunction() title='" + necheadingorder[o] + " jê bibe'> (–)</a>";
			}
			m += "<a href=javascript:necpost[" + o + "].splice(" + i + ",1);necpostbox();necfunction() title='Vê beşê jê bibe'> (jê bibe)</a><br>";
		}
		if (o == 10) {
			o = 12;
		}
	}

	/* DERIVED TERMS, RELATED TERMS, SEE ALSO, EXTERNAL LINKS */
	for (o = 7; o <= 12; o++) {
		if (necpost[o][0] != undefined) {
			m += "<span style='padding-left:30px;'>" + necheadingorder[o] + ": <a href=javascript:necpost[" + o + "].push('');necpostbox();necfunction()>(nû)</a></span><br>";
		}

		for (i = 0; i < necpost[o].length; ++i) {
			m += "<span style='padding-left:60px;'><input type=text value='" + necpost[o][i] + "' onKeyUp=necpost[" + o + "][" + i + "]=this.value;necfunction() /><a href=javascript:necpost[" + o + "].splice(" + i + ",1);necpostbox();necfunction() title='Jê bibe'>(–)</a><br>";
		}
		if (o == 12) {
			o = 15
		}
	}

	/* DESCENDANTS */

	if (necpost[14][0] != undefined) {
		m += "<span style='padding-left:30px;'>" + necheadingorder[14] + ": <a href=javascript:necpost[14].push(['','']);necpostbox();necfunction() title='Dûndeyeke nû lê zêde bike'>(nû)</a></span><br>";
	}

	for (i = 0; i < necpost[14].length; ++i) {
		m += "<span style='padding-left:60px;'>Koda zimanî: <input type=text value='" + necpost[14][i][0] + "' onKeyUp=necpost[14][" + i + "][0]=this.value;necfunction() onblur=if (necCleanLangCode(this.value)){this.value=necCleanLangCode(this.value)};necpost[14][" + i + "][0]=this.value;necfunction() /> Peyv: <input type=text value='" + necpost[14][i][1] + "' onKeyUp=necpost[14][" + i + "][1]=this.value;necfunction() /><a href=javascript:necpost[14].splice(" + i + ",1);necpostbox();necfunction() title='Jê bibe'>(–)</a><br>";
	}
	/* Bi zaravayên din */

	if (necpost[15][0] != undefined) {
		m += "<span style='padding-left:30px;'>" + necheadingorder[15] + ": <a href=javascript:necpost[15].push(['','']);necpostbox();necfunction() title='Zaravayeke nû lê zêde bike'>(nû)</a></span><br>";
	}

		for (i = 0; i < necpost[15].length; ++i) {
			m += "<span style='padding-left:60px;'>Koda zimanî: <input type=text value='" + necpost[15][i][0] + "' onKeyUp=necpost[15][" + i + "][0]=this.value;necfunction() title='ckb ji bo Soranî, zza ji bo Zazakî, lki ji bo Lekî, sdh ji bo Kurdiya başûrî (Kelhûrî, Feylî, Kirmaşanî, Şêxbizinî)'/> " + necheadingorder[15] + ": ";
			for (var u = 0; u < necpost[15][i].length; ++u) {
				if (u != 0) {
					if (u != 1) {
						m += ", ";
					}
					m += "<input type=text size=5 value='" + necpost[15][i][u] + "' onKeyUp=necpost[15][" + i + "][" + u + "]=this.value;necfunction() />";
				}
			}
			m += "<a href=javascript:necpost[15][" + i + "].push('');necpostbox();necfunction() title='Wergereke din lê zêde bike'> (+)</a>";
			if (necpost[15][i].length > 2) {
				m += "<a href=javascript:necpost[15][" + i + "].splice(" + (necpost[15][i].length - 1) + ",1);necpostbox();necfunction() title='Vê wergerê jê bibe'> (–)</a>";
			}
			m += "<a href=javascript:necpost[15].splice(" + i + ",1);necpostbox();necfunction() title='Vî zimanî jê bibe'> (jê bibe)</a><br>";
		}


	/* TRANSLATIONS */

	if (necpost[16][0] != undefined) {
			m += "<span style='padding-left:30px;'>" + necheadingorder[16] + ": <a id=nec" + necheadingorder[16] + "button  href=javascript:necpost[16][necpost[16].length]=['',''];necpostbox();necfunction() title='Zimanekî din lê zêde bike'>(zimanekî din +)</a></span><br>";
		}

		for (i = 0; i < necpost[16].length; ++i) {
			m += "<span style='padding-left:60px;'>Koda zimanî: <input type=text value='" + necpost[16][i][0] + "' onKeyUp=necpost[16][" + i + "][0]=this.value;necfunction() /> " + necheadingorder[16] + ": ";
			for (var u = 0; u < necpost[16][i].length; ++u) {
				if (u != 0) {
					if (u != 1) {
						m += ", ";
					}
					m += "<input type=text size=5 value='" + necpost[16][i][u] + "' onKeyUp=necpost[16][" + i + "][" + u + "]=this.value;necfunction() />";
				}
			}
			m += "<a href=javascript:necpost[16][" + i + "].push('');necpostbox();necfunction() title='Wergereke din lê zêde bike'> (+)</a>";
			if (necpost[16][i].length > 2) {
				m += "<a href=javascript:necpost[16][" + i + "].splice(" + (necpost[16][i].length - 1) + ",1);necpostbox();necfunction() title='Vê wergerê jê bibe'> (–)</a>";
			}
			m += "<a href=javascript:necpost[16].splice(" + i + ",1);necpostbox();necfunction() title='Vî zimanî jê bibe'> (jê bibe)</a><br>";
		}
	
	document.getElementById('necpostbox').innerHTML = m;
}


function necpostboxT(q) {
	if (q != undefined) {
		if (q == 5 || q == 3 || (q > 6  && q <= 8) || q == 9) {
			necpostT[q][necpostT[q].length] = ['', ''];
		} else if (q == 1 ||q == 0 ||q == 2 || q == 4 || q == 6) {
			necpostT[q][necpostT[q].length] = '';
		} else {
			necpostT[q] = '';
		}
	}
	var n = "";

	/* Hevdeng */
			
	
	if (necpostT[0][0] != undefined) {
		n += "<span style='padding-left:30px;'>Hevdeng: </span>";
		for (i = 0; i < necpostT[0].length; ++i) {
			n +="<input type=text id='inputHevdeng"+ i +"' value='" + necpostT[0][i] + "' onKeyUp=necpostT[0][" + i + "]=this.value;necfunction() />";
				if (necpostT[0].length > 1) {
					n += ", ";
				}
		}
			n += "<a href=javascript:necpostT[0].splice(" + (necpostT[0].length - 1) + ",1);necpostboxT();necfunction() title='Hevdengê jê bibe'> (–) </a>";
			n += "<a href=javascript:necpostT[0].push('');necpostboxT();necfunction();document.getElementById('inputHevdeng" + i + "').focus() title='Hevdenga din lê zêde bike'> (+)</a>";

			n += "<br>";
	}

	/* IPA */
	
	if (necpostT[1][0] != undefined) {
		for (i = 0; i < necpostT[1].length; ++i) {
			n += "<span style='padding-left:30px;'>IPA:<input type=text value='" + necpostT[1][i] + "' onKeyUp=necpostT[1][" + i + "]=this.value;necfunction() /><a href=javascript:necpostT[1].splice(" + i + ",1);necpostboxT();necfunction() title='IPAyê jê bibe'> (–) </a>";
			if (i == 0) {
				n += "<a href=javascript:necpostT[1].push('');necpostboxT();necfunction() title='IPAya din lê zêde bike'> (+IPA nû)</a>";
			}
			n += "</span><br>";
		}
	}

	/* Kîtekirin */
	if (necpostT[2][0] != undefined) {
		n += "<span style='padding-left:30px;'>Kîtekirin: </span>";
		for (i = 0; i < necpostT[2].length; ++i) {
			n +="<input type=text id='inputKîte"+ i +"' value='" + necpostT[2][i] + "' onKeyUp=necpostT[2][" + i + "]=this.value;necfunction() />";
				if (necpostT[2].length > 1) {
					n += ", ";
				}
		}
			n += "<a href=javascript:necpostT[2].splice(" + (necpostT[2].length - 1) + ",1);necpostboxT();necfunction() title='Kîtekirinê jê bibe'> (–) </a>";
			n += "<a href=javascript:necpostT[2].push('');necpostboxT();necfunction();document.getElementById('inputKîte" + i + "').focus() title='Kîteya din lê zêde bike'> (+)</a>";

			n += "<br>";
	}		

	/* Deng */
	
	if (necpostT[3][0] != undefined) {
		for (i = 0; i < necpostT[3].length; ++i) {
			n += "<span style='padding-left:30px;'>Navê dosyeyê:<input type=text value='" + necpostT[3][i][0] + "' onKeyUp=necpostT[3][" + i + "][0]=this.value;necfunction() />  Dever:<input type=text value='" + necpostT[3][i][1] + "' onKeyUp=necpostT[3][" + i + "][1]=this.value;necfunction() /><a href=javascript:necpostT[3].splice(" + i + ",1);necpostboxT();necfunction() title='Dengî jê bibe'> (–)</a>";
			if (i == 0) {
				n += "<a href=javascript:necpostT[3].push(['','']);necpostboxT();necfunction() title='Dengekî nû lê zêde bike'> (+dengê nû)</a>";
			}
			n += "</span><br>";
		}
	}

	/* Kategorî */
	
	if (necpostT[4][0] != undefined) {
		for (i = 0; i < necpostT[4].length; ++i) {
			n += "<span style='padding-left:30px;'>Kategorî:<input type=text value='" + necpostT[4][i] + "' onKeyUp=necpostT[4][" + i + "]=this.value;necfunction() /><a href=javascript:necpostT[4].splice(" + i + ",1);necpostboxT();necfunction() title='Kategoriyê jê bibe'> (–) </a>";
			if (i == 0) {
				n += "<a href=javascript:necpostT[4].push('');necpostboxT();necfunction() title='Kategoriyeke nû lê zêde bike'> (+kategoriya nû) </a>";
			}
			n += "</span><br>";
		}
	}	

	/* Wîkîpediyayê */
	
	if (necpostT[5][0] != undefined) {
		for (i = 0; i < necpostT[5].length; ++i) {
			n += "<span style='padding-left:30px;'>Rûpela Wîkîpediyayê:<input type=text value='" + necpostT[5][i][0] + "' onKeyUp=necpostT[5][" + i + "][0]=this.value;necfunction() /> Rûpela Wîkîferhengê:<input type=text value='" + necpostT[5][i][1] + "' onKeyUp=necpostT[5][" + i + "][1]=this.value;necfunction() /><a href=javascript:necpostT[5].splice(" + i + ",1);necpostboxT();necfunction() title='Şablonê jê bibe'> (–)</a>";
	/*		if (i == 0) {
				n += "<a href=javascript:necpostT[5].push(['','']);necpostboxT();necfunction() title='Wêneyekî nû lê zêde bike'> (+wêneyê nû)</a>";
			}*/
			n += "</span><br>";
		}
	}


	/* Binêre herwiha */
	
	if (necpostT[6][0] != undefined) {
		for (i = 0; i < necpostT[6].length; ++i) {
			n += "<span style='padding-left:30px;'>Binêre:<input type=text value='" + necpostT[6][i] + "' onKeyUp=necpostT[6][" + i + "]=this.value;necfunction() /><a href=javascript:necpostT[6].splice(" + i + ",1);necpostboxT();necfunction() title='Peyvê jê bibe'> (–) </a>";
			if (i == 0) {
				n += "<a href=javascript:necpostT[6].push('');necpostboxT();necfunction() title='lê zêde bike'> (+yekî din) </a>";
			}
			n += "</span><br>";
		}
	}	

	/* Wêne */
	
	if (necpostT[7][0] != undefined) {
		for (i = 0; i < necpostT[7].length; ++i) {
			n += "<span style='padding-left:30px;'>Navê dosyeyê:<input type=text value='" + necpostT[7][i][0] + "' onKeyUp=necpostT[7][" + i + "][0]=this.value;necfunction() />  Sernavê wêneyî:<input type=text value='" + necpostT[7][i][1] + "' onKeyUp=necpostT[7][" + i + "][1]=this.value;necfunction() /><a href=javascript:necpostT[7].splice(" + i + ",1);necpostboxT();necfunction() title='Wêneyî jê bibe'> (–)</a>";
			if (i == 0) {
				n += "<a href=javascript:necpostT[7].push(['','']);necpostboxT();necfunction() title='Wêneyekî nû lê zêde bike'> (+wêneyê nû)</a>";
			}
			n += "</span><br>";
		}
	}

	/* Etîmolojî: [[şablon:ji]] */
	
	if (necpostT[8][0] != undefined) {
		for (i = 0; i < necpostT[8].length; ++i) {
			n += "<span style='padding-left:30px;'>";
			n += "Şablon: <input type=text value='" + necpostT[8][i][0] + "' size=5 onKeyUp=necpostT[8][" + i + "][0]=this.value;necfunction() /> ";
			n += "Zimanê jêder: <input type=text value='" + necpostT[8][i][1] + "' size=5 onKeyUp=necpostT[8][" + i + "][1]=this.value;necfunction() /> ";
			n += "Peyv: <input type=text size=5 value='" + necpostT[8][i][2] + "' onKeyUp=necpostT[8][" + i + "][2]=this.value;necfunction() />" ;
			n += "Mane: <input type=text  size=5 value='" + necpostT[8][i][3] + "' onKeyUp=necpostT[8][" + i + "][3]=this.value;necfunction() />";
			n += "Translîterasyon: <input type=text  size=5 value='" + necpostT[8][i][4] + "' onKeyUp=necpostT[8][" + i + "][4]=this.value;necfunction() />";
			n += "<a href=javascript:necpostT[8].splice(" + i + ",1);necpostboxT();necfunction() title='Şablonê jê bibe'> (–)</a>";
			
			if (i == 0) {
				n += "<a href=javascript:necpostT[8].push(['','']);necpostboxT();necfunction() title='Lê zêde bike'> (+)</a>";
			}

			n += "</span><br>";
		}
	}

	/* Etîmolojî: [[şablon:qertaf]] */
	
	if (necpostT[9][0] != undefined) {
		for (i = 0; i < necpostT[9].length; ++i) {
			n += "<span style='padding-left:30px;'>Qertaf #1: <input type=text size=10 value='" + necpostT[9][i][0] + "' onKeyUp=necpostT[9][" + i + "][0]=this.value;necfunction() /> Qertaf #2: <input type=text value='" + necpostT[9][i][1] + "' onKeyUp=necpostT[9][" + i + "][1]=this.value;necfunction() /> Maneya #1: <input type=text size=10 value='" + necpostT[9][i][2] + "' onKeyUp=necpostT[9][" + i + "][2]=this.value;necfunction() /> Maneya #2: <input type=text size=10 value='" + necpostT[9][i][3] + "' onKeyUp=necpostT[9][" + i + "][3]=this.value;necfunction() />TR #1: <input type=text size=10 value='" + necpostT[9][i][4] + "' onKeyUp=necpostT[9][" + i + "][4]=this.value;necfunction() /> TR #2: <input type=text size=10 value='" + necpostT[9][i][5] + "' onKeyUp=necpostT[9][" + i + "][5]=this.value;necfunction() /><a href=javascript:necpostT[9].splice(" + i + ",1);necpostboxT();necfunction() title='Şablonê jê bibe'> (–)</a>";
			if (i == 0) {
				n += "<a href=javascript:necpostT[9].push(['','']);necpostboxT();necfunction() title='Lê zêde bike'> (+)</a>";
			}

			n += "</span><br>";
		}
	}
	
	document.getElementById('necpostboxT').innerHTML = n;
}
function necfunction6(cc, dd) {
	document.getElementById('necinput' + cc + necdata[cc]).style.fontWeight = '';
	necdata[cc] = document.getElementById(dd).value;
	document.getElementById(dd).parentNode.setAttribute('ID', 'necinput' + cc + document.getElementById(dd).value);
	document.getElementById('necinput' + cc + necdata[cc]).style.fontWeight = 'bold';
}


function necfunction7(qw, er) {
	var qwe = false;

	for (var ty in qw) {
		if (er == qw[ty][0]) {
			qwe = true;
		}
	}

	return qwe;
}

function uNec() {
    necdefupdate();
    necfunction();
}

jQuery(document).ready(function necload() {
	if (document.getElementById('necblah')) {
		necfunction2();
		necdefupdate();
		necfunction();
		necfunction4();
		necfunction();
	}
});

function wikilinkText() {
    var sel;
    if (window.getSelection) {
        sel = window.getSelection();
        var activeElement = document.activeElement;
        if (activeElement.nodeName == "TEXTAREA" ||
           (activeElement.nodeName == "INPUT" && activeElement.type.toLowerCase() == "text")) {
               var val = activeElement.value, start = activeElement.selectionStart, end = activeElement.selectionEnd;
               activeElement.value = val.slice(0, start) + '[[' + sel + ']]' + val.slice(end);
        }
	}
}
function wikiText() {
    var sel;
    if (window.getSelection) {
        sel = window.getSelection();
        var activeElement = document.activeElement;
        if (activeElement.nodeName == "TEXTAREA" ||
           (activeElement.nodeName == "INPUT" && activeElement.type.toLowerCase() == "text")) {
               var val = activeElement.value, start = activeElement.selectionStart, end = activeElement.selectionEnd;
               activeElement.value = val.slice(0, start) + '{{' + sel + '}}' + val.slice(end);
        }
	}
}
function wikiPipe() {
    var sel;
    if (window.getSelection) {
        sel = window.getSelection();
        var activeElement = document.activeElement;
        if (activeElement.nodeName == "TEXTAREA" ||
           (activeElement.nodeName == "INPUT" && activeElement.type.toLowerCase() == "text")) {
               var val = activeElement.value, start = activeElement.selectionStart, end = activeElement.selectionEnd;
               activeElement.value = val.slice(0, start) + '|' + val.slice(end);
        }
	}
}

function LangMetadata() {
  //Singleton
  if (arguments.callee.instance)
    return arguments.callee.instance;
  else
    arguments.callee.instance = this;

  // {{{ Metadata dictionaries
  var metadata = {
    aa: { hw: 1, sc: ["Latn", "Ethi"] }, ab: { hw: 1, sc: ["Cyrl", "Latn", "Geor"] }, aer: { sc: "Latn" }, af: { g: "", hw: 1, p: 1, sc: "Latn" }, ak: { hw: 1 }, akk: { g: "mf", p: 1, sc: "Xsux" }, als: { hw: 1 }, am: { g: "mf", hw: 1, p: 1, sc: "Ethi" }, an: { g: "mf", hw: 1, p: 1, sc: "Latn" }, ang: { alt: 1, g: "mfn", hw: 1, p: 1, sc: "Latn" }, ar: { alt: 1, g: "mf", hw: 1, p: 1, sc: "Arab" }, arc: { g: "mf", p: 1, sc: "Hebr" }, are: { sc: "Latn" }, arz: { alt: 1, g: "mf", p: 1, sc: "Arab" }, as: { hw: 1, sc: "Beng" }, ast: { g: "mf", hw: 1, p: 1, sc: "Latn" }, av: { hw: 1, sc: "Cyrl" }, axm: { alt: 0, g: "", sc: "Armn" }, ay: { hw: 1 }, az: { alt: 0, g: "", hw: 1, p: 1, sc: ["Latn", "Cyrl", "Arab"] },
    ba: { sc: "Cyrl" }, bar: { sc: "Latn" }, "bat-smg": { g: "mf", p: 1, sc: "Latn" }, be: { g: "mfn", hw: 1, p: 1, sc: ["Cyrl", "Latn"] }, "be-x-old": { sc: "Cyrl" }, bg: { g: "mfn", hw: 1, p: 1, sc: "Cyrl" }, bh: { hw: 1, sc: "Deva" }, bhb: { sc: "Deva" }, bi: { hw: 1, sc: "Latn" }, blt: { sc: "Tavt" }, bm: { hw: 1, sc: ["Latn", "Nkoo", "Arab"] }, bn: { g: "", hw: 1, sc: "Beng" }, bo: { hw: 1, sc: "Tibt" }, br: { g: "mf", hw: 1, sc: "Latn" }, bs: { alt: 1, g: "mfn", hw: 1, p: 1, sc: ["Latn"] },
    ca: { g: "mf", hw: 1, p: 1, sc: "Latn" }, cdo: { g: "", p: 0, sc: "Hani" }, ch: { hw: 1, sc: "Latn" }, chr: { hw: 1, sc: "Cher" }, cjy: { g: "", p: 0, sc: "Hani" }, ckb: { sc: "Arab", wsc: "ku-Arab" }, cmn: { g: "", hw: 1, p: 0, sc: "Hani" }, co: { hw: 1, sc: "Latn" }, cpx: { g: "", p: 0, sc: "Hani" }, cr: { hw: 1, sc: "Cans" }, crh: { alt: 0, g: "", sc: "Latn" }, cs: { g: "mfn", hw: 1, p: 1, sc: "Latn" }, csb: { hw: 1 }, cu: { g: "mfn", p: 1, sc: ["Cyrs", "Glag"] }, cv: { alt: 0, g: "", sc: "Cyrl" }, cy: { g: "mf", hw: 1, p: 1, sc: "Latn" }, czh: { g: "", p: 0, sc: "Hani" }, czo: { g: "", p: 0, sc: "Hani" },
    da: { g: "cn", hw: 1, p: 1, sc: "Latn" }, dax: { sc: "Latn" }, de: { g: "mfn", hw: 1, p: 1, sc: "Latn" }, dhg: { sc: "Latn" }, djb: { sc: "Latn" }, dji: { sc: "Latn" }, djr: { sc: "Latn" }, dng: { g: "", p: 0, sc: "Cyrl" }, dsx: { sc: "Latn" }, duj: { sc: "Latn" }, dv: { hw: 1, p: 1, sc: "Thaa" }, dz: { hw: 1, sc: "Tibt" },
    el: { g: "mfn", hw: 1, p: 1, sc: "Grek" }, en: { g: "", hw: 1, p: 1, sc: "Latn" }, eo: { g: "", hw: 1, p: 1, sc: "Latn" }, es: { alt: 0, g: "mf", hw: 1, p: 1, sc: "Latn" }, et: { alt: 0, g: "", hw: 1, p: 1, sc: "Latn" }, ett: { p: 1, sc: "Ital" }, eu: { alt: 0, g: "", hw: 1, p: 1, sc: "Latn" },
    fa: { g: "", hw: 1, sc: "Arab", wsc: "fa-Arab" }, fi: { g: "", hw: 1, p: 1, sc: "Latn" }, fil: { g: "", p: 0, sc: "Latn" }, fj: { hw: 1, sc: "Latn" }, fo: { g: "mfn", hw: 1, sc: "Latn" }, fr: { alt: 0, g: "mf", hw: 1, p: 1, sc: "Latn" }, frm: { alt: 0, g: "mf", p: 1, sc: "Latn" }, fro: { alt: 0, g: "mf", p: 1, sc: "Latn" }, fy: { hw: 1, sc: "Latn" },
    ga: { g: "mf", hw: 1, p: 1, sc: "Latn" }, gan: { g: "", p: 0, sc: "Hani" }, gd: { g: "mf", hw: 1, p: 1, sc: "Latn" }, gez: { sc: "Ethi" }, gl: { g: "mf", hw: 1, p: 1, sc: "Latn" }, gmy: { sc: "Linb" }, gn: { hw: 1 }, gnn: { sc: "Latn" }, got: { g: "mfn", p: 1, sc: "Goth" }, grc: { g: "mfn", p: 1, sc: "Grek", wsc: "polytonic" }, gu: { g: "mfn", hw: 1, p: 1, sc: "Gujr" }, guf: { sc: "Latn" }, gv: { hw: 1 },
    ha: { hw: 1 }, hak: { g: "", p: 0, sc: "Hani" }, har: { sc: "Ethi" }, he: { alt: 1, g: "mf", hw: 1, p: 1, sc: "Hebr" }, hi: { g: "mf", hw: 1, p: 1, sc: "Deva" }, hif: { sc: ["Latn", "Deva"] }, hit: { sc: "Xsux" }, hr: { alt: 1, g: "mfn", hw: 1, p: 1, sc: ["Latn"] }, hsb: { hw: 1 }, hsn: { g: "", p: 0, sc: "Hani" }, hu: { alt: 0, g: "", hw: 1, p: 1, sc: "Latn" }, hy: { alt: 0, g: "", hw: 1, sc: "Armn" },
    ia: { alt: 0, g: "", hw: 1, sc: "Latn" }, id: { hw: 1, sc: "Latn" }, ie: { alt: 0, g: "", hw: 1, sc: "Latn" }, ik: { hw: 1 }, ike: { sc: "Cans" }, ikt: { sc: "Cans" }, io: { hw: 1 }, is: { alt: 0, g: "mfn", hw: 1, p: 1, sc: "Latn" }, it: { alt: 0, g: "mf", hw: 1, p: 1, sc: "Latn" }, iu: { hw: 1, sc: "Cans" },
    ja: { alt: 0, g: "", hw: 1, p: 0, sc: "Jpan" }, jay: { sc: "Latn" }, jbo: { hw: 1, sc: "Latn" }, jv: { hw: 1 },
    ka: { alt: 0, g: "", hw: 1, sc: "Geor" }, khb: { sc: "Talu" }, kjh: { sc: "Cyrl" }, kk: { alt: 0, g: "", hw: 1, sc: "Cyrl" }, kl: { hw: 1 }, km: { hw: 1, sc: "Khmr" }, kn: { hw: 1, sc: "Knda" }, kmr: { hw: 1, sc: "Latn" }, ko: { alt: 0, g: "", hw: 1, p: 0, sc: "Kore" }, krc: { alt: 0, g: "", p: 1, sc: "Cyrl" }, ks: { hw: 1, sc: ["Arab", "Deva"], wsc: "ks-Arab" }, ku: { hw: 1, sc: "Latn" }, kw: { hw: 1 }, ky: { alt: 0, g: "", hw: 1, sc: "Cyrl" },
    la: { alt: 1, g: "mfn", hw: 1, p: 1, sc: "Latn" }, lb: { hw: 1 }, lez: { sc: "Cyrl" }, li: { hw: 1 }, ln: { hw: 1 }, lo: { alt: 0, g: "", hw: 1, p: 0, sc: "Laoo" }, lt: { alt: 1, g: "mf", hw: 1, p: 1, sc: "Latn" }, lv: { alt: 0, g: "mf", hw: 1, p: 1, sc: "Latn" },
    mg: { hw: 1 }, mh: { hw: 1 }, mi: { alt: 0, g: 0, hw: 1, sc: "Latn" }, mk: { g: "mfn", hw: 1, p: 1, sc: "Cyrl" }, ml: { g: "", hw: 1, sc: "Mlym" }, mn: { alt: 0, g: "", hw: 1, sc: ["Cyrl", "Mong"] }, mnp: { g: "", p: 0, sc: "Hani" }, mo: { hw: 1, sc: "Cyrl" }, mol: { sc: "Cyrl" }, mr: { g: "mfn", hw: 1, sc: "Deva" }, ms: { hw: 1, sc: ["Latn", "Arab"] }, mt: { g: "mf", hw: 1, sc: "Latn" }, mwp: { sc: "Latn" }, my: { hw: 1, sc: "Mymr" },
    na: { hw: 1 }, nah: { hw: 1 }, nan: { g: "", hw: 1, p: 0, sc: "Hani" }, nb: { alt: 0, g: "mfn", hw: 1, p: 1, sc: "Latn" }, nds: { alt: 0, g: "mfn", hw: 1, p: 1, sc: "Latn" }, "nds-de": { alt: 0, g: "mfn", hw: 1, p: 1, sc: "Latn" }, "nds-nl": { alt: 0, g: "mfn", hw: 0, p: 1, sc: "Latn" }, ne: { hw: 1, sc: "Deva" }, nl: { alt: 0, g: "mfn", hw: 1, p: 1, sc: "Latn" }, nn: { alt: 0, g: "mfn", hw: 1, p: 1, sc: "Latn" }, no: { alt: 0, g: "mfn", hw: 1, p: 1, sc: "Latn" }, non: { g: "mfn", p: 1, sc: "Latn" },
    oc: { g: "mf", hw: 1, p: 1, sc: "Latn" }, om: { hw: 1 }, or: { hw: 1, sc: "Orya" }, os: { alt: 0, g: "", sc: "Cyrl" }, osc: { sc: "Ital" }, ota: { sc: "Arab", wsc: "ota-Arab" },
    pa: { g: "mf", hw: 1, p: 1, sc: ["Guru", "Arab"] }, peo: { sc: "Xpeo" }, phn: { sc: "Phnx" }, pi: { hw: 1 }, pjt: { sc: "Latn" }, pl: { g: "mfn", hw: 1, p: 1, sc: "Latn" }, ps: { hw: 1, sc: "Arab", wsc: "ps-Arab" }, pt: { alt: 0, g: "mf", hw: 1, p: 1, sc: "Latn" },
    qu: { hw: 1 },
    rit: { sc: "Latn" }, rm: { g: "mf", hw: 1, sc: "Latn" }, rn: { hw: 1 }, ro: { g: "mfn", hw: 1, p: 1, sc: ["Latn", "Cyrl"] }, "roa-rup": { hw: 1 }, ru: { alt: 1, g: "mfn", hw: 1, p: 1, sc: "Cyrl" }, ruo: { g: "mfn", p: 1, sc: "Latn" }, rup: { g: "mfn", hw: 1, p: 1, sc: "Latn" }, ruq: { g: "mfn", p: 1, sc: "Latn" }, rw: { hw: 1, sc: "Latn" },
    sa: { g: "mfn", hw: 1, p: 1, sc: "Deva" }, sah: { sc: "Cyrl" }, sc: { hw: 1 }, scn: { g: "mf", hw: 1, p: 1, sc: "Latn" }, sco: { sc: "Latn" }, sd: { hw: 1, sc: "Arab", wsc: "sd-Arab" }, sg: { hw: 1 }, sh: { alt: 1, g: "mfn", hw: 1, p: 1, sc: ["Latn", "Cyrl"] }, si: { hw: 1, sc: "Sinh" }, simple: { hw: 1, sc: "Latn" }, sk: { g: "mfn", hw: 1, p: 1, sc: "Latn" }, sl: { alt: 1, g: "mfn", hw: 1, p: 1, sc: "Latn" }, sm: { hw: 1 }, sn: { hw: 1 }, so: { hw: 1 }, spx: { sc: "Ital" }, sq: { alt: 0, g: "mf", hw: 1, sc: "Latn" }, sr: { alt: 1, g: "mfn", hw: 1, p: 1, sc: ["Cyrl"] }, ss: { hw: 1 }, st: { hw: 1 }, su: { hw: 1 }, sux: { sc: "Xsux" }, sv: { alt: 0, g: "cn", hw: 1, p: 1, sc: "Latn" }, sw: { alt: 0, g: "", hw: 1, sc: "Latn" }, syc: { sc: "Syrc" }, syr: { sc: "Syrc" },
    ta: { alt: 0, g: "", hw: 1, sc: "Taml" }, tdd: { sc: "Tale" }, te: { alt: 0, g: "", hw: 1, sc: "Telu" }, tg: { alt: 0, g: "", hw: 1, sc: "Cyrl" }, th: { alt: 0, g: "", hw: 1, p: 0, sc: "Thai" }, ti: { hw: 1, sc: "Ethi" }, tig: { sc: "Ethi" }, tiw: { sc: "Latn" }, tk: { alt: 0, g: "", hw: 1, sc: "Latn" }, tl: { g: "", hw: 1, p: 0, sc: ["Latn", "Tglg"] }, tmr: { sc: "Hebr" }, tn: { hw: 1 }, to: { hw: 1 }, tpi: { hw: 1, sc: "Latn" }, tr: { alt: 1, g: "", hw: 1, p: 1, sc: "Latn" }, ts: { hw: 1 }, tt: { alt: 0, g: "", hw: 1, sc: "Cyrl" }, tw: { hw: 1 },
    ug: { hw: 1, sc: "Arab", wsc: "ug-Arab" }, uga: { sc: "Ugar" }, uk: { g: "mfn", hw: 1, p: 1, sc: "Cyrl" }, ulk: { sc: "Latn" }, ur: { g: "mf", hw: 1, p: 1, sc: "Arab", wsc: "ur-Arab" }, uz: { alt: 0, g: "", hw: 1, sc: "Latn" },
    vi: { g: "", hw: 1, p: 0, sc: "Latn" }, vls: { alt: 0, g: "mfn", hw: 0, p: 1, sc: "Latn" }, vo: { hw: 1 },
    wa: { hw: 1 }, wbp: { sc: "Latn" }, wo: { hw: 1 }, wuu: { g: "", p: 0, sc: "Hani" },
    xae: { sc: "Ital" }, xcl: { alt: 0, g: "", sc: "Armn" }, xcr: { sc: "Cari" }, xfa: { sc: "Ital" }, xh: { hw: 1 }, xlc: { sc: "Lyci" }, xld: { sc: "Lydi" }, xlu: { sc: "Xsux" }, xno: { alt: 0, g: "mf", p: 1, sc: "Latn" }, xrr: { sc: "Ital" }, xst: { sc: "Ethi" }, xum: { sc: "Ital" }, xve: { sc: "Ital" }, xvo: { sc: "Ital" },
    yi: { g: "mfn", hw: 1, p: 1, sc: "Hebr" }, yo: { hw: 1 }, yua: { alt: 1, g: "", p: 1, sc: "Latn" }, yue: { g: "", p: 0, sc: "Hani" },
    za: { hw: 1 }, "zh-classical": { sc: "Hani" }, "zh-min-nan": { hw: 1, sc: "Latn" }, "zh-yue": { sc: "Hani" }, zu: { alt: 1, nc: 1, hw: 1, sc: "Latn"}
  };

  var clean = { aar: "aa", afar: "aa", abk: "ab", abkhazian: "ab", afr: "af", afrikaans: "af", aka: "ak", akan: "ak", amh: "am", amharic: "am", ara: "ar", arabic: "ar", arg: "an", aragonese: "an", asm: "as", assamese: "as", ava: "av", avaric: "av", ave: "ae", avestan: "ae", aym: "ay", aymara: "ay", aze: "az", azerbaijani: "az", bak: "ba", bashkir: "ba", bam: "bm", bambara: "bm", bel: "be", belarusian: "be", ben: "bn", bengali: "bn", bis: "bi", bislama: "bi", bod: "bo", tibetan: "bo", bos: "bs", bosnian: "bs", bre: "br", breton: "br", bul: "bg", bulgarian: "bg", cat: "ca", catalan: "ca", ces: "cs", czech: "cs", cha: "ch", chamorro: "ch", che: "ce", chechen: "ce", chu: "cu", churchslavic: "cu", chv: "cv", chuvash: "cv", cor: "kw", cornish: "kw", cos: "co", corsican: "co", cre: "cr", cree: "cr", cym: "cy", welsh: "cy", dan: "da", danish: "da", deu: "de", german: "de", div: "dv", dhivehi: "dv", dzo: "dz", dzongkha: "dz", ell: "el", greek: "el", eng: "en", english: "en", epo: "eo", esperanto: "eo", est: "et", estonian: "et", eus: "eu", basque: "eu", ewe: "ee", fao: "fo", faroese: "fo", fas: "fa", persian: "fa", fij: "fj", fijian: "fj", fil: "tl", fin: "fi", finnish: "fi", fra: "fr", french: "fr", fry: "fy", westernfrisian: "fy", ful: "ff", fulah: "ff", gla: "gd", scottishgaelic: "gd", gle: "ga", irish: "ga", glg: "gl", galician: "gl", glv: "gv", manx: "gv", grn: "gn", guarani: "gn", guj: "gu", gujarati: "gu", hat: "ht", haitian: "ht", hau: "ha", hausa: "ha", heb: "he", hebrew: "he", her: "hz", herero: "hz", hin: "hi", hindi: "hi", hmo: "ho", hirimotu: "ho", hrv: "hr", croatian: "hr", hun: "hu", hungarian: "hu", hye: "hy", armenian: "hy", ibo: "ig", igbo: "ig", ido: "io", iii: "ii", sichuanyi: "ii", iku: "iu", inuktitut: "iu", ile: "ie", interlingue: "ie", ina: "ia", interlingua: "ia", ind: "id", indonesian: "id", ipk: "ik", inupiaq: "ik", isl: "is", icelandic: "is", ita: "it", italian: "it", jav: "jv", javanese: "jv", jpn: "ja", japanese: "ja", kal: "kl", kalaallisut: "kl", kan: "kn", kannada: "kn", kas: "ks", kashmiri: "ks", kat: "ka", georgian: "ka", kau: "kr", kanuri: "kr", kaz: "kk", kazakh: "kk", khm: "km", centralkhmer: "km", kik: "ki", kikuyu: "ki", kin: "rw", kinyarwanda: "rw", kir: "ky", kirghiz: "ky", kom: "kv", komi: "kv", kon: "kg", kongo: "kg", kor: "ko", korean: "ko", kua: "kj", kuanyama: "kj", kur: "ku", kurdish: "ku", lao: "lo", lat: "la", latin: "la", lav: "lv", latvian: "lv", lim: "li", limburgan: "li", lin: "ln", lingala: "ln", lit: "lt", lithuanian: "lt", ltz: "lb", luxembourgish: "lb", lub: "lu", lubakatanga: "lu", lug: "lg", ganda: "lg", mah: "mh", marshallese: "mh", mal: "ml", malayalam: "ml", mar: "mr", marathi: "mr", mkd: "mk", macedonian: "mk", mlg: "mg", malagasy: "mg", mlt: "mt", maltese: "mt", mon: "mn", mongolian: "mn", mri: "mi", maori: "mi", msa: "ms", malay: "ms", mya: "my", burmese: "my", nau: "na", nauru: "na", lowgerman: "nds", wep: "nds", westphalian: "nds", germanlowgerman: "nds-de", dutchlowsaxon: "nds-nl", act: "nds-nl", achterhoeks: "nds-nl", drt: "nds-nl", drents: "nds-nl", gos: "nds-nl", gronings: "nds-nl", sdz: "nds-nl", sallands: "nds-nl", stl: "nds-nl", stellingwerfs: "nds-nl", twd: "nds-nl", twents: "nds-nl", vel: "nds-nl", veluws: "nds-nl", nav: "nv", navajo: "nv", nbl: "nr", southndebele: "nr", nde: "nd", northndebele: "nd", ndo: "ng", ndonga: "ng", nep: "ne", nepali: "ne", nld: "nl", dutch: "nl", flemish: "nl", nno: "nn", norwegiannynorsk: "nn", nob: "nb", norwegianbokmal: "nb", nor: "no", norwegian: "no", nya: "ny", nyanja: "ny", oci: "oc", occitan: "oc", oji: "oj", ojibwa: "oj", ori: "or", oriya: "or", orm: "om", oromo: "om", oss: "os", ossetian: "os", pan: "pa", panjabi: "pa", pli: "pi", pali: "pi", pol: "pl", polish: "pl", por: "pt", portuguese: "pt", pus: "ps", pushto: "ps", que: "qu", quechua: "qu", roh: "rm", romansh: "rm", ron: "ro", romanian: "ro", run: "rn", rundi: "rn", rus: "ru", russian: "ru", sag: "sg", sango: "sg", san: "sa", sanskrit: "sa", sin: "si", sinhala: "si", slk: "sk", slovak: "sk", slv: "sl", slovenian: "sl", sme: "se", northernsami: "se", smo: "sm", samoan: "sm", sna: "sn", shona: "sn", snd: "sd", sindhi: "sd", som: "so", somali: "so", sot: "st", southernsotho: "st", spa: "es", spanish: "es", sqi: "sq", albanian: "sq", srd: "sc", sardinian: "sc", srp: "sr", serbian: "sr", ssw: "ss", swati: "ss", sun: "su", sundanese: "su", swa: "sw", swahili: "sw", swe: "sv", swedish: "sv", tah: "ty", tahitian: "ty", tam: "ta", tamil: "ta", tat: "tt", tatar: "tt", tel: "te", telugu: "te", tgk: "tg", tajik: "tg", tgl: "tl", tagalog: "tl", tha: "th", thai: "th", tir: "ti", tigrinya: "ti", ton: "to", tonga: "to", tsn: "tn", tswana: "tn", tso: "ts", tsonga: "ts", tuk: "tk", turkmen: "tk", tur: "tr", turkish: "tr", twi: "tw", uig: "ug", uighur: "ug", ukr: "uk", ukrainian: "uk", urd: "ur", urdu: "ur", uzb: "uz", uzbek: "uz", ven: "ve", venda: "ve", vie: "vi", vietnamese: "vi", westflemish: "vls", vol: "vo", volapuk: "vo", wln: "wa", walloon: "wa", wol: "wo", wolof: "wo", xho: "xh", xhosa: "xh", yid: "yi", yiddish: "yi", yor: "yo", yoruba: "yo", zha: "za", zhuang: "za", zho: "zh", chinese: "zh", zul: "zu", zulu: "zu" };
  // }}}

  // FIXME: merge into above
  var a = '{{ar}}', c = '{{zh}}', d = '{{de}}';
  var nesting = {
    ang: '{{en}}',// enm:'English', don't nest English (Encyclopetey)
    gmh: d, goh: d, //gsw: 'German', ksh: 'German', pfl: 'German', sxu: 'German',
    nb: '{{no}}', nn: '{{no}}',
    dsb: '{{wen}}', hsb: '{{wen}}',
    'zh-tw': c, 'zh-cn': c, yue: c, dng: c, gan: c, hak: c, czh: c, cjy: c, cmn: c, mnp: c, cdo: c, nan: c, czo: c, cpx: c, wuu: c, hsn: c, lzh: c,
    arq: a, aao: a, bbz: a, abv: a, shu: a, acy: a, adf: a, avl: a, arz: a, afb: a, ayh: a, acw: a, ayl: a, acm: a, ary: a,
    ars: a, apc: a, ayp: a, acx: a, aec: a, ayn: a, ssh: a, ajp: a, arb: a, apd: a, pga: a, acq: a, abh: a, aeb: a, auz: a
  };

  //Given a language code return a default script code.
  this.guessScript = function (lang) {
    if (metadata[lang]) {
      // enwikt language template? (ur-Arab, polytonic)
      if (metadata[lang].wsc) {
        return metadata[lang].wsc;
      }
      // ISO script code? (Arab, Grek)
      if (metadata[lang].sc) {
        if (typeof metadata[lang].sc == 'object')
          return metadata[lang].sc[0];
        else
          return metadata[lang].sc;
      }
    }

    return false;
  };

}  // end LangMetadata
// </nowiki>