From d5b60ac6a674394cb99c25deea431c7893de0e0a Mon Sep 17 00:00:00 2001 From: Brian Wolff Date: Sat, 21 May 2011 03:41:16 +0000 Subject: [PATCH] (bug 29031) When translating block log entries, indefinite, infinite, and 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 | 2 ++ languages/Language.php | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES-1.19 b/RELEASE-NOTES-1.19 index ea7d9a0127..e7b2611a78 100644 --- a/RELEASE-NOTES-1.19 +++ b/RELEASE-NOTES-1.19 @@ -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 == diff --git a/languages/Language.php b/languages/Language.php index 8991ae2644..ff91124c8f 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -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; } -- 2.20.1