Jump to content

User:Ohconfucius/script/foreigndates.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/*************
***	regex menu framework
*** by [[m:user:Pathoschild]] <tools-static.wmflabs.org/meta/scripts/pathoschild.templatescript>
***	- adds a sidebar menu of user-defined scripts.
*************/
mw.loader.load('//tools-static.wmflabs.org/meta/scripts/pathoschild.templatescript.js&action=raw&ctype=text/javascript');
 
function ohc_template() {

//translate citation templates
	regex(/\{\{[ ]?(?:cita noticia|Article)[ ]?\|/g, '{{cite news|');
	regex(/\{\{[ ]?(?:cita libro|ouvrage)[ ]?\|/g, '{{cite book|');
	regex(/\{\{[ ]?(?:cita|lien) web[ ]?\|/g, '{{cite web|');

	regex(/\|[ ]?(?:obra|périodique)[ ]?=/g, '|work=');
	regex(/\|[ ]?(?:editorial|éditeur)[ ]?=/g, '|publisher=');
	regex(/\|[ ]?agencia[ ]?=/g, '|agency=');
	regex(/\|[ ]?(?:título|titre|titel)[ ]?=/g, '|title=');
	regex(/\|[ ]?(?:co-?|)(?:autor|auteur)[ ]?=/g, '|author=');
	regex(/\|[ ]?(?:nombre|prénom)(\d|)[ ]?=/g, '|first$1=');
	regex(/\|[ ]?(?:apellidos?|nom)(\d|)[ ]?=/g, '|last$1=');
	regex(/\|[ ]?año[ ]?=/g, '|year=');
	regex(/\|[ ]?(?:fecha|en ligne le|datum)[ ]?=/g, '|date=');
	regex(/\|[ ]?(?:fechaacceso|consulté le|zugriff)[ ]?=/g, '|accessdate=');
	regex(/\|[ ]?página(s|)[ ]?=/g, '|page$1=');
	regex(/\|[ ]?(?:idioma|langue)[ ]?=/g, '|language=');
	regex(/\|[ ]?urlarchivo[ ]?=/g, '|archiveurl=');
	regex(/\|[ ]?(?:fechaarchivo)[ ]?=/g, '|archivedate=');

//	regex(/(foo)(bar)/g, '$1$2'); 
//	regex(/(foo)(bar)/g, '$1$2');

}

function ohc_monthname() {
 var	txt=document.editform.wpTextbox1;


	regex(/(\W[012]?\d|30|31)[,\.]? (?:(?:de )?(?:janeiro|enero)(?: del?)?|gener|gennaio|ianuarie|Ionawr|j[au]+[mn][uar]+[tyz]?|јануар|janvier|led(?:en|na)|января|январь|Януари|ocak|stycz(?:eń|nia))\s*(19|20)(\d\d\W)/gi, '$1 January $2$3');
	regex(/(\W[012]?\d)[,\.]? (?:(?:de )?(?:fevereiro|febrero?)(?: del?)?|febbraio|fr?[ae][bnv]e?r?[uy]?[rs]?[aeu]+[rt]?[ituy]?e?|février|Chwefror|февраля|Февруари|фебруар|şubat|luty|února?)\s*(19|20)(\d\d\W)/gi, '$1 February $2$3');
	regex(/(\W[012]?\d|30|31)[,\.]? (?:(?:de )?m[äa]r[çstz][os]?(?: del?)?|ma[rt]*c[adhj]?|martie|марта?|Март|marzec|Mawrth|břez(?:en|na))\s*(19|20)(\d\d\W)/gi, '$1 March $2$3');
	regex(/(\W[012]?\d|30)[,\.]? (?:(?:d[e']\s*)?abril(?: del?)?|a[opv][rt]?i[l;]?i?e?|aprl|апреля|апрель|Април|dub(?:en|na)|Ebrill|nisan|kwiecien|pril)\s*(19|20)(\d\d\W)/gi, '$1 April $2$3');
	regex(/(\W[012]?\d|30|31)[,\.]? (?:(?:de )?ma[ijy][ago]?(?: del?)?|maggio|m[as][ir]?y|mei|ма[jя]|Май|май|mayıs|mya|květ(?:en|na))\s*(19|20)(\d\d\W)/gi, '$1 May $2$3');
	regex(/(\W[012]?\d|30)[,\.]? (?:(?:de )?jun[hi]o?(?: del?)?|giugno|iunie|j?i?u[bn]+[deiw]s?|ju[ei]n|јун|июня|июнь|Юни|haziran|červ(?:en|na)|czerwiec|Mehefin)\s*(19|20)(\d\d\W)/gi, '$1 June $2$3');
	regex(/(\W[012]?\d|30|31)[,\.]? (?:(?:de )?jul[hiy]o?l?(?: del?)?|iulie|j?u[lk]+[ity]|juillet|červen(?:ce|ec)|Gorffennaf|јул|luglio|июля|июль|Юли|temmuz|lipiec)\s*(19|20)(\d\d\W)/gi, '$1 July $2$3');
	regex(/(\W[012]?\d|30|31)[,\.]? (?:(?:de )?agosto?(?: del?)?|ao[ûu]t|as?[uv]?[ins]?[dg][iu]+e?[as]t[eius]*|августа?|ağustos|Awst|sierpie[nń]|srp(?:en|na))\s*(19|20)(\d\d\W)/gi, '$1 August $2$3');
	regex(/(\W[012]?\d|30)[,\.]? (?:(?:de )?(?:septiembre|sep?tembr[eo]|st?em?p[bt]er?m[bhp][ae]r)(?: del?)?|septembrie|settemb[re]+|Сентября|Септември|септембар|сентябрь|eylül|Medi|wrzesien|září)\s*(19|20)(\d\d\W)/gi, '$1 September $2$3');
	regex(/(\W[012]?\d|30|31)[,\.]? (?:(?:d[e']\s*)?(?:octubre|outubro)(?: del?)?|[Óo][ckv]o?[rt]o?[cer]?[bv][aeo]r|octombrie|o[ct]tobre|октября|октобар|октябрь|Октомври|ekim|Hydref|pazdziernik|říj(?:en|na))\s*(19|20)(\d\d\W)/gi, '$1 October $2$3');
	regex(/(\W[012]?\d|30)[,\.]? (?:(?:de )?novi?embr[eo](?: del?)?|noiembrie|[nv]o[iv]*m?er?[mn]e?b[ae]r?|Ноября|ноябрь|Ноември|новембар|kasım|listopadu?|Tachwedd)\s*(19|20)(\d\d\W)/gi, '$1 November $2$3');
	regex(/(\W[012]?\d|30|31)[,\.]? (?:(?:de )?(?:de[csz]embr[eo]|d[éi]ci?embre)(?: del?)?|d?e[csz]m?e?w?mn?b+[ae]r?|d[ec]+mber|decembrie|Decembwe|Disember|grudnia|декабря|декабрь|Декември|децембар|aralık|grudzien|prosin(?:ce|ec)|Rhagfyr)\s*(19|20)(\d\d\W)/gi, '$1 December $2$3');

}

function ohc_dotw() {
 var	txt=document.editform.wpTextbox1;

	regex(/(\|[ ]*(?:date|archivedate|accessdate|author)[ ]*=[ ]*)(?:domingo|lunes|martes|miércoles|jueves|viernes|sábado),?\s/gi, "$1"); //Spanish
	regex(/(\|[ ]*(?:date|archivedate|accessdate|author)[ ]*=[ ]*)(?:(?:Sonn|Mon|Diens|Zies|Donners|Frei|Sams)tag|Mittwoch),?\s/gi, "$1"); //German
	regex(/(\|[ ]*(?:date|archivedate|accessdate|author)[ ]*=[ ]*)(?:Lunes|Martes|Miercules|Huebes|Biernes|Sabado|Domingo),?\s/gi, "$1"); //kampangan
	regex(/(\|[ ]*(?:date|archivedate|accessdate|author)[ ]*=[ ]*)(?:Lunes|Martes|Miyerkules|Huwebes|Biyernes|Sabado|Linggo),?\s/gi, "$1"); //Tagalog
	regex(/(\|[ ]*(?:date|archivedate|accessdate|author)[ ]*=[ ]*)(?:(?:(?:segunda|terça|quarta|quinta|sexta)-feira)sábado|domingo),?\s/gi, "$1"); //portugese
	regex(/(\|[ ]*(?:date|archivedate|accessdate|author)[ ]*=[ ]*)(?:Minggu|Senin|Selasa|Rabu|Kamis|Jumat|Sabtu),?\s/gi, "$1"); //indonesian
	regex(/(\|[ ]*(?:date|archivedate|accessdate|author)[ ]*=[ ]*)(?:Ahad|Isnin|Selasa|Rabu|Khamis|Jumaat|Sabtu),?\s/gi, "$1"); //malay
	regex(/(\|[ ]*(?:date|archivedate|accessdate|author)[ ]*=[ ]*)(?:(?:lun|mar|mercre|jeu|vendre|same)di|dimanche),?\s/gi, "$1");
	regex(/(\|[ ]*(?:date|archivedate|accessdate|author)[ ]*=[ ]*)(?:hétfő|kedd|szerda|csütörtök|péntek|szombat|vasárnap),?\s/gi, "$1"); //Hungarian
	regex(/(\|[ ]*(?:date|archivedate|accessdate|author)[ ]*=[ ]*)(?:maanantai|tiistai|keskiviikko|torstai|perjantai|lauantai|sunnuntai),?\s/gi, "$1"); //Finnish
	regex(/(\|[ ]*(?:date|archivedate|accessdate|author)[ ]*=[ ]*)(?:Pazartesi|Salı|Çarşamba|Perşembe|Cuma|Cumartesi|Pazar),?\s/gi, "$1"); //Turkish
	regex(/(\|[ ]*(?:date|archivedate|accessdate|author)[ ]*=[ ]*)(?:pirmdiena|otrdiena|trešdiena|ceturtdiena|piektdiena|sestdiena|svētdiena),?\s/gi, "$1"); //Latvian
	regex(/(\|[ ]*(?:date|archivedate|accessdate|author)[ ]*=[ ]*)(?:Pirmadienis|Antradienis|Trečiadienis|Ketvirtadienis|Penktadienis|Šeštadienis|Sekmadienis),?\s/gi, "$1"); //Lithuanian
	regex(/(\|[ ]*(?:date|archivedate|accessdate|author)[ ]*=[ ]*)(?:poniedziałek|wtorek|środa|czwartek|piątek|sobota|niedziela),?\s/gi, "$1"); //Polish
	regex(/(\|[ ]*(?:date|archivedate|accessdate|author)[ ]*=[ ]*)(?:pondĕlí|úterý|středa|čtvrtek|pátek|sobota|nedĕle),?\s/gi, "$1"); //Czech
	regex(/(\|[ ]*(?:date|archivedate|accessdate|author)[ ]*=[ ]*)(?:måndag|tisdag|onsdag|torsdag|fredag|lördag|söndag),?\s/gi, "$1"); //Swedish
	regex(/(\|[ ]*(?:date|archivedate|accessdate|author)[ ]*=[ ]*)(?:понедельник|вторник|среда|четверг|пятница|суббота|воскресенье),?\s/gi, "$1"); //Russian

}

function ohc_deutsch() {
 var	txt=document.editform.wpTextbox1;
	regex(/(date[ ]*=[ ]*[012]?\d|30|31)\. Januar (19|20)(\d\d)/gi, '$1 January $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d)\. Februar (19|20)(\d\d)/gi, '$1 February $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31)\. M[äa]rz (19|20)(\d\d)/gi, '$1 March $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30)\. April (19|20)(\d\d)/gi, '$1 April $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31)\. Mai (19|20)(\d\d)/gi, '$1 May $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30)\. Juni (19|20)(\d\d)/gi, '$1 June $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31)\. Juli (19|20)(\d\d)/gi, '$1 July $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31)\. August (19|20)(\d\d)/gi, '$1 August $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30)\. September (19|20)(\d\d)/gi, '$1 September $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31)\. Oktober (19|20)(\d\d)/gi, '$1 October $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30)\. November (19|20)(\d\d)/gi, '$1 November $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31)\. Dezember (19|20)(\d\d)/gi, '$1 December $2$3');


}

function ohc_espanol() {
 var	txt=document.editform.wpTextbox1;

	regex(/(date[ ]*=[ ]*[012]?\d|30|31) de Enero(?: de|,?) (19|20)(\d\d)/gi, '$1 January $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d) de Febrero(?: de|,?) (19|20)(\d\d)/gi, '$1 February $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31) de Marzo(?: de|,?) (19|20)(\d\d)/gi, '$1 March $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30) de Abril(?: de|,?) (19|20)(\d\d)/gi, '$1 April $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31) de Mayo(?: de|,?) (19|20)(\d\d)/gi, '$1 May $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30) de Junio(?: de|,?) (19|20)(\d\d)/gi, '$1 June $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31) de Julio(?: de|,?) (19|20)(\d\d)/gi, '$1 July $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31) de Ago(?:sto|)(?: de|,?) (19|20)(\d\d)/gi, '$1 August $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30) de Septiembre(?: de|,?) (19|20)(\d\d)/gi, '$1 September $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31) de Octubre(?: de|,?) (19|20)(\d\d)/gi, '$1 October $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30) de Noviembre(?: de|,?) (19|20)(\d\d)/gi, '$1 November $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31) de Diciembre(?: de|,?) (19|20)(\d\d)/gi, '$1 December $2$3');


}

function ohc_tagalog() {
 var	txt=document.editform.wpTextbox1;


	regex(/(date[ ]*=[ ]*[012]?\d|30|31) Enero(?: de|,?) (19|20)(\d\d)/gi, '$1 January $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d) Pebrero(?: de|,?) (19|20)(\d\d)/gi, '$1 February $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31) Marso(?: de|,?) (19|20)(\d\d)/gi, '$1 March $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30) Abril(?: de|,?) (19|20)(\d\d)/gi, '$1 April $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31) Mayo(?: de|,?) (19|20)(\d\d)/gi, '$1 May $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30) Hunio(?: de|,?) (19|20)(\d\d)/gi, '$1 June $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31) Hulio(?: de|,?) (19|20)(\d\d)/gi, '$1 July $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31) Agosto(?: de|,?) (19|20)(\d\d)/gi, '$1 August $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30) Septyembre(?: de|,?) (19|20)(\d\d)/gi, '$1 September $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31) Oktubre(?: de|,?) (19|20)(\d\d)/gi, '$1 October $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30) Nobyembre(?: de|,?) (19|20)(\d\d)/gi, '$1 November $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31) Disyembre(?: de|,?) (19|20)(\d\d)/gi, '$1 December $2$3');


}
function ohc_portugues() {
 var	txt=document.editform.wpTextbox1;
// http://www.omniglot.com/language/time/months.htm
	regex(/(date[ ]*=[ ]*[012]?\d|30|31) de janeiro(?: de|,?) (19|20)(\d\d)/gi, '$1 January $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d) de fevereiro(?: de|,?) (19|20)(\d\d)/gi, '$1 February $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31) de março(?: de|,?) (19|20)(\d\d)/gi, '$1 March $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30) de abril(?: de|,?) (19|20)(\d\d)/gi, '$1 April $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31) de maio(?: de|,?) (19|20)(\d\d)/gi, '$1 May $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30) de junho(?: de|,?) (19|20)(\d\d)/gi, '$1 June $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31) de julho(?: de|,?) (19|20)(\d\d)/gi, '$1 July $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31) de ago(?:sto|)(?: de|,?) (19|20)(\d\d)/gi, '$1 August $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30) de setembro(?: de|,?) (19|20)(\d\d)/gi, '$1 September $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31) de outubro(?: de|,?) (19|20)(\d\d)/gi, '$1 October $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30) de novembro(?: de|,?) (19|20)(\d\d)/gi, '$1 November $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31) de dezembro(?: de|,?) (19|20)(\d\d)/gi, '$1 December $2$3');


}

