r34943 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r34942‎ | r34943 | r34944 >
Date:21:49, 16 May 2008
Author:nikerabbit
Status:old
Tags:
Comment:
* $wgTranslateBlacklist
Modified paths:
  • /trunk/extensions/Translate/Translate.i18n.php (modified) (history)
  • /trunk/extensions/Translate/Translate.php (modified) (history)
  • /trunk/extensions/Translate/TranslatePage.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/TranslatePage.php
@@ -33,7 +33,7 @@
3434 wfMemIn( __METHOD__ );
3535 wfLoadExtensionMessages( 'Translate' );
3636 TranslateUtils::injectCSS();
37 - global $wgOut;
 37+ global $wgOut, $wgTranslateBlacklist;
3838
3939 $this->setup();
4040 $this->setHeaders();
@@ -59,6 +59,20 @@
6060 if ( count($errors) ) {
6161 wfMemOut( __METHOD__ );
6262 return;
 63+ } else {
 64+ $checks = array(
 65+ $this->options['group'],
 66+ strtok( $this->options['group'], '-' ),
 67+ '*'
 68+ );
 69+
 70+ foreach ( $checks as $check ) {
 71+ $reason = @$wgTranslateBlacklist[$check][$this->options['language']];
 72+ if ( $reason !== null ) {
 73+ $wgOut->addWikiMsg( self::MSG . 'disabled', $reason );
 74+ return;
 75+ }
 76+ }
6377 }
6478
6579 # Proceed
Index: trunk/extensions/Translate/Translate.php
@@ -11,7 +11,7 @@
1212 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
1313 */
1414
15 -define( 'TRANSLATE_VERSION', '8.37' );
 15+define( 'TRANSLATE_VERSION', '8.36' );
1616
1717 $wgExtensionCredits['specialpage'][] = array(
1818 'name' => 'Translate',
@@ -85,6 +85,28 @@
8686 /** Language code for special documentation language */
8787 $wgTranslateDocumentationLanguageCode = false;
8888
 89+/**
 90+ * Two-dimensional array of languages that cannot be translated.
 91+ * Input can be exact group name, first part before '-' or '*' for all.
 92+ * Second dimension should be language code mapped to reason for disabling.
 93+ * Reason is parsed as wikitext.
 94+ *
 95+ * Example:
 96+ * $wgTranslateBlacklist = array(
 97+ * '*' => array( // All groups
 98+ * 'en' => 'English is the source language.',
 99+ * ),
 100+ * 'core' => array( // Exact group
 101+ * 'mul' => 'Not a real language.',
 102+ * ),
 103+ * 'ext' => array( // Wildcard-like group
 104+ * 'mul' => 'Not a real language',
 105+ * ),
 106+ * );
 107+ */
 108+
 109+$wgTranslateBlacklist = array();
 110+
89111 /** AC = Available classes */
90112 $wgTranslateAC = array(
91113 'core' => 'CoreMessageGroup',
@@ -144,12 +166,11 @@
145167 'ext-didyoumean' => 'DidYouMeanMessageGroup',
146168 'ext-dismissablesitenotice' => 'DismissableSiteNoticeMessageGroup',
147169 'ext-doublewiki' => 'DoubleWikiMessageGroup',
148 -'ext-dplforum' => 'DPLForumMessageGroup',
149170 'ext-duplicator' => 'DuplicatorMessageGroup',
150171 'ext-editcount' => 'EditcountMessageGroup',
151172 'ext-editmessages' => 'EditMessagesMessageGroup',
152173 'ext-editown' => 'EditOwnMessageGroup',
153 -'ext-editsubpages' => 'EditSubpagesMessageGroup',
 174+'ext-editsubpages' => 'EditSubpagesMessageGroup',
154175 'ext-edituser' => 'EditUserMessageGroup',
155176 'ext-emailaddressimage' => 'EmailAddressImageMessageGroup',
156177 'ext-eval' => 'EvalMessageGroup',
@@ -171,7 +192,6 @@
172193 'ext-i18ntags' => 'I18nTagsMessageGroup',
173194 'ext-icon' => 'IconMessageGroup',
174195 'ext-imagemap' => 'ImageMapMessageGroup',
175 -'ext-imagetagging' => 'ImageTaggingMessageGroup',
176196 'ext-importfreeimages' => 'ImportFreeImagesMessageGroup',
177197 'ext-importusers' => 'ImportUsersMessageGroup',
178198 'ext-inputbox' => 'InputBoxMessageGroup',
Index: trunk/extensions/Translate/Translate.i18n.php
@@ -30,6 +30,10 @@
3131 'translate-page-no-such-task' => 'Specified task was invalid.',
3232 'translate-page-no-such-group' => 'Specified group was invalid.',
3333
 34+ 'translate-page-disabled' => "Translations to this language in this group has been disabled. Reason:
 35+
 36+''$1''",
 37+
3438 'translate-page-settings-legend' => 'Settings',
3539 'translate-page-task' => 'I want to',
3640 'translate-page-group' => 'Group',

Follow-up revisions

RevisionCommit summaryAuthorDate
r34954Fixes on r34943...siebrand07:48, 17 May 2008

Status & tagging log