Index: trunk/extensions/LiveTranslate/LiveTranslate.php |
— | — | @@ -24,7 +24,7 @@ |
25 | 25 | die( 'Not an entry point.' ); |
26 | 26 | } |
27 | 27 | |
28 | | -define( 'LiveTranslate_VERSION', '1.1' ); |
| 28 | +define( 'LiveTranslate_VERSION', '1.1.1 alpha' ); |
29 | 29 | |
30 | 30 | $wgExtensionCredits['other'][] = array( |
31 | 31 | 'path' => __FILE__, |
Index: trunk/extensions/LiveTranslate/LiveTranslate.hooks.php |
— | — | @@ -24,7 +24,7 @@ |
25 | 25 | * @return true |
26 | 26 | */ |
27 | 27 | public static function onArticleViewHeader( Article &$article, &$outputDone, &$useParserCache ) { |
28 | | - global $egGoogleApiKey, $egLiveTranslateLanguages; |
| 28 | + global $egLiveTranslateLanguages; |
29 | 29 | |
30 | 30 | $title = $article->getTitle(); |
31 | 31 | |
— | — | @@ -36,7 +36,7 @@ |
37 | 37 | $outputDone = true; // The translations themselves should not be shown. |
38 | 38 | } |
39 | 39 | else if ( |
40 | | - $egGoogleApiKey != '' |
| 40 | + LiveTranslateFunctions::hasTranslationService() |
41 | 41 | && $article->exists() |
42 | 42 | && ( count( $egLiveTranslateLanguages ) > 1 || ( count( $egLiveTranslateLanguages ) == 1 && $egLiveTranslateLanguages[0] != $currentLang ) ) ) { |
43 | 43 | |
— | — | @@ -152,7 +152,7 @@ |
153 | 153 | * @param string $currentLang |
154 | 154 | */ |
155 | 155 | protected static function displayTranslationControl( $currentLang ) { |
156 | | - global $wgOut, $egGoogleApiKey; |
| 156 | + global $wgOut; |
157 | 157 | |
158 | 158 | $divContents = htmlspecialchars( wfMsg( 'livetranslate-translate-to' ) ) . |
159 | 159 | ' ' . |
— | — | @@ -168,10 +168,10 @@ |
169 | 169 | 'button', |
170 | 170 | array( 'id' => 'ltrevertbutton', 'style' => 'display:none' ), |
171 | 171 | wfMsg( 'livetranslate-button-revert' ) |
172 | | - ); |
| 172 | + ); |
173 | 173 | |
174 | 174 | 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>'; |
176 | 176 | } |
177 | 177 | |
178 | 178 | $wgOut->addHTML( |
Index: trunk/extensions/LiveTranslate/includes/LiveTranslate_Functions.php |
— | — | @@ -418,4 +418,18 @@ |
419 | 419 | return $type; |
420 | 420 | } |
421 | 421 | |
| 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 | + |
422 | 436 | } |
\ No newline at end of file |