function ohc_francais() {
 var	txt=document.editform.wpTextbox1;

	regex(/(date[ ]*=[ ]*)(?:le |)([012]?\d|30|31) janvier(?: de|,?) (19|20)(\d\d)/gi, '$1$2 January $3$4');
	regex(/(date[ ]*=[ ]*)(?:le |)([012]?\d) f[eé]vrier(?: de|,?) (19|20)(\d\d)/gi, '$1$2 February $3$4');
	regex(/(date[ ]*=[ ]*)(?:le |)([012]?\d|30|31) mars(?: de|,?) (19|20)(\d\d)/gi, '$1$2 March $3$4');
	regex(/(date[ ]*=[ ]*)(?:le |)([012]?\d|30) avril(?: de|,?) (19|20)(\d\d)/gi, '$1$2 April $3$4');
	regex(/(date[ ]*=[ ]*)(?:le |)([012]?\d|30|31) mai(?: de|,?) (19|20)(\d\d)/gi, '$1$2 May $3$4');
	regex(/(date[ ]*=[ ]*)(?:le |)([012]?\d|30) juin(?: de|,?) (19|20)(\d\d)/gi, '$1$2 June $3$4');
	regex(/(date[ ]*=[ ]*)(?:le |)([012]?\d|30|31) juillet(?: de|,?) (19|20)(\d\d)/gi, '$1$2 July $3$4');
	regex(/(date[ ]*=[ ]*)(?:le |)([012]?\d|30|31) aoüt(?: de|,?) (19|20)(\d\d)/gi, '$1$2 August $3$4');
	regex(/(date[ ]*=[ ]*)(?:le |)([012]?\d|30) septembre(?: de|,?) (19|20)(\d\d)/gi, '$1$2 September $3$4');
	regex(/(date[ ]*=[ ]*)(?:le |)([012]?\d|30|31) octobre(?: de|,?) (19|20)(\d\d)/gi, '$1$2 October $3$4');
	regex(/(date[ ]*=[ ]*)(?:le |)([012]?\d|30) novembre(?: de|,?) (19|20)(\d\d)/gi, '$1$2 November $3$4');
	regex(/(date[ ]*=[ ]*)(?:le |)([012]?\d|30|31) d[eé]cembre(?: de|,?) (19|20)(\d\d)/gi, '$1$2 December $3$4');


}

