MediaWiki:DonationForm.js: Difference between revisions

Jump to navigation Jump to search
Content deleted Content added
remove India from noRecurringCountries - can do monthly via UPI and PayTM now
use toLocaleString for Pay the Fee amount - phab:T336079
Line 990: Line 990:
minAmount = donationForm.minimums[ donationForm.currency ] || 1,
minAmount = donationForm.minimums[ donationForm.currency ] || 1,
maxAmount = donationForm.maxUSD * minAmount,
maxAmount = donationForm.maxUSD * minAmount,
feeText;
feeText, locale, formatterOptions;

locale = donationForm.getLocale( mw.config.get('wgPageContentLanguage'), donationForm.country );


if ( feeAmount % 1 !== 0 ) { // Not a whole number
if ( feeAmount % 1 !== 0 ) { // Not a whole number
feeText = feeAmount.toFixed(2);
formatterOptions = { minimumFractionDigits: 2 };
} else {
} else {
feeText = feeAmount.toString();
formatterOptions = {};
}

try {
feeText = feeAmount.toLocaleString( locale, formatterOptions );
} catch(e) {
feeText = feeAmount.toFixed(2);
}
}


Line 1,094: Line 1,102:
/**
/**
* Make language and country into a standard javascript Intl locale identifier
* Make language and country into a standard javascript Intl locale identifier
*
* Currently only used in monthlyconvert, but this could be useful
*
*
* @param {string} language
* @param {string} language