(bug 29031) When translating block log entries, indefinite, infinite, and
authorBrian Wolff <bawolff@users.mediawiki.org>
Sat, 21 May 2011 03:41:16 +0000 (03:41 +0000)
committerBrian Wolff <bawolff@users.mediawiki.org>
Sat, 21 May 2011 03:41:16 +0000 (03:41 +0000)
infinity are now considered the same.

Before it just looked at the translations of the options for the drop down on
special:block, now it still does that, but if that fails, and the string
is infinite/indefinite/infinity, it will also check for the synonyms.

RELEASE-NOTES-1.19
languages/Language.php

index ea7d9a0..e7b2611 100644 (file)
@@ -88,6 +88,8 @@ regularly. Below only new and removed languages are listed, as well as
 changes to languages because of Bugzilla reports.
 
 * Bhojpuri (bho) (renamed from "bh").
+* (bug 29031) When translating block log entries, indefinite, infinite, and
+  infinity are now considered the same.
 
 == Compatibility ==
 
index 8991ae2..ff91124 100644 (file)
@@ -2719,11 +2719,25 @@ class Language {
         * @see LanguageFi.php for example implementation
         */
        function translateBlockExpiry( $str ) {
-               foreach( SpecialBlock::getSuggestedDurations( $this ) as $show => $value ){
+               $duration = SpecialBlock::getSuggestedDurations( $this );
+               foreach( $duration as $show => $value ){
                        if ( strcmp( $str, $value ) == 0 ) {
                                return htmlspecialchars( trim( $show ) );
                        }
                }
+
+               // Since usually only infinite or indefinite is only on list, so try
+               // equivalents if still here.
+               $indefs = array( 'infinite', 'infinity', 'indefinite' );
+               if ( in_array( $str, $indefs ) ) {
+                       foreach( $indefs as $val ) {
+                               $show = array_search( $val, $duration, true );
+                               if ( $show !== false ) {
+                                       return htmlspecialchars( trim( $show ) );
+                               }
+                       }
+               }
+               // If all else fails, return the original string.
                return $str;
        }