MediaWiki:DonationFormSandbox.js: Difference between revisions

Content deleted Content added
No edit summary
use toLocaleString for Pay the Fee amount - phab:T336079
Line 990:
minAmount = donationForm.minimums[ donationForm.currency ] || 1,
maxAmount = donationForm.maxUSD * minAmount,
feeText, locale, formatterOptions, supportsIntl;
 
locale = donationForm.getLocale( mw.config.get('wgPageContentLanguage'), donationForm.country );
 
if ( feeAmount % 1 !== 0 ) { // Not a whole number
feeTextformatterOptions = feeAmount.toFixed({ minimumFractionDigits: 2) };
} else {
feeTextformatterOptions = feeAmount.toString(){};
}
 
try {
feeText = feeAmount.toLocaleString( locale, formatterOptions );
} catch(e) {
feeText = feeAmount.toFixed(2);
}
 
Line 1,094 ⟶ 1,102:
/**
* Make language and country into a standard javascript Intl locale identifier
*
* Currently only used in monthlyconvert, but this could be useful
*
* @param {string} language