r102421 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102420‎ | r102421 | r102422 >
Date:18:55, 8 November 2011
Author:awjrichards
Status:ok
Tags:fundraising 
Comment:
Modified paths:
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/DonationData.php (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php (modified) (history)

Diff [purge]

Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php
@@ -1106,8 +1106,69 @@
11071107 'payment_submethod',
11081108 'issuer_id',
11091109 'order_id', //This may or may not oughta-be-here...
 1110+ 'language',
11101111 );
11111112 }
 1113+
 1114+ protected function stage_language( $type = 'request' ) {
 1115+ $language = strtolower( $this->staged_data['language'] );
 1116+
 1117+ $count = 0;
 1118+ //Count's just there making sure we don't get stuck here.
 1119+ while ( !in_array( $language, $this->getAvailableLanguages() ) && $count < 3 ){
 1120+ //find the failback.
 1121+ $language = $this->dataObj->getFailbackLanguage( $language );
 1122+ $count += 1;
 1123+ }
 1124+
 1125+ if ( !in_array( $language, $this->getAvailableLanguages() ) ){
 1126+ $language = 'en';
 1127+ }
 1128+
 1129+ if ( $language === 'zh' ) { //Handles GC's mutant Chinese code.
 1130+ $language = 'sc';
 1131+ }
 1132+
 1133+ $this->staged_data['language'] = $language;
 1134+ }
 1135+
 1136+ /**
 1137+ * OUR language codes which are available to use in GlobalCollect.
 1138+ * @return string
 1139+ */
 1140+ function getAvailableLanguages(){
 1141+ $languages = array(
 1142+ 'ar', //Arabic
 1143+ 'cz', //Czech
 1144+ 'da', //Danish
 1145+ 'nl', //Dutch
 1146+ 'en', //English
 1147+ 'fa', //Farsi
 1148+ 'fi', //Finish
 1149+ 'fr', //French
 1150+ 'de', //German
 1151+ 'he', //Hebrew
 1152+ 'hi', //Hindi
 1153+ 'hu', //Hungarian
 1154+ 'it', //Italian
 1155+ 'ja', //Japanese
 1156+ 'ko', //Korean
 1157+ 'no', //Norwegian
 1158+ 'po', //Polish
 1159+ 'pt', //Portuguese
 1160+ 'ro', //Romanian
 1161+ 'sl', //Slovene
 1162+ 'es', //Spanish
 1163+ 'sw', //Swahili
 1164+ 'sv', //Swedish
 1165+ 'th', //Thai
 1166+ 'tr', //Turkish
 1167+ 'ur', //Urdu
 1168+ 'vi', //Vietnamese
 1169+ 'zh', //the REAL chinese code.
 1170+ );
 1171+ return $languages;
 1172+ }
11121173
11131174 /**
11141175 * Stage: amount
Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/DonationData.php
@@ -946,6 +946,25 @@
947947 );
948948 return $stomp_fields;
949949 }
 950+
 951+ /**
 952+ * getFailbackLanguage should return the code for a next-best-language, in
 953+ * the event it is deemed unavailable by the gateway.
 954+ * @param string $unavailable_language
 955+ * @return string The code which the unavailable language should fail back
 956+ * to.
 957+ */
 958+ function getFailbackLanguage( $unavailable_language ){
 959+ $unavailable_language = strtolower($unavailable_language);
 960+
 961+ //TODO: Something in here more complicated than defaulting to English.
 962+ //Probably get a failback from MediaWiki if one exists, and if the code
 963+ //doesn't change as part of that process, have a next-best language
 964+ //identifier that we write?
 965+
 966+ $failback = 'en';
 967+ return strtolower($failback);
 968+ }
950969 }
951970
952971 ?>
Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/DonationData.php
___________________________________________________________________
Modified: svn:mergeinfo
953972 Merged /trunk/extensions/DonationInterface/gateway_common/DonationData.php:r102419
Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface
___________________________________________________________________
Modified: svn:mergeinfo
954973 Merged /trunk/extensions/DonationInterface:r102364,102419

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r102364Stages chinese language codes specially for communication with GlobalCollect.khorn02:11, 8 November 2011
r102419More changes surrounding staging an appropriate language for GlobalCollect (a...khorn18:09, 8 November 2011

Status & tagging log