function ohc_turk() {
 var	txt=document.editform.wpTextbox1;

	regex(/(date[ ]*=[ ]*[012]?\d|30|31) Ocak (19|20)(\d\d)/gi, '$1 January $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d) Şubat (19|20)(\d\d)/gi, '$1 February $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31) Mart (19|20)(\d\d)/gi, '$1 March $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30) Nisan (19|20)(\d\d)/gi, '$1 April $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31) Mayıs (19|20)(\d\d)/gi, '$1 May $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30) Haziran (19|20)(\d\d)/gi, '$1 June $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31) Temmuz (19|20)(\d\d)/gi, '$1 July $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31) Ağustos (19|20)(\d\d)/gi, '$1 August $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30) Eylül (19|20)(\d\d)/gi, '$1 September $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31) Ekim (19|20)(\d\d)/gi, '$1 October $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30) Kasım (19|20)(\d\d)/gi, '$1 November $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31) Aralık (19|20)(\d\d)/gi, '$1 December $2$3');

}

function ohc_malayindo() {
 var	txt=document.editform.wpTextbox1;

	regex(/(date[ ]*=[ ]*[012]?\d|30|31)\. Januari (19|20)(\d\d)/gi, '$1 January $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d)\. Februari (19|20)(\d\d)/gi, '$1 February $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31)\. Ma(?:ret|c) (19|20)(\d\d)/gi, '$1 March $2$3');
