MediaWiki:DonationForm mctest.js: Difference between revisions

Content deleted Content added
make the code controlling input into Other field a function, so we can re-use it for monthlyconvert Other
add utility function donationForm.getLocale
 
Line 1,073:
}
};
 
/**
* 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} country
* @return {string} locale identifier
*/
donationForm.getLocale = function( language, country ) {
if ( language === 'en-gb' ) {
language = 'en';
}
if ( language === 'es-419' ) {
language = 'es';
}
if ( language === 'pt-br' ) {
language = 'pt';
}
return language + '-' + country;
};
 
 
/* End form functions */