Merge "Prepare ULS for EventLogging"

This commit is contained in:
jenkins-bot
2013-07-03 10:42:43 +00:00
committed by Gerrit Code Review
3 changed files with 62 additions and 3 deletions

View File

@@ -116,6 +116,33 @@
return !/MSIE [67]/i.test( navigator.userAgent );
};
/**
* Local wrapper for 'mw.eventLog.logEvent' which handles default params
* and ensures the correct schema is loaded.
*
* @param {Object} data Event action and optional fields
* @since 2013.07
* @see https://meta.wikimedia.org/wiki/Schema:UniversalLanguageSelector
*/
mw.uls.logEvent = $.noop;
// If EventLogging integration is enabled, set event defaults and make the
// the function call event logging with correct schema.
if ( mw.config.get( 'wgULSEventLogging' ) ) {
mw.loader.using( 'schema.UniversalLanguageSelector', function () {
mw.eventLog.setDefaults( 'UniversalLanguageSelector', {
version: 1,
token: mw.user.id(),
contentLanguage: mw.config.get( 'wgContentLanguage' ),
interfaceLanguage: currentLang
} );
mw.uls.logEvent = function ( event ) {
mw.eventLog.logEvent( 'UniversalLanguageSelector', event );
};
} );
}
/**
* i18n initialization
*/