r89826 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89825‎ | r89826 | r89827 >
Date:15:35, 10 June 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
added app id setting for ms translation service
Modified paths:
  • /trunk/extensions/LiveTranslate/LiveTranslate_Settings.php (modified) (history)
  • /trunk/extensions/LiveTranslate/includes/LiveTranslate_Functions.php (modified) (history)
  • /trunk/extensions/LiveTranslate/includes/ext.lt.ms.js (modified) (history)

Diff [purge]

Index: trunk/extensions/LiveTranslate/LiveTranslate_Settings.php
@@ -63,4 +63,8 @@
6464 # When true, this prevents storange of translations that are the same in the source and target language.
6565 $egLTRequireSignificance = false;
6666
 67+# When true, debugging messages will be logged using console.log(). Do not use on production wikis.
6768 $egLiveTranslateDebugJS = false;
 69+
 70+# Microsoft App Id, needed when using the Microsoft Translation service.
 71+$egLiveTranslateMSAppId = '';
Index: trunk/extensions/LiveTranslate/includes/ext.lt.ms.js
@@ -87,7 +87,7 @@
8888 $.getJSON(
8989 'http://api.microsofttranslator.com/V2/Ajax.svc/Translate?oncomplete=?',
9090 {
91 - 'appId': '9B1B396B48BBA6BF483B6C0A83CE2B07EF5D8F8C', // TODO
 91+ 'appId': window.ltMsAppId,
9292 'from': sourceLang,
9393 'to': targetLang,
9494 'text': jQuery.trim( chunk ) // Trim, so the result does not contain preceding or tailing spaces.
Index: trunk/extensions/LiveTranslate/includes/LiveTranslate_Functions.php
@@ -41,6 +41,11 @@
4242 break;
4343 case LTS_MS:
4444 $modules[] = 'ext.lt.ms';
 45+ $wgOut->addScript(
 46+ Html::inlineScript(
 47+ 'var ltMsAppId = ' . FormatJson::encode( $GLOBALS['egLiveTranslateMSAppId'] ) . ';'
 48+ )
 49+ );
4550 break;
4651 }
4752

Status & tagging log