r74420 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74419‎ | r74420 | r74421 >
Date:12:53, 7 October 2010
Author:nikerabbit
Status:ok
Tags:
Comment:
Don't iterate over all groups, but instead call the correct one only
Modified paths:
  • /trunk/extensions/Translate/Groups.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/Groups.php
@@ -617,9 +617,12 @@
618618 }
619619
620620 public function getMessage( $key, $code ) {
621 - foreach ( $this->getGroups() as $group ) {
622 - $message = $group->getMessage( $key, $code );
623 - if ( $message !== null ) return $message;
 621+ $id = TranslateUtils::messageKeyToGroup( $this->getNamespace(), $key );
 622+ $groups = $this->getGroups();
 623+ if ( isset( $groups[$id] ) ) {
 624+ return $groups[$id]->getMessage( $key, $code );
 625+ } else {
 626+ return null;
624627 }
625628 }
626629

Status & tagging log