குறிப்பு - சேமித்த பின்னர், நீங்கள் செய்த மாற்றங்களைக் காண்பதற்கு உங்கள் உலவியின் இடைமாற்று அகற்றப்பட வேண்டும்.

  • மொஸில்லா பயர்பாக்ஸ் / சபாரி: Shift+Reload, அல்லது Ctrl-F5 அல்லது Ctrl-R (⌘-R Mac ல்)
  • கூகிள் குரோம் Ctrl-Shift-R அழுத்தவும். (⌘-Shift-R Mac ல்) ;
  • இண்டர்நெட் எக்ஸ்ப்ளோரர்: Ctrl-Refresh அல்லது Ctrl-F5 ஐ அழுத்தவும்.
  • ஒபேரா: Tools → Preferences இல் இடைமாற்றை அகற்றவும்;
/**
* Title:Translate Helper for Wikipedia. 
* Description:This tool helps to translate country, languages and get langlinks (aka interwiki titles) from english to tamil.
* @author Mohamed Mahir ([[user:Mahir78]])
* @date 2010-12-26
* Version: 1.0.1
* License: GPLv3, CC-BY-SA 3.0
*/ 

importScript("User:Mdmahir/Array_enta.js");//importScript கைவிடப்பட்டது
importScript("User:Mdmahir/indiapartylist.js");
//mw.loader.load( 'http://www.ta.wikipedia.org/w/index.php?title=User:Mahir78/Array_enta.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400' );
//mw.loader.load( 'http://www.ta.wikipedia.org/w/index.php?title=User:Mahir78/indiapartylist.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400' );

//<script type='text/javascript'>
// ஆங்கில விக்கிப்பீடியாவிலிருந்து நாடுகள் தொடர்பான சொற்கள் கொண்ட கட்டுரைகளை மொழிபெயர்க்க இந்த கருவி உபயோகமாயிருக்கும்.
//Jquery UI can be removed if it is already imported.
//var $=jQuery.noConflict();

// உங்களது கருத்துக்களை உரையாடல் பக்கத்தில் தெரிவிக்கவும்.

