r71337 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71336‎ | r71337 | r71338 >
Date:09:07, 20 August 2010
Author:nikerabbit
Status:ok
Tags:
Comment:
Tweak documentation
Modified paths:
  • /trunk/extensions/Translate/Translate.php (modified) (history)
  • /trunk/extensions/Translate/check-blacklist.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/check-blacklist.php
@@ -1,16 +1,16 @@
22 <?php
33 /**
4 - * @file
 4+ * List of checks that should not be performed.
 5+ *
 6+ * The array takes input of arrays which define constraints. Checks which match
 7+ * those constrains are skipped. Possible constrains are <tt>group</tt>,
 8+ * <tt>check</tt>, <tt>code</tt> and <tt>message</tt>.
 9+ * @todo Use YAML?
 10+ *
511 * @author Niklas Laxström
612 * @copyright Copyright © 2008-2010, Niklas Laxström
713 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
814 */
9 -
10 -/**
11 - * List of checks that should not be performed.
12 - *
13 - * @todo Needs documentation.
14 - */
1515 $checkBlacklist = array(
1616
1717 array(
Index: trunk/extensions/Translate/Translate.php
@@ -30,92 +30,49 @@
3131 );
3232
3333 /**
34 - * Setup class autoloads
 34+ * @cond file_level_code
 35+ * Setup class autoloading.
3536 */
3637 $dir = dirname( __FILE__ ) . '/';
3738 require_once( $dir . '_autoload.php' );
 39+/** @endcond */
3840
3941 /**
40 - * Register extension messages files.
 42+ * @cond file_level_code
4143 */
 44+
 45+// Register extension messages and other localisation.
4246 $wgExtensionMessagesFiles['Translate'] = $dir . 'Translate.i18n.php';
4347 $wgExtensionMessagesFiles['FirstSteps'] = $dir . 'FirstSteps.i18n.php';
4448 $wgExtensionMessagesFiles['PageTranslation'] = $dir . 'PageTranslation.i18n.php';
45 -
46 -/**
47 - * Register special page aliases.
48 - */
4949 $wgExtensionAliasesFiles['Translate'] = $dir . 'Translate.alias.php';
5050
51 -/**
52 - * Init hook.
53 - */
 51+// Register initialization hook
5452 $wgExtensionFunctions[] = 'efTranslateInit';
5553
56 -/**
57 - * Setup special pages
58 - */
59 -
60 -/**
61 - * Special:Translate
62 - */
 54+// Register special pages into MediaWiki
6355 $wgSpecialPages['Translate'] = 'SpecialTranslate';
6456 $wgSpecialPageGroups['Translate'] = 'wiki';
65 -
66 -/**
67 - * Special:Translations
68 - */
6957 $wgSpecialPages['Translations'] = 'SpecialTranslations';
7058 $wgSpecialPageGroups['Translations'] = 'pages';
71 -
72 -/**
73 - * Special:AdvancedTranslate
74 - */
7559 $wgSpecialPages['Magic'] = 'SpecialMagic';
7660 $wgSpecialPageGroups['Magic'] = 'wiki';
77 -
78 -/**
79 - * Special:TranslationChanges
80 - */
8161 $wgSpecialPages['TranslationChanges'] = 'SpecialTranslationChanges';
8262 $wgSpecialPageGroups['TranslationChanges'] = 'changes';
83 -
84 -/**
85 - * Special:TranslationStats
86 - */
8763 $wgSpecialPages['TranslationStats'] = 'SpecialTranslationStats';
8864 $wgSpecialPageGroups['TranslationStats'] = 'wiki';
89 -
90 -/**
91 - * Special:LanguageStats
92 - */
9365 $wgSpecialPages['LanguageStats'] = 'SpecialLanguageStats';
9466 $wgSpecialPageGroups['LanguageStats'] = 'wiki';
95 -
96 -/**
97 - * Special:ImportTranslations
98 - */
9967 $wgSpecialPages['ImportTranslations'] = 'SpecialImportTranslations';
10068 $wgSpecialPageGroups['ImportTranslations'] = 'wiki';
101 -
102 -/**
103 - * Special:FirstSteps. Unlisted special page; does not need $wgSpecialPageGroups.
104 - */
 69+// Unlisted special page; does not need $wgSpecialPageGroups.
10570 $wgSpecialPages['FirstSteps'] = 'SpecialFirstSteps';
106 -
107 -/**
108 - * Special:SupportedLanguages. Unlisted special page; does not need $wgSpecialPageGroups.
109 - */
 71+// Unlisted special page; does not need $wgSpecialPageGroups.
11072 $wgSpecialPages['SupportedLanguages'] = 'SpecialSupportedLanguages';
111 -
112 -/**
113 - * Special:MyLanguage. Unlisted special page; does not need $wgSpecialPageGroups.
114 - */
 73+// Unlisted special page; does not need $wgSpecialPageGroups.
11574 $wgSpecialPages['MyLanguage'] = 'SpecialMyLanguage';
11675
117 -/**
118 - * Register hooks.
119 - */
 76+// Register hooks.
12077 $wgHooks['EditPage::showEditForm:initial'][] = 'TranslateEditAddons::addTools';
12178 $wgHooks['OutputPageBeforeHTML'][] = 'TranslateEditAddons::addNavigation';
12279 $wgHooks['AlternateEdit'][] = 'TranslateEditAddons::intro';
@@ -124,9 +81,7 @@
12582 $wgHooks['SkinTemplateTabs'][] = 'TranslateEditAddons::tabs';
12683 # $wgHooks['ArticleAfterFetchContent'][] = 'TranslateEditAddons::customDisplay';
12784
128 -/**
129 - * Custom preferences
130 - */
 85+// Custom preferences
13186 $wgDefaultUserOptions['translate'] = 0;
13287 $wgDefaultUserOptions['translate-editlangs'] = 'default';
13388 $wgDefaultUserOptions['translate-jsedit'] = 1;
@@ -134,23 +89,22 @@
13590 $wgHooks['GetPreferences'][] = 'TranslatePreferences::translationAssistLanguages';
13691 $wgHooks['GetPreferences'][] = 'TranslatePreferences::translationJsedit';
13792
138 -/**
139 - * Recent changes filters
140 - */
 93+// Recent changes filters
14194 $wgHooks['SpecialRecentChangesQuery'][] = 'TranslateRcFilter::translationFilter';
14295 $wgHooks['SpecialRecentChangesPanel'][] = 'TranslateRcFilter::translationFilterForm';
14396 $wgHooks['SkinTemplateToolboxEnd'][] = 'TranslateToolbox::toolboxAllTranslations';
14497
145 -/**
146 - * Translation memory updates
147 - */
 98+// Translation memory updates
14899 $wgHooks['ArticleSaveComplete'][] = 'TranslationMemoryUpdater::update';
149100
 101+// New rights
150102 $wgAvailableRights[] = 'translate';
151103 $wgAvailableRights[] = 'translate-import';
152104 $wgAvailableRights[] = 'translate-manage';
153105
 106+/** @endcond */
154107
 108+
155109 # == Configuration variables ==
156110
157111 # === Basic configuration ===
@@ -186,6 +140,7 @@
187141 /**
188142 * Define various web services that provide translation suggestions.
189143 * Example for tmserver translation memory from translatetoolkit.
 144+ * <pre>
190145 * $wgTranslateTranslationServices['tmserver'] = array(
191146 * 'server' => 'http://127.0.0.1',
192147 * 'port' => 54321,
@@ -194,6 +149,7 @@
195150 * 'database' => '/path/to/database.sqlite',
196151 * 'type' => 'tmserver',
197152 * );
 153+ * </pre>
198154 *
199155 * For Google and Apertium, you should get an API key.
200156 * @see http://wiki.apertium.org/wiki/Apertium_web_service
@@ -251,7 +207,7 @@
252208 * Page translation feature allows structured translation of wiki pages
253209 * with simple markup and automatic tracking of changes.
254210 *
255 - * @defgroup PageTranslation Page translation
 211+ * @defgroup PageTranslation Page Translation
256212 * @see http://translatewiki.net/wiki/Translating:Page_translation_feature
257213 */
258214 $wgEnablePageTranslation = false;
@@ -446,7 +402,8 @@
447403 # Startup code
448404
449405 /**
450 - * Initialise extension.
 406+ * Initialises the extension.
 407+ * @private
451408 */
452409 function efTranslateInit() {
453410 global $wgTranslatePHPlot, $wgAutoloadClasses, $wgHooks;
@@ -598,7 +555,9 @@
599556 }
600557
601558 /**
602 - * Check if Page Translation was set up properly.
 559+ * Checks if page translation was set up properly.
 560+ * @ingroup PageTranslation
 561+ * @private
603562 */
604563 function efTranslateCheckPT() {
605564 global $wgHooks, $wgMemc, $wgCommandLineMode;
@@ -644,38 +603,46 @@
645604 return true;
646605 }
647606
 607+/**
 608+ * Replaces the sitenotice with a warning that the extension is not
 609+ * set up properly. Also disables caching to avoid the notices getting
 610+ * stuck.
 611+ * @param $msg \string Message key
 612+ * @param $sitenotice \string
 613+ * @return \bool true
 614+ */
648615 function efTranslateCheckWarn( $msg, &$sitenotice ) {
649616 global $wgOut;
650 -
651617 $sitenotice = wfMsg( $msg );
652618 $wgOut->enableClientCache( false );
653 -
654619 return true;
655620 }
656621
 622+/**
 623+ * Registers \<languages> tag with the parser.
 624+ * @param $parser Parser
 625+ * @return \bool true
 626+ */
657627 function efTranslateInitTags( $parser ) {
658 - /**
659 - * For nice language list in-page
660 - */
 628+ // For nice language list in-page
661629 $parser->setHook( 'languages', array( 'PageTranslationHooks', 'languages' ) );
662 -
663630 return true;
664631 }
665632
666 -/**
667 - * @todo document
668 - */
 633+/** @cond cli_support */
669634 if ( !defined( 'TRANSLATE_CLI' ) ) {
670635 function STDOUT() { }
671636 function STDERR() { }
672637 }
 638+/** @endcond */
673639
674640 /**
675641 * Helper function for adding namespace for message groups.
 642+ *
676643 * It defines constants for the namespace (and talk namespace) and sets up
677644 * restrictions and some other configuration.
678 - * @param $id int Namespace number
679 - * @param $name Name of the namespace
 645+ * @param $id \int Namespace number
 646+ * @param $name \string Name of the namespace
680647 */
681648 function wfAddNamespace( $id, $name ) {
682649 global $wgExtraNamespaces, $wgContentNamespaces,

Status & tagging log