r112666 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112665‎ | r112666 | r112667 >
Date:04:05, 29 February 2012
Author:santhosh
Status:resolved (Comments)
Tags:
Comment:
Special:Translation should not show messages if the language is prevented from translation to the selected language.
Show warning that translation to a language is discouraged by translation admin.
Show the reason for language preference if translation admin provided it.
Minor whitespace fixes.
Modified paths:
  • /trunk/extensions/Translate/PageTranslation.i18n.php (modified) (history)
  • /trunk/extensions/Translate/specials/SpecialTranslate.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/PageTranslation.i18n.php
@@ -93,6 +93,8 @@
9494 'tpt-unknown-page' => 'This namespace is reserved for content page translations.
9595 The page you are trying to edit does not seem to correspond any page marked for translation.',
9696 'tpt-translation-restricted' => 'Translation of this group to this language has been prevented by translation administrator.',
 97+ 'tpt-discouraged-language-force' => 'Translation administrator prevented translation of this group to this language.',
 98+ 'tpt-discouraged-language' => 'Translation administrator discourage translation of this group to this language.',
9799
98100 'tpt-render-summary' => 'Updating to match new version of source page',
99101
@@ -243,6 +245,8 @@
244246 'tpt-languages-legend' => 'The caption of a language selector displayed using <code>&lt;languages /&gt;</code>, e.g. on [[Project list]].',
245247 'tpt-languages-separator' => '{{optional}}',
246248 'tpt-translation-restricted' => 'Error message shown to user when translation to a language which is restricted by translation admin.',
 249+ 'tpt-discouraged-language-force' => 'Warning shown along with group description if the language is prevented from translation for the selected language',
 250+ 'tpt-discouraged-language' => 'Warning shown along with group description if the language is discouraged from translation for the selected language',
247251 'pt-parse-open' => '"Translation template" is the structure of a translation page, where the place for the translations of each section is marked with a placeholder.',
248252 'pt-shake-multiple' => 'Each translation (=section) unit can only contain one marker.',
249253 'pt-shake-empty' => 'Translation unit (=section) is empty except for the translation marker (=<nowiki><!--T:1--></nowiki>)',
Index: trunk/extensions/Translate/specials/SpecialTranslate.php
@@ -140,7 +140,17 @@
141141 if ( $status !== false ) {
142142 $description = $status . $description;
143143 }
144 -
 144+ $priorityLangs = array_flip( explode( ',', TranslateMetadata::get( $this->group->getId(), 'prioritylangs' ) ) );
 145+ $priorityForce = TranslateMetadata::get( $this->group->getId(), 'priorityforce' );
 146+ if ( count( $priorityLangs ) > 0 && !isset( $priorityLangs[$this->options['language']] ) ) {
 147+ $priorityReason = TranslateMetadata::get( $this->group->getId(), 'priorityreason' );
 148+ if ( $priorityForce == 'on' ) {
 149+ $this->paging['count'] = 0;
 150+ $description .= '<p>' . wfMsg( 'tpt-discouraged-language-force' ) . '</p>' . $priorityReason ;
 151+ } else {
 152+ $description .= '<p>' . wfMsg( 'tpt-discouraged-language' ) . '</p>' . $priorityReason;
 153+ }
 154+ }
145155 if ( $description ) {
146156 $description = Xml::fieldset( wfMsg( 'translate-page-description-legend' ), $description );
147157 }
@@ -149,7 +159,7 @@
150160
151161 if ( $this->paging['count'] === 0 ) {
152162 $wgOut->addHTML( $description . $links );
153 - } elseif( $this->paging['count'] === $this->paging['total'] ) {
 163+ } elseif ( $this->paging['count'] === $this->paging['total'] ) {
154164 $wgOut->addHTML( $description . $output . $links );
155165 } else {
156166 $wgOut->addHTML( $description . $links . $output . $links );
@@ -214,7 +224,7 @@
215225 } else {
216226 $defaults['task'] = 'reviewall';
217227 }
218 - } elseif( $nondefaults['taction'] === 'export' ) {
 228+ } elseif ( $nondefaults['taction'] === 'export' ) {
219229 $defaults['task'] = '';
220230 }
221231 }
@@ -655,7 +665,7 @@
656666 if ( trim( $sub ) !== '' ) {
657667 if ( $alias === 'Translate' || $alias === 'MessageGroupStats' ) {
658668 $params['group'] = $sub;
659 - } elseif( $alias === 'LanguageStats' ) {
 669+ } elseif ( $alias === 'LanguageStats' ) {
660670 // Breaks if additional parameters besides language are code provided
661671 $params['language'] = $sub;
662672 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r112670Wording tweaks, ping r112667 and r112666nikerabbit08:36, 29 February 2012
r112672Parse the messages and pass the reason as variablenikerabbit09:21, 29 February 2012

Comments

#Comment by Siebrand (talk | contribs)   07:44, 29 February 2012

New messages contain grammar and spelling errors.

#Comment by Nikerabbit (talk | contribs)   08:19, 29 February 2012

Instead of wfMsg should probably use wfMessage( ... )->parseAsBlock() to parse it.

Status & tagging log