function Convert(){

txt=document.getElementById('in').value

for(i=0;i<months.length;i++){
txt=txt.replaceAll(months[i][0], months[i][1]);
}

for(i=0;i<partylist.length;i++){
txt=txt.replaceAll(partylist[i][0], partylist[i][1]);
txt=txt.replaceAll(partylist[i][0], partylist[i][1]);
}

for(i=0;i<countries.length;i++){
try{

//txt=txt.replaceAll(countries[i][1],countries[i][1]);

txt=txt.replaceAll(countries[i][0],countries[i][1]);
word="/[("+countries[i][0]+")\w+\s+\_+\-+\(+\)+]+[\.+]+[(jpg)|(gif)|(svg)]+/";
word="/["+countries[i][0]+"\w+\s+\_+\-+\(+\)+]+[\.+]+[(jpg)|(gif)|(svg)]+/";

txt=txt.replaceAll(eval(word),countries[i][0]);

txt=txt.replaceAll("Demographics of "+ countries[i][1] , countries[i][1]+" மக்கள் தொகையியல்");
txt=txt.replaceAll("History of "+ countries[i][1] , countries[i][1]+" வரலாறு");
txt=txt.replaceAll("Geography of "+ countries[i][1] , countries[i][1]+" புவியியல்");
txt=txt.replaceAll("Divisions of "+ countries[i][1] , countries[i][1]+" கோட்டங்கள்");
txt=txt.replaceAll("Government of "+ countries[i][1] , countries[i][1]+" அரசு");
txt=txt.replaceAll("Politics of "+ countries[i][1] , countries[i][1]+" அரசியல்");
txt=txt.replaceAll("Music of "+ countries[i][1] , countries[i][1]+" இசை");
txt=txt.replaceAll("Culture of "+ countries[i][1] , countries[i][1]+" கலாச்சாரம்");
txt=txt.replaceAll("Economy of "+ countries[i][1] , countries[i][1]+" பொருளாதாரம்");
txt=txt.replaceAll("Education in "+ countries[i][1] , countries[i][1]+" கல்வி");
txt=txt.replaceAll("Tourism in "+ countries[i][1] , countries[i][1]+" சுற்றுலா");

countrieslist.push(countries[i][1]);
}
catch(e){
//alert(i);
}
//txt=txt.replace("[[[[","[[");
//txt=txt.replace("]]]]","]]");
//txt=txt.replace("#[["+countries[i][1]+"]]","#"+countries[i][1]);
}


for(i=0;i<other_var.length;i++){
txt=txt.replaceAll(other_var[i][0], other_var[i][1]);
}

for(i=0;i<countries.length;i++){
try{

//txt=txt.replaceAll(countries[i][1],countries[i][1]);
//தூதரகம் of  கசக்ஸ்தான் in மாஸ்கோ

txt=txt.replaceAll("File:தூதரகம் of "+countries[i][1],"File:Embassy of "+countries[i][0]);
txt=txt.replaceAll(" in "+countries[i][1]," in "+countries[i][0]);
txt=txt.replace("தூதரகம் of "+countries[i][1],countries[i][1]+" தூதரகம்");
txt=txt.replace("தூதரகம் in "+countries[i][0] ,"தூதரகம், "+countries[i][1]);


}
catch(e){
}
}//for
for(i=0;i<indianstates.length;i++){
txt=txt.replaceAll(indianstates[i][0], indianstates[i][1]);

/*txt=txt.replaceAll(indianstates[i][1]+ " Police", indianstates[i][1]+" காவல்துறை");
txt=txt.replaceAll("Demographics of "+ indianstates[i][1] , indianstates[i][1]+" மக்கள் தொகையியல்");
txt=txt.replaceAll("History of "+ indianstates[i][1] , indianstates[i][1]+" வரலாறு");
txt=txt.replaceAll("Geography of "+ indianstates[i][1] , indianstates[i][1]+" புவியியல்");
txt=txt.replaceAll("Divisions of "+ indianstates[i][1] , indianstates[i][1]+" கோட்டங்கள்");
txt=txt.replaceAll("Government of "+ indianstates[i][1] , indianstates[i][1]+" அரசு");
txt=txt.replaceAll("Politics of "+ indianstates[i][1] , indianstates[i][1]+" அரசியல்");
txt=txt.replaceAll("Music of "+ indianstates[i][1] , indianstates[i][1]+" இசை");
txt=txt.replaceAll("Culture of "+ indianstates[i][1] , indianstates[i][1]+" கலாச்சாரம்");
txt=txt.replaceAll("Economy of "+ indianstates[i][1] , indianstates[i][1]+" பொருளாதாரம்");
txt=txt.replaceAll("Education in "+ indianstates[i][1] , indianstates[i][1]+" கல்வி");
txt=txt.replaceAll("Tourism in "+ indianstates[i][1] , indianstates[i][1]+" சுற்றுலா");
*/
//txt=txt.replaceAll(indianstates[i][0], indianstates[i][1]);
}

for(i=0;i<districts.length;i++){
txt=txt.replaceAll(districts[i][0] +' district', districts[i][1] +' மாவட்டம்');
txt=txt.replaceAll(districts[i][0], districts[i][1]);
}

for(i=0;i<languages.length;i++){
txt=txt.replaceAll(languages[i][0]+' language', languages[i][1]);
txt=txt.replaceAll(languages[i][0], languages[i][1]);
}

//txt=txt.replaceAll("language", "");
txt=txt.replaceAll("குஜராதி", "குஜராத்தி");
txt=txt.replaceAll("நாகம்r", "Nagar");
txt=txt.replaceAll("சீனம்i", "mini");
txt=txt.replaceAll("மலாய்alam", "மலையாளம்");
txt=txt.replaceAll("ப்i", "பி");
txt=txt.replaceAll("த்i", "த்தி");
txt=txt.replaceAll("ன்i", "னி");
txt=txt.replaceAll("ர்i", "ரி");

document.getElementById('trans_out').value=txt;
}

function compareStringLengths ( a, b )
{
  if ( a.length < b.length )
    return -1;
  if ( a.length > b.length )
    return 1;
  return 0; // a and b are the same length
}

