r79833 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79832‎ | r79833 | r79834 >
Date:19:32, 7 January 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Added check to see if the api key is set and updated release notes for 0.3
Modified paths:
  • /trunk/extensions/LiveTranslate/LiveTranslate.hooks.php (modified) (history)
  • /trunk/extensions/LiveTranslate/LiveTranslate.php (modified) (history)
  • /trunk/extensions/LiveTranslate/RELEASE-NOTES (modified) (history)

Diff [purge]

Index: trunk/extensions/LiveTranslate/LiveTranslate.php
@@ -25,7 +25,7 @@
2626 die( 'Not an entry point.' );
2727 }
2828
29 -define( 'LiveTranslate_VERSION', '0.3 alpha' );
 29+define( 'LiveTranslate_VERSION', '0.3 rc1' );
3030
3131 $wgExtensionCredits['other'][] = array(
3232 'path' => __FILE__,
Index: trunk/extensions/LiveTranslate/LiveTranslate.hooks.php
@@ -73,7 +73,9 @@
7474
7575 $outputDone = true;
7676 }
77 - else if ( $article->exists()
 77+ else if (
 78+ $egGoogleApiKey != ''
 79+ && $article->exists()
7880 && ( count( $egLiveTranslateLanguages ) > 1 || ( count( $egLiveTranslateLanguages ) == 1 && $egLiveTranslateLanguages[0] != $currentLang ) ) ) {
7981 $wgOut->addHTML(
8082 '<span class="notranslate" id="livetranslatespan">' .
@@ -101,18 +103,18 @@
102104 ) .
103105 '</span>'
104106 );
 107+
 108+ $wgOut->addScript(
 109+ Html::linkedScript( 'https://www.google.com/jsapi?key=' . htmlspecialchars( $egGoogleApiKey ) ) .
 110+ Html::inlineScript(
 111+ 'google.load("language", "1");' .
 112+ 'var sourceLang = ' . json_encode( $currentLang ) . ';'
 113+ )
 114+ );
 115+
 116+ LiveTranslateFunctions::loadJs();
105117 }
106118
107 - $wgOut->addScript(
108 - Html::linkedScript( 'https://www.google.com/jsapi?key=' . htmlspecialchars( $egGoogleApiKey ) ) .
109 - Html::inlineScript(
110 - 'google.load("language", "1");' .
111 - 'var sourceLang = ' . json_encode( $currentLang ) . ';'
112 - )
113 - );
114 -
115 - LiveTranslateFunctions::loadJs();
116 -
117119 return true;
118120 }
119121
Index: trunk/extensions/LiveTranslate/RELEASE-NOTES
@@ -5,9 +5,11 @@
66
77
88 === Version 0.3 ===
9 -2011-01-xx
 9+2011-01-07
1010
 11+* Added compatibility with IE8.
1112 * Fixed issue with trim-prevention, causing |-signs to semi-randomly get inserted into translated text.
 13+* Only show the translation control when an API key is provided.
1214
1315 === Version 0.2 ===
1416 2010-12-24

Status & tagging log