r36592 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r36591‎ | r36592 | r36593 >
Date:09:14, 24 June 2008
Author:nikerabbit
Status:old
Tags:
Comment:
* I hate weak typing
Modified paths:
  • /trunk/extensions/Translate/Message.php (modified) (history)
  • /trunk/extensions/Translate/TranslateEditAddons.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/TranslateEditAddons.php
@@ -42,7 +42,7 @@
4343
4444 private static function doBox( $msg, $code, $title = false ) {
4545 global $wgUser, $wgLang;
46 - if (!$msg ) { return ''; }
 46+ if ( $msg === null ) { return ''; }
4747
4848 $name = TranslateUtils::getLanguageName( $code, false, $wgLang->getCode() );
4949 $code = strtolower( $code );
@@ -144,12 +144,11 @@
145145 $title = Title::makeTitle( NS_MEDIAWIKI, $key . '/' . $wgTranslateDocumentationLanguageCode );
146146 $edit = $wgUser->getSkin()->makeKnownLinkObj( $title, wfMsgHtml( self::MSG . 'contribute' ), 'action=edit' );
147147 $info = TranslateUtils::getMessageContent( $key, $wgTranslateDocumentationLanguageCode );
148 - if ( !$info ) {
 148+ if ( $info === null ) {
149149 $info = $group->getMessage( $key, $wgTranslateDocumentationLanguageCode );
150150 }
151151 $class = 'mw-sp-translate-edit-info';
152 -
153 - if ( !$info ) {
 152+ if ( $info === null ) {
154153 $info = wfMsg( self::MSG . 'no-information' );
155154 $class = 'mw-sp-translate-edit-noinfo';
156155 }
@@ -185,8 +184,8 @@
186185
187186
188187 // Some syntactic checks
189 - $translation = $object->textbox1 ? $object->textbox1 : $xx;
190 - if ( $translation ) {
 188+ $translation = ($object->textbox1 !== null) ? $object->textbox1 : $xx;
 189+ if ( $translation !== null ) {
191190 $message = new TMessage( $key, $en );
192191 $message->database = $translation;
193192 $checks = MessageChecks::doChecks( $message );
Index: trunk/extensions/Translate/Message.php
@@ -300,7 +300,7 @@
301301 * @return Translated string or null if there isn't translation.
302302 */
303303 public function translation() {
304 - return $this->database() ? $this->database() : $this->infile();
 304+ return ($this->database() !== null) ? $this->database() : $this->infile();
305305 }
306306
307307 /**

Status & tagging log