//	regex(/(date[ ]*=[ ]*[012]?\d|30)\. April (19|20)(\d\d)/gi, '$1 April $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31)\. Mei (19|20)(\d\d)/gi, '$1 May $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30)\. Juni? (19|20)(\d\d)/gi, '$1 June $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31)\. Jula?i (19|20)(\d\d)/gi, '$1 July $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31)\. (?:Agustus|Ogos) (19|20)(\d\d)/gi, '$1 August $2$3');
//	regex(/(date[ ]*=[ ]*[012]?\d|30)\. September (19|20)(\d\d)/gi, '$1 September $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31)\. Oktober (19|20)(\d\d)/gi, '$1 October $2$3');
//	regex(/(date[ ]*=[ ]*[012]?\d|30)\. November (19|20)(\d\d)/gi, '$1 November $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31)\. D[ie]sember (19|20)(\d\d)/gi, '$1 December $2$3');


}
function ohc_cyr() {
 var	txt=document.editform.wpTextbox1;
//includes macedonia (3rd in sequence where diff to Russian)

	regex(/(date[ ]*=[ ]*[012]?\d|30|31) (?:Январь|января|Јануари) (19|20)(\d\d)/gi, '$1 January $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d) (?:Февраль|февраля|Февруари) (19|20)(\d\d)/gi, '$1 February $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31) (?:Март|марта|Март) (19|20)(\d\d)/gi, '$1 March $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30) (?:Апрель|апреля|Април) (19|20)(\d\d)/gi, '$1 April $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31) (?:Май|мая|Мај) (19|20)(\d\d)/gi, '$1 May $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30) (?:Июнь|июня|Јуни) (19|20)(\d\d)/gi, '$1 June $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31) (?:Июль|июля|јули) (19|20)(\d\d)/gi, '$1 July $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31) (?:Август|августа|Август) (19|20)(\d\d)/gi, '$1 August $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30) (?:Сентябрь|сентября|Септември) (19|20)(\d\d)/gi, '$1 September $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31) (?:Октябрь|октября|Октомври) (19|20)(\d\d)/gi, '$1 October $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30) (?:Ноябрь|ноября|Ноември) (19|20)(\d\d)/gi, '$1 November $2$3');
	regex(/(date[ ]*=[ ]*[012]?\d|30|31) (?:Декабрь|декабря|Декември) (19|20)(\d\d)/gi, '$1 December $2$3');


}

