Index: trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php |
— | — | @@ -1694,12 +1694,14 @@ |
1695 | 1695 | |
1696 | 1696 | switch ( $type ) { |
1697 | 1697 | case 'request': |
1698 | | - $count = 0; |
1699 | | - //Count's just there making sure we don't get stuck here. |
1700 | | - while ( !in_array( $language, $this->getAvailableLanguages() ) && $count < 3 ){ |
1701 | | - // Get the fallback language |
1702 | | - $language = Language::getFallbackFor( $language ); |
1703 | | - $count += 1; |
| 1698 | + if ( !in_array( $language, $this->getAvailableLanguages() ) ) { |
| 1699 | + $fallbacks = Language::getFallbacksFor( $language ); |
| 1700 | + foreach ( $fallbacks as $fallback ) { |
| 1701 | + if ( in_array( $fallback, $this->getAvailableLanguages() ) ) { |
| 1702 | + $language = $fallback; |
| 1703 | + break; |
| 1704 | + } |
| 1705 | + } |
1704 | 1706 | } |
1705 | 1707 | |
1706 | 1708 | if ( !in_array( $language, $this->getAvailableLanguages() ) ){ |
Index: trunk/extensions/SecurePoll/includes/pages/Page.php |
— | — | @@ -38,16 +38,14 @@ |
39 | 39 | } |
40 | 40 | $wgLang = Language::factory( $userLang ); |
41 | 41 | |
42 | | - $languages = array( $userLang ); |
43 | | - $fallback = $userLang; |
44 | | - while ( $fallback = Language::getFallbackFor( $fallback ) ) { |
45 | | - $languages[] = $fallback; |
| 42 | + $languages = array_merge( |
| 43 | + array( $userLang ), |
| 44 | + Language::getFallbacksFor( $userLang ) ); |
| 45 | + |
| 46 | + if ( !in_array( $election->getLanguage(), $languages ) ) { |
| 47 | + $languages[] = $election->getLanguage(); |
46 | 48 | } |
47 | | - if ( $fallback != $election->getLanguage() ) { |
48 | | - $fallback = $election->getLanguage(); |
49 | | - $languages[] = $fallback; |
50 | | - } |
51 | | - if ( $fallback != 'en' ) { |
| 49 | + if ( !in_array( 'en', $languages ) ) { |
52 | 50 | $languages[] = 'en'; |
53 | 51 | } |
54 | 52 | $this->context->setLanguages( $languages ); |
Index: trunk/extensions/LandingCheck/SpecialLandingCheck.php |
— | — | @@ -178,10 +178,9 @@ |
179 | 179 | $landingPage . '/' . $language |
180 | 180 | ); |
181 | 181 | // Add fallback languages |
182 | | - $code = $language; |
183 | | - while ( $code !== 'en' ) { |
184 | | - $code = Language::getFallbackFor( $code ); |
185 | | - $targetTexts[] = $landingPage . '/' . $code; |
| 182 | + $fallbacks = Language::getFallbacksFor( $language ); |
| 183 | + foreach ( $fallbacks as $fallback ) { |
| 184 | + $targetTexts[] = $landingPage . '/' . $fallback; |
186 | 185 | } |
187 | 186 | } |
188 | 187 | |