r111132 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111131‎ | r111132 | r111133 >
Date:00:36, 10 February 2012
Author:jeroendedauw
Status:deferred
Tags:
Comment:
fixed dependency issue and some js tweaks
Modified paths:
  • /trunk/extensions/LiveTranslate/LiveTranslate.php (modified) (history)
  • /trunk/extensions/LiveTranslate/LiveTranslate_Settings.php (modified) (history)
  • /trunk/extensions/LiveTranslate/includes/ext.livetranslate.js (modified) (history)
  • /trunk/extensions/LiveTranslate/includes/ext.lt.load.js (added) (history)

Diff [purge]

Index: trunk/extensions/LiveTranslate/LiveTranslate.php
@@ -99,8 +99,9 @@
100100 'scripts' => array(
101101 'includes/jquery.replaceText.js',
102102 'includes/ext.livetranslate.js',
 103+ 'includes/ext.lt.tm.js',
103104 'includes/jquery.liveTranslate.js',
104 - 'includes/ext.lt.tm.js',
 105+ 'includes/ext.lt.load.js',
105106 ),
106107 'dependencies' => array( 'jquery'/*, 'jquery.ui.button'*/ ),
107108 'messages' => $egLTJSMessages
Index: trunk/extensions/LiveTranslate/LiveTranslate_Settings.php
@@ -71,3 +71,6 @@
7272 # Microsoft App Id, needed when using the Microsoft Translation service.
7373 # http://www.bing.com/developers/createapp.aspx
7474 $egLiveTranslateMSAppId = '';
 75+
 76+$egLiveTranslateLanguages[] = 'nl';
 77+$egLiveTranslateLanguages[] = 'de';
Index: trunk/extensions/LiveTranslate/includes/ext.livetranslate.js
@@ -1,43 +1,43 @@
22 /**
33 * JavasSript for the Live Translate extension.
4 - * @see http://www.mediawiki.org/wiki/Extension:Live_Translate
 4+ * @see https://www.mediawiki.org/wiki/Extension:Live_Translate
55 *
66 * @licence GNU GPL v3 or later
77 * @author Jeroen De Dauw <jeroendedauw at gmail dot com>
88 */
99
10 -window.liveTranslate = new( function() {
11 -
12 - this.debug = function( message ) {
13 - if ( window.ltDebugMessages ) {
14 - if ( typeof console === 'undefined' ) {
15 - document.title = 'Live Translate: ' + message;
 10+( function () {
 11+
 12+ var lt = {
 13+
 14+ debug: function( message ) {
 15+ if ( window.ltDebugMessages ) {
 16+ if ( typeof console === 'undefined' ) {
 17+ document.title = 'Live Translate: ' + message;
 18+ }
 19+ else {
 20+ console.log( 'Live Translate: ' + message );
 21+ }
1622 }
 23+ },
 24+
 25+ msg: function() {
 26+ if ( typeof mediaWiki === 'undefined' ) {
 27+ message = window.wgLTEMessages[arguments[0]];
 28+
 29+ for ( var i = arguments.length - 1; i > 0; i-- ) {
 30+ message = message.replace( '$' + i, arguments[i] );
 31+ }
 32+
 33+ return message;
 34+ }
1735 else {
18 - console.log( 'Live Translate: ' + message );
 36+ return mediaWiki.msg.apply( this, arguments );
1937 }
2038 }
 39+
2140 };
22 -
23 - this.msg = function() {
24 - if ( typeof mediaWiki === 'undefined' ) {
25 - message = window.wgLTEMessages[arguments[0]];
26 -
27 - for ( var i = arguments.length - 1; i > 0; i-- ) {
28 - message = message.replace( '$' + i, arguments[i] );
29 - }
30 -
31 - return message;
32 - }
33 - else {
34 - return mediaWiki.msg.apply( this, arguments );
35 - }
36 - };
37 -
38 -} )();
3941
40 -(function( $ ) { $( document ).ready( function() {
 42+ window.liveTranslate = lt;
4143
42 - $( '#livetranslatediv' ).liveTranslate( {} );
43 -
44 -} ); })( jQuery );
 44+}() );
\ No newline at end of file
Index: trunk/extensions/LiveTranslate/includes/ext.lt.load.js
@@ -0,0 +1,13 @@
 2+/**
 3+ * JavasSript for the Live Translate extension.
 4+ * @see https://www.mediawiki.org/wiki/Extension:Live_Translate
 5+ *
 6+ * @licence GNU GPL v3 or later
 7+ * @author Jeroen De Dauw <jeroendedauw at gmail dot com>
 8+ */
 9+
 10+(function( $ ) { $( document ).ready( function() {
 11+
 12+ $( '#livetranslatediv' ).liveTranslate( {} );
 13+
 14+} ); })( jQuery );
\ No newline at end of file

Follow-up revisions

RevisionCommit summaryAuthorDate
r112198Follow up to r111132; up compat code as welljeroendedauw12:43, 23 February 2012

Status & tagging log