r79937 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79936‎ | r79937 | r79938 >
Date:15:29, 10 January 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Added special page stub
Modified paths:
  • /trunk/extensions/LiveTranslate/LiveTranslate.i18n.php (modified) (history)
  • /trunk/extensions/LiveTranslate/LiveTranslate.php (modified) (history)
  • /trunk/extensions/LiveTranslate/LiveTranslate_Settings.php (modified) (history)
  • /trunk/extensions/LiveTranslate/specials (added) (history)
  • /trunk/extensions/LiveTranslate/specials/SpecialLiveTranslate.php (added) (history)

Diff [purge]

Index: trunk/extensions/LiveTranslate/LiveTranslate.i18n.php
@@ -27,7 +27,13 @@
2828 // Special words dictionary
2929 'livetranslate-dictionary-empty' => 'There are no words in the dictionary yet. Click the "edit" tab to add some.',
3030 'livetranslate-dictionary-count' => 'There {{PLURAL:$1|is $1 word|are $1 words}} in $2 {{PLURAL:$2|language|languages}}. Click the "edit" tab to add more.',
31 - 'livetranslate-dictionary-unallowed-langs' => '{{PLURAL:$2|This language is|These languages are}} not currently set as allowed translation target: $1. Modify the allowed languages in your wikis configuration, or remove these from the dictionary.'
 31+ 'livetranslate-dictionary-unallowed-langs' => '{{PLURAL:$2|This language is|These languages are}} not currently set as allowed translation target: $1. Modify the allowed languages in your wikis configuration, or remove these from the dictionary.',
 32+
 33+ // Special:LiveTranslate
 34+ 'special-livetranslate' => 'Live translate',
 35+ 'livetranslate-tmtype-ltf' => 'Live Translate format',
 36+ 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange',
 37+ 'livetranslate-tmtype-gcsv' => 'Google CSV',
3238 );
3339
3440 /** Belarusian (Taraškievica orthography) (Беларуская (тарашкевіца))
Index: trunk/extensions/LiveTranslate/LiveTranslate.php
@@ -57,6 +57,11 @@
5858 $wgAutoloadClasses['LTTranslationMemory'] = $incDirIP . 'LT_TranslationMemory.php';
5959 unset( $incDirIP );
6060
 61+$wgAutoloadClasses['SpecialLiveTranslate'] = $egLiveTranslateIP . '/specials/SpecialLiveTranslate.php';
 62+
 63+$wgSpecialPages['LiveTranslate'] = 'SpecialLiveTranslate';
 64+$wgSpecialPageGroups['LiveTranslate'] = 'pagetools';
 65+
6166 $wgAPIModules['livetranslate'] = 'ApiLiveTranslate';
6267 $wgAPIListModules['livetranslate'] = 'ApiQueryLiveTranslate';
6368
Index: trunk/extensions/LiveTranslate/LiveTranslate_Settings.php
@@ -38,3 +38,6 @@
3939 $egLiveTranslateGCVSFiles = array(
4040
4141 );
 42+
 43+# Permission to mannage translation memories.
 44+$wgGroupPermissions['sysop']['managetms'] = true;
Index: trunk/extensions/LiveTranslate/specials/SpecialLiveTranslate.php
@@ -0,0 +1,82 @@
 2+<?php
 3+
 4+/**
 5+ * Page to manage LiveTranslate translation memories.
 6+ *
 7+ * @since 0.4
 8+ *
 9+ * @file SpecialLiveTranslate.php
 10+ * @ingroup LiveTranslate
 11+ *
 12+ * @licence GNU GPL v3 or later
 13+ * @author Jeroen De Dauw < jeroendedauw@gmail.com >
 14+ */
 15+class SpecialLiveTranslate extends SpecialPage {
 16+
 17+ /**
 18+ * Map type numbers to messages.
 19+ * Messages are build by prepending "livetranslate-tmtype-" and then passing it to wfMsg or similar.
 20+ *
 21+ * @since 0.4
 22+ *
 23+ * @var array
 24+ */
 25+ protected static $tmTypes = array(
 26+ 0 => 'ltf',
 27+ 1 => 'tmx',
 28+ 2 => 'gcsv',
 29+ );
 30+
 31+ /**
 32+ * Constructor.
 33+ *
 34+ * @since 0.4
 35+ */
 36+ public function __construct() {
 37+ parent::__construct( 'LiveTranslate', 'managetms' );
 38+ }
 39+
 40+ /**
 41+ * @see SpecialPage::getDescription
 42+ *
 43+ * @since 0.4
 44+ */
 45+ public function getDescription() {
 46+ return wfMsg( 'special-' . strtolower( $this->mName ) );
 47+ }
 48+
 49+ /**
 50+ * Sets headers - this should be called from the execute() method of all derived classes!
 51+ *
 52+ * @since 0.4
 53+ */
 54+ public function setHeaders() {
 55+ global $wgOut;
 56+ $wgOut->setArticleRelated( false );
 57+ $wgOut->setRobotPolicy( "noindex,nofollow" );
 58+ $wgOut->setPageTitle( $this->getDescription() );
 59+ }
 60+
 61+ /**
 62+ * Main method.
 63+ *
 64+ * @since 0.4
 65+ *
 66+ * @param string $arg
 67+ */
 68+ public function execute( $arg ) {
 69+ global $wgOut, $wgUser, $wgRequest, $egPushTargets;
 70+
 71+ $this->setHeaders();
 72+ $this->outputHeader();
 73+
 74+ // If the user is authorized, display the page, if not, show an error.
 75+ if ( !$this->userCanExecute( $wgUser ) ) {
 76+ $this->displayRestrictionError();
 77+ return;
 78+ }
 79+
 80+ // TODO
 81+ }
 82+
 83+}
Property changes on: trunk/extensions/LiveTranslate/specials/SpecialLiveTranslate.php
___________________________________________________________________
Added: svn:eol-style
184 + native

Status & tagging log