Merge "Avoid loading of jquery.i18n and messages until trigger clicked"

This commit is contained in:
jenkins-bot
2014-01-24 21:42:49 +00:00
committed by Gerrit Code Review
5 changed files with 21 additions and 38 deletions

View File

@@ -40,11 +40,6 @@
}() );
}
var jsonLoader = null,
initialized = false,
currentLang = mw.config.get( 'wgUserLanguage' );
mw.uls = mw.uls || {};
mw.uls.previousLanguagesCookie = 'uls-previous-languages';
mw.uls.previousLanguageAutonymCookie = 'uls-previous-language-autonym';
@@ -230,33 +225,19 @@
}
/**
* Initialize ULS front-end and its i18n.
* Initialize ULS front-end if browser is supported.
*
* @param {Function} callback callback function to be called after initialization.
*/
mw.uls.init = function ( callback ) {
callback = callback || $.noop;
if ( initialized ) {
callback.call( this );
return;
}
if ( !isBrowserSupported() ) {
$( '#pt-uls' ).hide();
return;
}
if ( !jsonLoader ) {
jsonLoader = mw.uls.loadLocalization( currentLang );
} else {
jsonLoader.done( function () {
initialized = true;
} );
jsonLoader.done( callback );
if ( callback ) {
callback.call( this );
}
};

View File

@@ -231,7 +231,7 @@
// Get the html of the link by wrapping it in div first
link = $( '<div>' ).html( link ).html();
return $.i18n( 'ext-uls-undo-language-tooltip-text', link );
return mw.msg( 'ext-uls-undo-language-tooltip-text', link );
}
} );
@@ -342,7 +342,7 @@
}
$ulsTrigger.attr( {
title: $.i18n( 'ext-uls-select-language-settings-icon-tooltip' )
title: mw.msg( 'ext-uls-select-language-settings-icon-tooltip' )
} );
$ulsTrigger.on( 'click', function ( e, eventParams ) {
@@ -459,7 +459,7 @@
// Bind language settings to preferences page link
$( '#uls-preferences-link' )
.text( $.i18n( 'ext-uls-language-settings-preferences-link' ) )
.text( mw.msg( 'ext-uls-language-settings-preferences-link' ) )
.click( function () {
$ulsTrigger.trigger( 'click', {
source: 'preferences'