r112606 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112605‎ | r112606 | r112607 >
Date:15:46, 28 February 2012
Author:nikerabbit
Status:ok
Tags:
Comment:
Make the zero languages link to translation view
Modified paths:
  • /trunk/extensions/Translate/PageTranslation.i18n.php (modified) (history)
  • /trunk/extensions/Translate/tag/PageTranslationHooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/tag/PageTranslationHooks.php
@@ -248,15 +248,29 @@
249249 // Add links to other languages
250250 $suffix = ( $code === 'en' ) ? '' : "/$code";
251251 $_title = Title::makeTitle( $title->getNamespace(), $title->getDBkey() . $suffix );
252 -
253 - if ( $parser->getTitle()->getText() === $_title->getText() ) {
 252+ if ( intval( $percent ) === 0 ) {
 253+ /* When language is included because it is a priority language,
 254+ * but translation does not yet exists, link directly to the
 255+ * translation view. */
 256+ $translate = SpecialPage::getTitleFor( 'Translate' );
 257+ $params = array(
 258+ 'group' => $page->getMessageGroupId(),
 259+ 'language' => $code,
 260+ 'task' => 'view'
 261+ );
 262+ $attribs = array(
 263+ 'title' => wfMessage( 'tpt-languages-zero' )->text(),
 264+ 'class' => 'new', // For red link color
 265+ );
 266+ $languages[] = Linker::link( $translate, "$name $percentImage", $attribs, $params );
 267+ } elseif ( $parser->getTitle()->getText() === $_title->getText() ) {
254268 $name = Html::rawElement( 'span', array( 'class' => 'mw-pt-languages-selected' ), $name );
255269 $languages[] = "$name $percentImage";
256270 } else {
257271 if ( $code === $userLangCode ) {
258272 $name = Html::rawElement( 'span', array( 'class' => 'mw-pt-languages-ui' ), $name );
259273 }
260 - $languages[] = Linker::link( $_title, "$name $percentImage" );
 274+ $languages[] = Linker::linkKnown( $_title, "$name $percentImage" );
261275 }
262276 }
263277
Index: trunk/extensions/Translate/PageTranslation.i18n.php
@@ -86,6 +86,7 @@
8787
8888 'tpt-languages-legend' => 'Other languages:',
8989 'tpt-languages-separator' => ' • ',
 90+ 'tpt-languages-zero' => 'Start translation for this language',
9091
9192 'tpt-target-page' => 'This page cannot be updated manually.
9293 This page is a translation of page [[$1]] and the translation can be updated using [$2 the translation tool].',
@@ -259,6 +260,7 @@
260261 'pt-deletepage-action-check' => 'This is a button label. "List" is an imperative verb.',
261262 'pt-deletepage-current' => '{{Identical|Page name}}',
262263 'pt-deletepage-reason' => '{{Identical|Reason}}',
 264+ 'tpt-languages-zero' => 'Tooltip for a link in <language /> when language is included because it is a priority language, but translation does not yet exists. It links directly to the translation view.',
263265 );
264266
265267 /** ꢱꣃꢬꢵꢯ꣄ꢡ꣄ꢬꢵ (ꢱꣃꢬꢵꢯ꣄ꢡ꣄ꢬꢵ)

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r1125761. Restrict translation to a language if the group has a different priority l...santhosh05:03, 28 February 2012

Status & tagging log