r101133 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101132‎ | r101133 | r101134 >
Date:14:21, 28 October 2011
Author:nikerabbit
Status:ok (Comments)
Tags:
Comment:
Give optional messages a bit more visibility
Modified paths:
  • /trunk/extensions/Translate/Translate.i18n.php (modified) (history)
  • /trunk/extensions/Translate/specials/SpecialTranslate.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/Translate.i18n.php
@@ -6639,6 +6639,10 @@
66406640 'translate-next' => 'Seuraava sivu',
66416641 'translate-prev' => 'Edellinen sivu',
66426642 'translate-page-description-legend' => 'Tietoja ryhmästä',
 6643+ 'translate-page-description-hasoptional' => 'This message group contains optional messages.
 6644+Optional messages should only be translated when your language has special requirements
 6645+like not using spaces or transliterating proper names. $1',
 6646+ 'translate-page-description-hasoptional-open' => 'Show optional messages.',
66436647 'translate-page-edit' => 'muokkaa',
66446648 'translate-ext-url' => '<hr />Verkkosivu: $1',
66456649 'translate-optional' => '(valinnainen)',
Index: trunk/extensions/Translate/specials/SpecialTranslate.php
@@ -120,6 +120,25 @@
121121 echo $output;
122122 } else {
123123 $description = $this->getGroupDescription( $this->group );
 124+
 125+ $taskid = $this->options['task'];
 126+ if ( in_array( $taskid, array( 'untranslated', 'reviewall' ), true ) ) {
 127+ $hasOptional = count( $this->group->getTags( 'optional' ) );
 128+ if ( $hasOptional ) {
 129+ $linker = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker;
 130+ $linktext = wfMessage( 'translate-page-description-hasoptional-open' )->escaped();
 131+ $params = array( 'task' => 'optional' ) + $this->nondefaults;
 132+ $link = $linker->link( $this->getTitle(), $linktext, array(), $params );
 133+ $note = wfMessage( 'translate-page-description-hasoptional' )->rawParams( $link )->parseAsBlock();
 134+
 135+ if ( $description ) {
 136+ $description .= '<hr>' . $note;
 137+ } else {
 138+ $description = $note;
 139+ }
 140+ }
 141+ }
 142+
124143 if ( $description ) {
125144 $description = Xml::fieldset( wfMsg( 'translate-page-description-legend' ), $description );
126145 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r101157fu r101133: Move English messages out of the Finish section to the English se...raymond17:40, 28 October 2011

Comments

#Comment by Siebrand (talk | contribs)   19:36, 28 October 2011

Please add message documentation for the newly added messages. Thanks.

#Comment by Nikerabbit (talk | contribs)   19:59, 28 October 2011

Done in wiki.

#Comment by Amire80 (talk | contribs)   20:23, 31 October 2011

It's not very important, but $hasOptional needed?

#Comment by Nikerabbit (talk | contribs)   20:25, 31 October 2011

Needed for what? Why show the message if there isn't any optional messages.

#Comment by Amire80 (talk | contribs)   20:29, 31 October 2011

It's only used once, so maybe it can be written as

if ( count( $this->group->getTags( 'optional' ) ) )

But again, it's not very important.

Status & tagging log