function ohc_chinese() {
 var	txt=document.editform.wpTextbox1;

	regex(/(date[ ]*=[ ]*)((?:19|20)\d\d)年(\d)月(\d)日/gi, '$1-0$2-0$3 ');
	regex(/(date[ ]*=[ ]*)((?:19|20)\d\d)年(\d\d)月(\d)日/gi, '$1-$2-0$3 ');
	regex(/(date[ ]*=[ ]*)((?:19|20)\d\d)年(\d)月(\d\d)日/gi, '$1-0$2-$3 ');

	regex(/(<ref[^>]*>^[年<]*[ ])((?:19|20)\d\d)年(\d)月(\d)日(?=[^<]*<\/ref)/gi, '$1-0$2-0$3');
	regex(/(<ref[^>]*>^[年<]*[ ])((?:19|20)\d\d)年(\d\d)月(\d)日(?=[^<]*<\/ref)/gi, '$1-$2-0$3');
	regex(/(<ref[^>]*>^[年<]*[ ])((?:19|20)\d\d)年(\d)月(\d\d)日(?=[^<]*<\/ref)/gi, '$1-0$2-$3');

	regex(/(<ref[^>]*>^[年<]*[ ])((?:19|20)\d\d)年(\d)月(\d)日(?=[^<]*<\/ref)/gi, '$1-0$2-0$3');
	regex(/(<ref[^>]*>^[年<]*[ ])((?:19|20)\d\d)年(\d\d)月(\d)日(?=[^<]*<\/ref)/gi, '$1-$2-0$3');
	regex(/(<ref[^>]*>^[年<]*[ ])((?:19|20)\d\d)年(\d)月(\d\d)日(?=[^<]*<\/ref)/gi, '$1-0$2-$3');

}

function ohc_foreign_dates() {
 var txt=document.editform.wpTextbox1;
//	ohc_monthname();
	ohc_dotw();
	ohc_template();
	ohc_deutsch();
	ohc_espanol();
	ohc_tagalog();
	ohc_portugues();
	ohc_francais();
	ohc_turk();
	ohc_malayindo();
	ohc_cyr();
	ohc_chinese();

}

function ohc_languages_driver() {
 var txt=document.editform.wpTextbox1;
	ohc_foreign_dates();

// Add a tag to the summary box
 var txt=document.editform.wpSummary;
    var summary = "General [[WP:MOS|formatting]]";
	if (txt.value.indexOf(summary) == -1) {
		if (txt.value.match(/[^\*\/\s][^\/\s]?\s*$/)) {
			txt.value += " | ";
		}
		txt.value += summary;
	}
   document.forms.editform.wpMinoredit.checked = true;
   document.editform.wpDiff.click();

}
$(function () {
 if(document.forms.editform) {
  mw.util.addPortletLink('p-tb', 'javascript:ohc_languages_driver()', 'Foreign dates', 'ca-unitfixer', 'Translate foreign dates to English', '', '');
  }
});