String.prototype.replaceAll = function (replaceThis, withThis) {
//var re = new RegExp(RegExp.quote(replaceThis),"gi");
//alert(re);
return this.replace(eval("/\\b("+replaceThis+")\\b/gi"), withThis);
};

RegExp.quote = function(str) {
     //return str.replace(/([.?*+^$[\]\\(){}-])/gi, "\\$1");
};

function RedlinkRemoval(){

$preview=$('#template_previewbox').text();
if($preview=='PREVIEW HERE'){
alert("Click preview button first!");
return false;
}
var $redlinks=[];

$('a.new').each(function(){
$redlinks.push($(this).text());
});


temp=$('#trans_out').val();
$.each($redlinks,function(){
temp=temp.replace('[['+ this +']]',this);
});
$('#trans_out').val(temp);
}
function ListOfCountries(){
temp="";
Convert();

$.each(countrieslist,function(){
	temp +="[["+this+"]]<br />";
});

$('#trans_out').val(temp);

}
thtm ="இந்தக் கருவி ஆங்கில விக்கி '''இணைப்புகள் கொண்ட பட்டியல் பக்கங்களை''' தமிழாக்கம் செய்ய உதவும்.";
thtm +="<br\/><br\/>Input (English):<br />";
thtm +="<textarea id='in' name='in' cols=80 rows=6><\/textarea>";
thtm +="<br\/><input type='button' onclick='Convert\(\)' value='Convert to Tamil'>";

thtm +="<br\/>Output in Tamil : (<a href='javascript:void(0)' onclick='RedlinkRemoval()' style='color:#0645AD'>Click here to remove red link </a>)";
thtm +=" | <a href='javascript:void(0)' onclick='getLangLinks()' style='color:#0645AD'>LangLinks</a>)<br\/>";
thtm +="<textarea id='trans_out' name='trans_out' cols=80 rows=6><\/textarea>";
thtm +="<input type='button' id='template_preview' value='Step 2: Preview the generated code' onclick='transPreview();addInlineEditClick(); return false;' />";
//$htm +="<input type='checkbox' id='red_link' onclick='RedlinkRemoval()'>Remove Red link & update the trans_output<br />";
thtm +="Step 3:Copy & Paste the above wiki text into the wiktionary page.<div id='template_previewbox' style='display:none'>PREVIEW HERE</div>";

function getLangLinks(){
temp_in=$('#in').val();
//if(temp_in!=''){

url='http://en.wikipedia.org/w/api.php?action=query&format=jsonp&prop=langlinks&lllimit=500&titles='+temp_in;

var $redlinks=[];

$('a.new').each(function(){
$titles=$(this).attr('href').replace("/w/index.php?title=","").replace("&action=edit&redlink=1","");
	if($.inArray($titles,$redlinks)===-1){
		$redlinks.push($titles);
	}
	if($.inArray($(this).text(),$redlinks)===-1){
		$redlinks.push($(this).text());
	}
});


//$redlinks=$.unique($redlinks);//remove duplicate array values to avoid unnecessary api call
$redlinks.sort ( compareStringLengths );//sort by string length
$redlinks.reverse();//order by most characters first.

temp=$('#trans_out').val();
$.each($redlinks,function(k,v){
//temp=temp.replace('[['+ this +']]',this);
//alert(v);
temp_in=$redlinks[k];
	$.getJSON( 'http://en.wikipedia.org/w/api.php?format=json&redirects&callback=?',
	{ 'action': 'query', 'prop': 'langlinks', 'lllimit': 500, 'titles':v }, 
		function( data ) {
		//console.log(data);
		
			//$redlinks.push($(this).text());		
			$.each(data.query.pages,function(key,val){	
				$.each(val,function(key1,val1){
					if(key1=="langlinks"){
						$.each(val1,function(key3,val3){
							if(val3.lang=='ta'){			temp=$('#trans_out').val();								
								temp=temp.replace(eval("/\\b([\.]*"+v+")\\b/gi"),val3['*']);
								$('#trans_out').val(temp);

							}
						});//third each
					}
				});//key1 - second each		
			});//query.pages.

		}
	);//getjson
	
  });//.new
transPreview();//to avoid unnecessary api call
//}//if
}//fn

