http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89826
Revision: 89826
Author: jeroendedauw
Date: 2011-06-10 15:35:24 +0000 (Fri, 10 Jun 2011)
Log Message:
-----------
added app id setting for ms translation service
Modified Paths:
--------------
trunk/extensions/LiveTranslate/LiveTranslate_Settings.php
trunk/extensions/LiveTranslate/includes/LiveTranslate_Functions.php
trunk/extensions/LiveTranslate/includes/ext.lt.ms.js
Modified: trunk/extensions/LiveTranslate/LiveTranslate_Settings.php
===================================================================
--- trunk/extensions/LiveTranslate/LiveTranslate_Settings.php 2011-06-10
14:14:13 UTC (rev 89825)
+++ trunk/extensions/LiveTranslate/LiveTranslate_Settings.php 2011-06-10
15:35:24 UTC (rev 89826)
@@ -63,4 +63,8 @@
# When true, this prevents storange of translations that are the same in the
source and target language.
$egLTRequireSignificance = false;
+# When true, debugging messages will be logged using console.log(). Do not use
on production wikis.
$egLiveTranslateDebugJS = false;
+
+# Microsoft App Id, needed when using the Microsoft Translation service.
+$egLiveTranslateMSAppId = '';
Modified: trunk/extensions/LiveTranslate/includes/LiveTranslate_Functions.php
===================================================================
--- trunk/extensions/LiveTranslate/includes/LiveTranslate_Functions.php
2011-06-10 14:14:13 UTC (rev 89825)
+++ trunk/extensions/LiveTranslate/includes/LiveTranslate_Functions.php
2011-06-10 15:35:24 UTC (rev 89826)
@@ -41,6 +41,11 @@
break;
case LTS_MS:
$modules[] = 'ext.lt.ms';
+ $wgOut->addScript(
+ Html::inlineScript(
+ 'var ltMsAppId = ' .
FormatJson::encode( $GLOBALS['egLiveTranslateMSAppId'] ) . ';'
+ )
+ );
break;
}
Modified: trunk/extensions/LiveTranslate/includes/ext.lt.ms.js
===================================================================
--- trunk/extensions/LiveTranslate/includes/ext.lt.ms.js 2011-06-10
14:14:13 UTC (rev 89825)
+++ trunk/extensions/LiveTranslate/includes/ext.lt.ms.js 2011-06-10
15:35:24 UTC (rev 89826)
@@ -87,7 +87,7 @@
$.getJSON(
'http://api.microsofttranslator.com/V2/Ajax.svc/Translate?oncomplete=?',
{
- 'appId':
'9B1B396B48BBA6BF483B6C0A83CE2B07EF5D8F8C', // TODO
+ 'appId': window.ltMsAppId,
'from': sourceLang,
'to': targetLang,
'text': jQuery.trim( chunk ) // Trim, so the
result does not contain preceding or tailing spaces.
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs