r90238 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90237‎ | r90238 | r90239 >
Date:22:23, 16 June 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
fixed css issue, some more general translation service handling and version nr increment
Modified paths:
  • /trunk/extensions/LiveTranslate/LiveTranslate.hooks.php (modified) (history)
  • /trunk/extensions/LiveTranslate/LiveTranslate.php (modified) (history)
  • /trunk/extensions/LiveTranslate/includes/LiveTranslate_Functions.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LiveTranslate/LiveTranslate.php
@@ -24,7 +24,7 @@
2525 die( 'Not an entry point.' );
2626 }
2727
28 -define( 'LiveTranslate_VERSION', '1.1' );
 28+define( 'LiveTranslate_VERSION', '1.1.1 alpha' );
2929
3030 $wgExtensionCredits['other'][] = array(
3131 'path' => __FILE__,
Index: trunk/extensions/LiveTranslate/LiveTranslate.hooks.php
@@ -24,7 +24,7 @@
2525 * @return true
2626 */
2727 public static function onArticleViewHeader( Article &$article, &$outputDone, &$useParserCache ) {
28 - global $egGoogleApiKey, $egLiveTranslateLanguages;
 28+ global $egLiveTranslateLanguages;
2929
3030 $title = $article->getTitle();
3131
@@ -36,7 +36,7 @@
3737 $outputDone = true; // The translations themselves should not be shown.
3838 }
3939 else if (
40 - $egGoogleApiKey != ''
 40+ LiveTranslateFunctions::hasTranslationService()
4141 && $article->exists()
4242 && ( count( $egLiveTranslateLanguages ) > 1 || ( count( $egLiveTranslateLanguages ) == 1 && $egLiveTranslateLanguages[0] != $currentLang ) ) ) {
4343
@@ -152,7 +152,7 @@
153153 * @param string $currentLang
154154 */
155155 protected static function displayTranslationControl( $currentLang ) {
156 - global $wgOut, $egGoogleApiKey;
 156+ global $wgOut;
157157
158158 $divContents = htmlspecialchars( wfMsg( 'livetranslate-translate-to' ) ) .
159159 ' ' .
@@ -168,10 +168,10 @@
169169 'button',
170170 array( 'id' => 'ltrevertbutton', 'style' => 'display:none' ),
171171 wfMsg( 'livetranslate-button-revert' )
172 - );
 172+ );
173173
174174 if ( $GLOBALS['egLiveTranslateService'] == LTS_GOOGLE ) {
175 - $divContents .= '<br /><br /><div id="googlebranding" style="display:inline; float:right"></div>';
 175+ $divContents .= '<br /><br /><div id="googlebranding" style="display:inline; position:absolute; right: 0px"></div>';
176176 }
177177
178178 $wgOut->addHTML(
Index: trunk/extensions/LiveTranslate/includes/LiveTranslate_Functions.php
@@ -418,4 +418,18 @@
419419 return $type;
420420 }
421421
 422+ /**
 423+ * Returns if there is a translation service that can be used or not.
 424+ *
 425+ * @since 1.1.1
 426+ *
 427+ * @return boolean
 428+ */
 429+ public static function hasTranslationService() {
 430+ global $egLiveTranslateService, $egGoogleApiKey, $egLiveTranslateMSAppId;
 431+
 432+ return ( $egLiveTranslateService == LTS_GOOGLE && $egGoogleApiKey != '' )
 433+ || ( $egLiveTranslateService == LTS_MS && $egLiveTranslateMSAppId != '' );
 434+ }
 435+
422436 }
\ No newline at end of file

Status & tagging log