$inlineHtml="<span id='dtitlelink'></span>:&nbsp; <input type='text' id='titlelink'  \/><br \/>";
$inlineHtml +="<span id='dtitletext'></span>:&nbsp; <input type='text' id='titletext' \/><br \/>";
$inlineHtml += "<input type='button' onclick='inlineChange()' value='Change' \/>";


$(document).ready(function(){
//alert("tryagain");
try{
tdialog= $('<div></div>')
.html(thtm)
.dialog({autoOpen: false,
title: 'Translation tool',
height:500,
width:600,
maxHeight:400,
modal:false});

inlinedialog= $('<div></div>')
.html($inlineHtml)
.dialog({autoOpen: false,
title: 'Find/ReplaceAll (redlinks only)',
height:150,
width:250,zIndex:3999,
maxHeight:200,
modal:false});

//alert("here");
if($('#wpTextbox1').is(':visible')){
$(".tabs").append("* <span><a href='javascript:void(0)' onclick='openHelper()' >Translation Helper</a></span>");//.insertBefore($('#wpTextbox1'));
}
else{
$(".tabs").append("* <span><a href='javascript:void(0)' onclick='openHelper()'>Translation Helper</a></span>");//.insertBefore($('#wikEdInputWrapper'));
}
}
catch(err){
//இதற்கு பதில் இந்த வழுவை(dialog is not a function) எப்படி சரி செய்வது என்று பார்க்கவேண்டும்.
}
});


function inlineUpdate($titles,$text){
	$('#dtitlelink').html($titles);
	$('#dtitletext').html($text);
	$('#titlelink').val($titles);
	$('#titletext').val($text);

	inlinedialog.dialog('open');
}

function inlineChange(){
$('a.new').each(function(){
$link=$(this).attr('href').replace($('#dtitlelink').text(),$('#titlelink').val());
$text=$(this).text().replace($('#dtitletext').text(),$('#titletext').val());
$(this).attr('href',$link);
$(this).text($text);
temp=$('#trans_out').val();
$titles=$('#dtitlelink').text();		
temp=temp.replace(eval("/\\b("+$titles+")\\b/gi"),$link.replace("/w/index.php?title=","").replace("&action=edit&redlink=1","").replace("_"," "));
temp=temp.replace(eval("/\\b("+$('#dtitletext').text()+")\\b/gi"),$text);
//replace if no pipe symbol
temp=temp.replace(eval("/\\b(\[\["+$titles+"\]\])\\b/gi"),"[["+$titles+"|"+$text+"]]");
$('#trans_out').val(temp);

});
inlinedialog.dialog('close');
}

function transPreview(){
Temptrans_out=$('#trans_out').val();
if(Temptrans_out!=''){
//path="?format=json&action=parse&text="+Temptrans_out;
$('#template_previewbox').show();
if(typeof(mydomain)=='undefined')mydomain='ta.wikipedia';

url='http://'+mydomain+'.org/w/api.php';
$.post(url, { "format": "json","action":"parse","text":Temptrans_out },
   function(data){
var parseddata=data.parse.text['*'];
//alert(parseddata);//is it any changes in wikipedia json parsing?
$("#template_previewbox").html(parseddata);                      
   
   }, "json");
//   .complete(function(){   });
}//tempPreview
}

function addInlineEditClick(){
//alert("Timebeing use this alert");
//e.preventDefault();
$('a.new').each(function(){
$(this).click(function(){
	$titles=$(this).attr('href').replace("/w/index.php?title=","").replace("&action=edit&redlink=1","").replace("_"," ");		
	$va="[["+$titles+"|"+$(this).text()+"]]";
	//fn_focus(obj,$va);	
//        event.preventDefault();
	inlineUpdate($titles,$(this).text());
	//$(this).bind('click');
	return false;
});
});
}
function openHelper(){
tdialog.dialog('open');
}

//</script>
//<input id='wpTextbox1' type='text' />
"https://ta.wikipedia.org/w/index.php?title=பயனர்:Mdmahir/translation_helper.js&oldid=3291984" இலிருந்து மீள்விக்கப்பட்டது