Skip to content

Commit

Permalink
Fix and localize Unlink
Browse files Browse the repository at this point in the history
unlink: translate UI
morebits: fix functions needed by unlink, localize namespace names
shared, config: UI translation
  • Loading branch information
Siddhartha-Ghai committed Oct 22, 2012
1 parent 5ecf5db commit 98ffd2b
Show file tree
Hide file tree
Showing 4 changed files with 188 additions and 168 deletions.
54 changes: 23 additions & 31 deletions modules/friendlyshared.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,28 @@
Twinkle.shared = function friendlyshared() {
if( mw.config.get('wgNamespaceNumber') === 3 && Morebits.isIPAddress(mw.config.get('wgTitle')) ) {
var username = mw.config.get('wgTitle').split( '/' )[0].replace( /\"/, "\\\""); // only first part before any slashes
twAddPortletLink( function(){ Twinkle.shared.callback(username); }, "Shared IP", "friendly-shared", "Shared IP tagging" );
twAddPortletLink( function(){ Twinkle.shared.callback(username); }, "साझा आइ॰पी॰", "friendly-shared", "साझा आइ॰पी॰ पता टैगिंग" );
}
};

Twinkle.shared.callback = function friendlysharedCallback( uid ) {
var Window = new Morebits.simpleWindow( 600, 400 );
Window.setTitle( "साझा आई॰पी॰ पता टैगिंग" );
Window.setTitle( "साझा आइ॰पी॰ पता टैगिंग" );
Window.setScriptName( "Twinkle" );
Window.addFooterLink( "Twinkle help", "WP:TW/DOC#shared" );

var form = new Morebits.quickForm( Twinkle.shared.callback.evaluate );

var div = form.append( { type: 'div', id: 'sharedip-templatelist' } );
div.append( { type: 'header', label:'साझा आई॰पी॰ पता साँचे' } );
div.append( { type: 'header', label:'साझा आइ॰पी॰ पता साँचे' } );
div.append( { type: 'radio', name: 'shared', list: Twinkle.shared.standardList,
event: function( e ) {
Twinkle.shared.callback.change_shared( e );
e.stopPropagation();
}
} );

var org = form.append( { type:'field', label:'नीचे आई॰पी॰ पते के स्वामी/संचालक का नाम, होस्ट-नाम तथा संपर्क-सूचना (यदि लागू हो तो) भरें, और \"Submit\" बटन पर क्लिक करें।' } );
var org = form.append( { type:'field', label:'नीचे आइ॰पी॰ पते के स्वामी/संचालक का नाम, होस्ट-नाम तथा संपर्क-सूचना (यदि लागू हो तो) भरें, और \"Submit\" बटन पर क्लिक करें।' } );
org.append( {
type: 'input',
name: 'organization',
Expand Down Expand Up @@ -68,44 +68,40 @@ Twinkle.shared.callback = function friendlysharedCallback( uid ) {

Twinkle.shared.standardList = [
{
label: '{{shared IP}}: मानक साझा आई॰पी॰ साँचा',
label: '{{shared IP}}: मानक साझा आइ॰पी॰ साँचा',
value: 'shared IP',
tooltip: 'आई॰पी॰ सदस्य वार्ता पृष्ठ पर प्रयोग हेतु साँचा। यह साँचा आई॰पी॰ सदस्य तथा उन लोगों को जो उसे चेतावनी देना चाहते हैं या प्रतिबन्धित करना चाहते हैं, को उपयोगी जानकारी उपलब्ध करता है।'
tooltip: 'आइ॰पी॰ सदस्य वार्ता पृष्ठ पर प्रयोग हेतु साँचा। यह साँचा आइ॰पी॰ सदस्य तथा उन लोगों को जो उसे चेतावनी देना चाहते हैं या प्रतिबन्धित करना चाहते हैं, को उपयोगी जानकारी उपलब्ध करता है।'
},
{
label: '{{shared IP edu}}: शैक्षिक संस्थानों के लिए संशोधित साझा आई॰पी॰ साँचा',
label: '{{shared IP edu}}: शैक्षिक संस्थानों के लिए संशोधित साझा आइ॰पी॰ साँचा',
value: 'shared IP edu'
},
{
label: '{{shared IP public}}: सार्वजनिक टर्मिनलों के लिए संशोधित साझा आई॰पी॰ साँचा',
label: '{{shared IP public}}: सार्वजनिक टर्मिनलों के लिए संशोधित साझा आइ॰पी॰ साँचा',
value: 'shared IP public'
},
{
label: '{{shared IP gov}}: सरकारी सुविधाओं या एजेंसियों के लिए संशोधित साझा आई॰पी॰ साँचा',
label: '{{shared IP gov}}: सरकारी सुविधाओं या एजेंसियों के लिए संशोधित साझा आइ॰पी॰ साँचा',
value: 'shared IP gov'
},
{
label: '{{dynamicIP}}: अस्थिर पतों(dynamic IP) वाले संगठनो के लिए संशोधित साझा आई॰पी॰ साँचा',
label: '{{dynamicIP}}: अस्थिर पतों(dynamic IP) वाले संगठनो के लिए संशोधित साझा आइ॰पी॰ साँचा',
value: 'dynamicIP'
},
{
label: '{{ISP}}: इंटरनेट सेवा प्रदाता(ISP) संगठनों(खासकर प्रॉक्सीज़) के लिए संशोधित साझा आई॰पी॰ साँचा',
label: '{{ISP}}: इंटरनेट सेवा प्रदाता(ISP) संगठनों(खासकर प्रॉक्सीज़) के लिए संशोधित साझा आइ॰पी॰ साँचा',
value: 'ISP'
},
{
label: '{{mobileIP}}: मोबाइल फोन कंपनी और उनके ग्राहकों के लिए संशोधित साझा आई॰पी॰ साँचा',
label: '{{mobileIP}}: मोबाइल फोन कंपनी और उनके ग्राहकों के लिए संशोधित साझा आइ॰पी॰ साँचा',
value: 'mobileIP'
}
];

Twinkle.shared.callback.change_shared = function friendlysharedCallbackChangeShared(e) {
if( e.target.value === 'shared IP edu' ) {
e.target.form.contact.disabled = false;
} else {
e.target.form.contact.disabled = true;
}
e.target.form.organization.disabled=false;
e.target.form.host.disabled=false;
e.target.form.contact.disabled = ( e.target.value === 'shared IP edu' ) ? false : true;
e.target.form.organization.disabled = false;
e.target.form.host.disabled = false;
};

Twinkle.shared.callbacks = {
Expand All @@ -118,16 +114,12 @@ Twinkle.shared.callbacks = {
for( var i=0; i < Twinkle.shared.standardList.length; i++ ) {
var tagRe = new RegExp( '(\\{\\{' + Twinkle.shared.standardList[i].value + '(\\||\\}\\}))', 'im' );
if( tagRe.exec( pageText ) ) {
Morebits.status.warn( 'Info', 'Found {{' + Twinkle.shared.standardList[i].value + '}} on the user\'s talk page already...aborting' );
found = true;
Morebits.status.warn( 'Info', 'सदस्य वार्ता पृष्ठ पर {{' + Twinkle.shared.standardList[i].value + '}} पाया गया। टैगिंग रद्द कर डी गयी है।' );
return;
}
}

if( found ) {
return;
}

Morebits.status.info( 'Info', 'Will add the shared IP address template to the top of the user\'s talk page.' );
Morebits.status.info( 'Info', 'साझा आइ॰पी॰ पता साँचा सदस्य के वार्ता पृष्ठ में ऊपर-ऊपर जोड़ा जाएगा।' );
text += params.value + '|' + params.organization;
if( params.value === 'shared IP edu' && params.contact !== '') {
text += '|' + params.contact;
Expand All @@ -137,7 +129,7 @@ Twinkle.shared.callbacks = {
}
text += '}}\n\n';

var summaryText = 'Added {{[[Template:' + params.value + '|' + params.value + ']]}} template.';
var summaryText = '{{[[सा:' + params.value + '|' + params.value + ']]}} साँचा जोड़ा।';
pageobj.setPageText(text + pageText);
pageobj.setEditSummary(summaryText + Twinkle.getPref('summaryAd'));
pageobj.setMinorEdit(Twinkle.getFriendlyPref('markSharedIPAsMinor'));
Expand All @@ -149,14 +141,14 @@ Twinkle.shared.callbacks = {
Twinkle.shared.callback.evaluate = function friendlysharedCallbackEvaluate(e) {
var shared = e.target.getChecked( 'shared' );
if( !shared || shared.length <= 0 ) {
alert( 'You must select a shared IP address template to use!' );
alert( 'आपको प्रयोग करने के लिए एक साझा आइ॰पी साँचा चुनना होगा।' );
return;
}

var value = shared[0];

if( e.target.organization.value === '') {
alert( 'You must input an organization for the {{' + value + '}} template!' );
alert( 'आपको {{' + value + '}} साँचे के लिए संगठन का नाम देना होगा।' );
return;
}

Expand All @@ -171,9 +163,9 @@ Twinkle.shared.callback.evaluate = function friendlysharedCallbackEvaluate(e) {
Morebits.status.init( e.target );

Morebits.wiki.actionCompleted.redirect = mw.config.get('wgPageName');
Morebits.wiki.actionCompleted.notice = "टैगिंग संपूर्ण, वार्ता पन्ना कुछ ही क्षणों में रीलोड होगा";
Morebits.wiki.actionCompleted.notice = "टैगिंग सम्पूर्ण, वार्ता पन्ना कुछ ही क्षणों में रीलोड होगा";

var wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName'), "User talk page modification");
var wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName'), "सदस्य वार्ता पृष्ठ सम्पादन");
wikipedia_page.setFollowRedirect(true);
wikipedia_page.setCallbackParameters(params);
wikipedia_page.load(Twinkle.shared.callbacks.main);
Expand Down

0 comments on commit 98ffd2b

Please sign in to comment.