r95973 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95972‎ | r95973 | r95974 >
Date:12:48, 1 September 2011
Author:catrope
Status:ok
Tags:
Comment:
Followup r95970, r95972: fix translations for real this time. Calling Message::inLanguage() after exists() doesn't work, apparently
Modified paths:
  • /branches/RL2/extensions/Gadgets/backend/Gadget.php (modified) (history)

Diff [purge]

Index: branches/RL2/extensions/Gadgets/backend/Gadget.php
@@ -126,14 +126,14 @@
127127 */
128128 public function getTitleMessage( $langcode = null ) {
129129 $msg = wfMessage( $this->getTitleMessageKey() );
 130+ if ( $langcode !== null ) {
 131+ $msg = $msg->inLanguage( $langcode );
 132+ }
130133 if ( !$msg->exists() ) {
131134 // Fallback: return the name of the gadget
132135 $lang = Language::factory( $langcode );
133136 return $lang->ucfirst( $this->name );
134137 }
135 - if ( $langcode !== null ) {
136 - $msg = $msg->inLanguage( $langcode );
137 - }
138138 return $msg->plain();
139139
140140 }
@@ -153,13 +153,13 @@
154154 */
155155 public function getDescriptionMessage( $langcode = null ) {
156156 $msg = wfMessage( $this->getDescriptionMessageKey() );
 157+ if ( $langcode !== null ) {
 158+ $msg = $msg->inLanguage( $langcode );
 159+ }
157160 if ( !$msg->exists() ) {
158161 // Fallback: return empty string
159162 return '';
160163 }
161 - if ( $langcode !== null ) {
162 - $msg = $msg->inLanguage( $langcode );
163 - }
164164 return $msg->parse();
165165 }
166166

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r95970RL2: Rename getTitleMsg() to getTitleMessageKey(), and introduce getTitleMess...catrope12:19, 1 September 2011
r95972RL2: Fix stupid mistake in r95970 that broke translated titles and descriptionscatrope12:41, 1 September 2011

Status & tagging log