r51082 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r51081‎ | r51082 | r51083 >
Date:18:44, 27 May 2009
Author:siebrand
Status:resolved (Comments)
Tags:
Comment:
Support PLURAL for pfunc_string_too_long. Is that escape really needed - it's a number?
Modified paths:
  • /trunk/extensions/ParserFunctions/ParserFunctions.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ParserFunctions/ParserFunctions.php
@@ -589,12 +589,13 @@
590590
591591 // Generates error message. Called when string is too long.
592592 private function tooLongError() {
593 - global $wgStringFunctionsLimit;
 593+ global $wgStringFunctionsLimit, $wgContLang;
594594 wfLoadExtensionMessages( 'ParserFunctions' );
595595
596596 return '<strong class="error">' .
597 - wfMsgForContent( "pfunc_string_too_long",
598 - htmlspecialchars( $wgStringFunctionsLimit ) ) .
 597+ wfMsgExt( 'pfunc_string_too_long',
 598+ array( 'escape', 'parsemag' ),
 599+ $wgContLang->formatNum( $wgStringFunctionsLimit ) ) .
599600 '</strong>';
600601 }
601602

Follow-up revisions

RevisionCommit summaryAuthorDate
r51138Follow up to r51082 from CR. Message is supposed to be in the content language.siebrand20:05, 28 May 2009

Comments

#Comment by Umherirrender (talk | contribs)   16:55, 28 May 2009

Why using $wgContLang and not $wgLang for the current user? It is better to format the number in the same language than the message is shown.

#Comment by Siebrand (talk | contribs)   17:23, 28 May 2009

Please note that I have not written the code. I have changed it keeping current behaviour, and adding PLURAL support. That said, I do not know where this error message is shown. If it is rendered in a content page, the usage is correct, as content should be in the content language. If it is shown in the UI, it should be in the user language - I guess this error could be valid in both cases. No idea if it is possible to distinguish between the two uses.

#Comment by Umherirrender (talk | contribs)   19:58, 28 May 2009

The message is shown in content page (preview or after save). I was wonder, because the message is localize, but the number is formated in content language. In my opinion it looks muddle.

#Comment by Siebrand (talk | contribs)   20:05, 28 May 2009

Ah, right. I was convinced I added it, because I looked up the different options for wfMsgExt in GlobalFunctions.php. Obviously I forgot to add it. Fixed in r51138.

#Comment by Dragons flight (talk | contribs)   23:25, 28 May 2009

Actually, the original formatting was something of an afterthought. It was cut and paste from a similar message used by ParserFunctions in Expr.php. (That may need to be updated too?)

I suspect you are right that the escaping is unnecessary in this case. Expr.php has parameters that in some cases are user generated text, but as you say this is simply a predefined number.


Status & tagging log