r108612 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108611‎ | r108612 | r108613 >
Date:11:48, 11 January 2012
Author:maxsem
Status:ok (Comments)
Tags:
Comment:
Always add error messages to pages in content language
Modified paths:
  • /trunk/extensions/GeoData/CoordinatesParserFunction.php (modified) (history)
  • /trunk/extensions/GeoData/GeoData.i18n.php (modified) (history)

Diff [purge]

Index: trunk/extensions/GeoData/CoordinatesParserFunction.php
@@ -71,7 +71,7 @@
7272 }
7373
7474 $this->addCategory( wfMessage( 'geodata-broken-tags-category' ) );
75 - $errorText = $status->getWikiText();
 75+ $errorText = $this->errorText( $status );
7676 if ( $errorText == '<>' ) {
7777 // Error that doesn't require a message,
7878 // can't think of a better way to pass this condition
@@ -194,6 +194,22 @@
195195 }
196196 $this->output->addCategory( $name, $this->parser->getTitle()->getText() );
197197 }
 198+
 199+ /**
 200+ * Returns wikitext of status error message in content language
 201+ *
 202+ * @param Status $s
 203+ * @return String
 204+ */
 205+ private function errorText( Status $s ) {
 206+ $errors = array_merge( $s->getErrorsArray(), $s->getWarningsArray() );
 207+ if ( !count( $errors ) ) {
 208+ return '';
 209+ }
 210+ $err = $errors[0];
 211+ $message = array_shift( $err );
 212+ return wfMessage( $message )->params( $err )->inContentLanguage()->plain();
 213+ }
198214 }
199215
200216 class CoordinatesOutput {
Index: trunk/extensions/GeoData/GeoData.i18n.php
@@ -25,4 +25,8 @@
2626 'geodata-limit-exceeded' => '$1 is a number',
2727 'geodata-broken-tags-category' => 'Name of the tracking category',
2828 'geodata-primary-coordinate' => 'Localised name of parameter that makes <nowiki>{{#coordinates:}}</nowiki> tag primary',
 29+);
 30+
 31+$messages['ru'] = array(
 32+ 'geodata-multiple-primary' => '<nowiki>{{#coordinates:}}</nowiki>: нельзя иметь более одной первичной метки на странице',
2933 );
\ No newline at end of file

Comments

#Comment by Nikerabbit (talk | contribs)   13:47, 11 January 2012

There is no verb in the method name.

Status & tagging log