r79938 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79937‎ | r79938 | r79939 >
Date:16:08, 10 January 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Work on special page
Modified paths:
  • /trunk/extensions/LiveTranslate/LiveTranslate.i18n.php (modified) (history)
  • /trunk/extensions/LiveTranslate/specials/SpecialLiveTranslate.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LiveTranslate/LiveTranslate.i18n.php
@@ -34,6 +34,7 @@
3535 'livetranslate-tmtype-ltf' => 'Live Translate format',
3636 'livetranslate-tmtype-tmx' => 'Translation Memory eXchange',
3737 'livetranslate-tmtype-gcsv' => 'Google CSV',
 38+ 'livetranslate-special-no-tms-yet' => 'There are no translation memories yet.',
3839 );
3940
4041 /** Belarusian (Taraškievica orthography) (Беларуская (тарашкевіца))
Index: trunk/extensions/LiveTranslate/specials/SpecialLiveTranslate.php
@@ -76,7 +76,79 @@
7777 return;
7878 }
7979
80 - // TODO
 80+ $this->displayTMConfig();
8181 }
8282
 83+ /**
 84+ * Displays the translation memories config table.
 85+ *
 86+ * @since 0.4
 87+ */
 88+ protected function displayTMConfig() {
 89+ global $wgOut;
 90+
 91+ $tms = $this->getTMConfigItems();
 92+
 93+ if ( count( $tms ) > 0 ) {
 94+ foreach ( $tms as $tm ) {
 95+ $this->displayTMItem( $tm );
 96+ }
 97+ }
 98+ else {
 99+ $wgOut->addWikiMsg( 'livetranslate-special-no-tms-yet' );
 100+ }
 101+
 102+ $this->displayAddNewTM();
 103+ }
 104+
 105+ /**
 106+ * Displays a single row in the translation memories config table.
 107+ *
 108+ * @since 0.4
 109+ *
 110+ * @return array
 111+ */
 112+ protected function getTMConfigItems() {
 113+ $dbr = wfGetDB( DB_SLAVE );
 114+
 115+ $res = $dbr->select(
 116+ 'live_translate_memories',
 117+ array( 'memory_id', 'memory_type', 'memory_location' ),
 118+ array(),
 119+ __METHOD__,
 120+ array( 'LIMIT' => '5000' )
 121+ );
 122+
 123+ $tms = array();
 124+
 125+ // Iterate over the result items in the result wrapper to end up with a regular array.
 126+ foreach ( $res as $tm ) {
 127+ $tms[] = $tm;
 128+ }
 129+
 130+ return $tms;
 131+ }
 132+
 133+ /**
 134+ * Displays a single row in the translation memories config table.
 135+ *
 136+ * @since 0.4
 137+ *
 138+ * @param object $tm
 139+ */
 140+ protected function displayTMItem( $tm ) {
 141+ global $wgOut;
 142+
 143+
 144+ }
 145+
 146+ /**
 147+ * Displays an input to add a new translation memory.
 148+ *
 149+ * @since 0.4
 150+ */
 151+ protected function displayAddNewTM() {
 152+
 153+ }
 154+
83155 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r79939Follow up to r79938jeroendedauw16:31, 10 January 2011
r79943Follow up to r79938jeroendedauw18:26, 10 January 2011
r79948Follow up to r79938jeroendedauw18:58, 10 January 2011

Status & tagging log