Index: trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php |
— | — | @@ -1335,8 +1335,8 @@ |
1336 | 1336 | $count = 0; |
1337 | 1337 | //Count's just there making sure we don't get stuck here. |
1338 | 1338 | while ( !in_array( $language, $this->getAvailableLanguages() ) && $count < 3 ){ |
1339 | | - //find the failback. |
1340 | | - $language = $this->dataObj->getFailbackLanguage( $language ); |
| 1339 | + // Get the fallback language |
| 1340 | + $language = Language::getFallbackFor( $language ); |
1341 | 1341 | $count += 1; |
1342 | 1342 | } |
1343 | 1343 | |
Index: trunk/extensions/DonationInterface/gateway_common/DonationData.php |
— | — | @@ -471,12 +471,14 @@ |
472 | 472 | |
473 | 473 | /** |
474 | 474 | * normalizeAndSanitize helper function. |
475 | | - * If the language has not yet been set, pulls the language code |
| 475 | + * If the language has not yet been set or is not valid, pulls the language code |
476 | 476 | * from the current global language object. |
477 | 477 | */ |
478 | 478 | function setLanguage() { |
479 | 479 | global $wgLang; |
480 | | - if ( !$this->isSomething( 'language' ) ) { |
| 480 | + if ( !$this->isSomething( 'language' ) |
| 481 | + || !Language::isValidBuiltInCode( $this->normalized['language'] ) ) |
| 482 | + { |
481 | 483 | $this->setVal( 'language', $wgLang->getCode() ); |
482 | 484 | } |
483 | 485 | } |
— | — | @@ -944,25 +946,6 @@ |
945 | 947 | ); |
946 | 948 | return $stomp_fields; |
947 | 949 | } |
948 | | - |
949 | | - /** |
950 | | - * getFailbackLanguage should return the code for a next-best-language, in |
951 | | - * the event it is deemed unavailable by the gateway. |
952 | | - * @param string $unavailable_language |
953 | | - * @return string The code which the unavailable language should fail back |
954 | | - * to. |
955 | | - */ |
956 | | - function getFailbackLanguage( $unavailable_language ){ |
957 | | - $unavailable_language = strtolower($unavailable_language); |
958 | | - |
959 | | - //TODO: Something in here more complicated than defaulting to English. |
960 | | - //Probably get a failback from MediaWiki if one exists, and if the code |
961 | | - //doesn't change as part of that process, have a next-best language |
962 | | - //identifier that we write? |
963 | | - |
964 | | - $failback = 'en'; |
965 | | - return strtolower($failback); |
966 | | - } |
967 | 950 | } |
968 | 951 | |
969 | 952 | ?> |