https://www.mediawiki.org/wiki/Special:Code/MediaWiki/112177

Revision: 112177
Author:   pgehres
Date:     2012-02-23 01:22:54 +0000 (Thu, 23 Feb 2012)
Log Message:
-----------
Updating RapidHTML after r112175 and r112171. Partial revert of r111992

Modified Paths:
--------------
    trunk/extensions/DonationInterface/gateway_forms/RapidHtml.php

Modified: trunk/extensions/DonationInterface/gateway_forms/RapidHtml.php
===================================================================
--- trunk/extensions/DonationInterface/gateway_forms/RapidHtml.php      
2012-02-23 01:18:01 UTC (rev 112176)
+++ trunk/extensions/DonationInterface/gateway_forms/RapidHtml.php      
2012-02-23 01:22:54 UTC (rev 112177)
@@ -264,7 +264,9 @@
                                $html = str_replace( $matches[ 0 ][ $i ], 
wfMsg( $msg_key, $params ), $html );
                        } else {
                                // look for a country variant of the message 
and use that if found
-                               $html = str_replace( '%' . $msg_key . '%', 
$this->get_message_variation( $msg_key ), $html );
+                               $msg_text = 
DataValidator::wfLangSpecificFallback( $this->getEscapedValue( 'language' ),
+                                       array( $msg_key . '-' . strtolower( 
$this->getEscapedValue( 'country' ) ), $msg_key ) );
+                               $html = str_replace( '%' . $msg_key . '%', 
$msg_text, $html );
                        }
                }
 
@@ -443,53 +445,6 @@
        }
 
        /**
-        * This function looks for a country variant of the specified message 
and
-        * returns the variant if found for the current language.  If the 
variant
-        * does not have a message for the current language, the original 
message
-        * is used (checking first the current language and then falling back as
-        * is normal for wfMessage).
-        *
-        * @param $key The original message key to be evaluated
-        * @return string A string representing the message requested
-        */
-       function get_message_variation( $key ) {
-               $langCode = strtolower( $this->getEscapedValue( 'language' ) );
-               $countryCode = strtolower( $this->getEscapedValue( 'country' ) 
);
-
-               # construct the country-specific message key
-               $msg_alt_key = $key . '-' . $countryCode;
-               $msg_alt = wfMessage( $msg_alt_key );
-
-               # load the default
-               $to_return = wfMessage( $key )->inLanguage( $langCode )->text();
-
-               # check to see if an alternate exists
-               if ( $msg_alt->exists() ){
-                       # get the English version of the alternate message
-                       $msg_alt_en = $msg_alt->inLanguage( 'en' )->text();
-                       # get the alternate message in the current language
-                       $msg_alt_lang = $msg_alt->inLanguage( $langCode 
)->text();
-
-                       # if we are looking for English, we're good
-                       if ( $langCode == 'en' ){
-                               $to_return = $msg_alt_en;
-                       }
-                       # check make sure we didn't fallback to English
-                       elseif ( strcmp( $msg_alt_en, $msg_alt_lang ) != 0 ){
-                               $to_return = $msg_alt_lang;
-                       }
-                       else {
-                               # do nothing and return the original message
-                       }
-               }
-
-               # strip the damned colons off of the right end
-               $to_return = rtrim( $to_return, ':' );
-
-               return $to_return;
-       }
-
-       /**
         * Gets a list of the supported countries from the parent class
         * and returns an option list representing all of those countries
         * in a translatable fashion.


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to