r88507 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88506‎ | r88507 | r88508 >
Date:03:41, 21 May 2011
Author:bawolff
Status:ok (Comments)
Tags:
Comment:
(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.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES-1.19 (modified) (history)
  • /trunk/phase3/languages/Language.php (modified) (history)

Diff [purge]

Index: trunk/phase3/RELEASE-NOTES-1.19
@@ -88,6 +88,8 @@
8989 changes to languages because of Bugzilla reports.
9090
9191 * Bhojpuri (bho) (renamed from "bh").
 92+* (bug 29031) When translating block log entries, indefinite, infinite, and
 93+ infinity are now considered the same.
9294
9395 == Compatibility ==
9496
Index: trunk/phase3/languages/Language.php
@@ -2719,11 +2719,25 @@
27202720 * @see LanguageFi.php for example implementation
27212721 */
27222722 function translateBlockExpiry( $str ) {
2723 - foreach( SpecialBlock::getSuggestedDurations( $this ) as $show => $value ){
 2723+ $duration = SpecialBlock::getSuggestedDurations( $this );
 2724+ foreach( $duration as $show => $value ){
27242725 if ( strcmp( $str, $value ) == 0 ) {
27252726 return htmlspecialchars( trim( $show ) );
27262727 }
27272728 }
 2729+
 2730+ // Since usually only infinite or indefinite is only on list, so try
 2731+ // equivalents if still here.
 2732+ $indefs = array( 'infinite', 'infinity', 'indefinite' );
 2733+ if ( in_array( $str, $indefs ) ) {
 2734+ foreach( $indefs as $val ) {
 2735+ $show = array_search( $val, $duration, true );
 2736+ if ( $show !== false ) {
 2737+ return htmlspecialchars( trim( $show ) );
 2738+ }
 2739+ }
 2740+ }
 2741+ // If all else fails, return the original string.
27282742 return $str;
27292743 }
27302744

Comments

#Comment by Nikerabbit (talk | contribs)   06:48, 21 May 2011

// Since usually only infinite or indefinite is only on list, so try

Status & tagging log