Require extension registration (and thus MediaWiki 1.25)
Resources.php was already out of sync and broken due to some recent commits. Change-Id: I7a6b66b9fb1f1f61d15c40bc6fd175378e2dd6c5
This commit is contained in:
272
Resources.php
272
Resources.php
@@ -1,272 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* JavaScript and CSS resource definitions.
|
||||
*
|
||||
* @file
|
||||
* @license GPL-2.0+
|
||||
*/
|
||||
|
||||
$resourcePaths = array(
|
||||
'localBasePath' => __DIR__,
|
||||
'remoteExtPath' => 'UniversalLanguageSelector'
|
||||
);
|
||||
|
||||
global $wgResourceModules;
|
||||
$wgResourceModules['ext.uls.languagenames'] = array(
|
||||
'class' => 'ResourceLoaderULSModule'
|
||||
);
|
||||
|
||||
$wgResourceModules['ext.uls.messages'] = array(
|
||||
'class' => 'ResourceLoaderULSJsonMessageModule',
|
||||
'dependencies' => 'ext.uls.i18n',
|
||||
);
|
||||
|
||||
$wgResourceModules['ext.uls.buttons'] = array(
|
||||
'styles' => 'resources/css/ext.uls.buttons.css',
|
||||
) + $resourcePaths;
|
||||
|
||||
$wgResourceModules['ext.uls.displaysettings'] = array(
|
||||
'scripts' => 'resources/js/ext.uls.displaysettings.js',
|
||||
'styles' => 'resources/css/ext.uls.displaysettings.css',
|
||||
'dependencies' => array(
|
||||
// Common dependencies come from languagesettings
|
||||
'ext.uls.languagesettings',
|
||||
'ext.uls.mediawiki',
|
||||
'ext.uls.webfonts',
|
||||
'mediawiki.api.parse',
|
||||
'mediawiki.Uri',
|
||||
),
|
||||
) + $resourcePaths;
|
||||
|
||||
$wgResourceModules['ext.uls.geoclient'] = array(
|
||||
'scripts' => 'resources/js/ext.uls.geoclient.js',
|
||||
) + $resourcePaths;
|
||||
|
||||
$wgResourceModules['ext.uls.ime'] = array(
|
||||
'scripts' => 'resources/js/ext.uls.ime.js',
|
||||
'dependencies' => array(
|
||||
'ext.uls.init',
|
||||
'ext.uls.preferences',
|
||||
'ext.uls.mediawiki',
|
||||
'ext.uls.messages',
|
||||
'jquery.ime',
|
||||
'mediawiki.notify',
|
||||
),
|
||||
'messages' => array(
|
||||
'uls-ime-helppage',
|
||||
),
|
||||
) + $resourcePaths;
|
||||
|
||||
// Styles for users who disabled JavaScript
|
||||
$wgResourceModules['ext.uls.nojs'] = array(
|
||||
'styles' => 'resources/css/ext.uls.nojs.css',
|
||||
'position' => 'top',
|
||||
) + $resourcePaths;
|
||||
|
||||
// Initialization of MW ULS functionality
|
||||
$wgResourceModules['ext.uls.init'] = array(
|
||||
'scripts' => 'resources/js/ext.uls.init.js',
|
||||
'styles' => 'resources/css/ext.uls.css',
|
||||
'skinStyles' => array(
|
||||
'monobook' => 'resources/css/ext.uls-monobook.css',
|
||||
),
|
||||
'dependencies' => array(
|
||||
'mediawiki.api',
|
||||
'mediawiki.cookie',
|
||||
'jquery.client',
|
||||
'jquery.cookie',
|
||||
),
|
||||
'position' => 'top',
|
||||
) + $resourcePaths;
|
||||
|
||||
$wgResourceModules['ext.uls.eventlogger'] = array(
|
||||
'scripts' => 'resources/js/ext.uls.eventlogger.js',
|
||||
'dependencies' => array(
|
||||
'mediawiki.user',
|
||||
'schema.UniversalLanguageSelector',
|
||||
),
|
||||
) + $resourcePaths;
|
||||
|
||||
$wgResourceModules['ext.uls.i18n'] = array(
|
||||
'scripts' => 'resources/js/ext.uls.i18n.js',
|
||||
'dependencies' => array(
|
||||
'jquery.i18n',
|
||||
'mediawiki.util',
|
||||
),
|
||||
) + $resourcePaths;
|
||||
|
||||
$wgResourceModules['ext.uls.inputsettings'] = array(
|
||||
'scripts' => 'resources/js/ext.uls.inputsettings.js',
|
||||
'styles' => 'resources/css/ext.uls.inputsettings.css',
|
||||
'dependencies' => array(
|
||||
'ext.uls.ime',
|
||||
// Common dependencies come from languagesettings
|
||||
'ext.uls.languagesettings',
|
||||
'ext.uls.mediawiki',
|
||||
'jquery.ime',
|
||||
),
|
||||
) + $resourcePaths;
|
||||
|
||||
// Interface language selection module
|
||||
$wgResourceModules['ext.uls.interface'] = array(
|
||||
'scripts' => 'resources/js/ext.uls.interface.js',
|
||||
'dependencies' => array(
|
||||
'ext.uls.init',
|
||||
'mediawiki.jqueryMsg',
|
||||
'mediawiki.user',
|
||||
// We cannot delay the loading of the basic webfonts library
|
||||
// because it is required immediately after page load
|
||||
'ext.uls.webfonts',
|
||||
),
|
||||
'messages' => array(
|
||||
'uls-plang-title-languages',
|
||||
'ext-uls-select-language-settings-icon-tooltip',
|
||||
'ext-uls-undo-language-tooltip-text',
|
||||
'ext-uls-language-settings-preferences-link',
|
||||
),
|
||||
'position' => 'top',
|
||||
) + $resourcePaths;
|
||||
|
||||
$wgResourceModules['ext.uls.languagesettings'] = array(
|
||||
'scripts' => 'resources/js/ext.uls.languagesettings.js',
|
||||
'styles' => 'resources/css/ext.uls.languagesettings.css',
|
||||
'dependencies' => array(
|
||||
'ext.uls.buttons',
|
||||
'ext.uls.messages',
|
||||
'ext.uls.preferences',
|
||||
// The grid styles are used here,
|
||||
// but ULS itself is lazy-loaded
|
||||
'jquery.uls.grid',
|
||||
),
|
||||
) + $resourcePaths;
|
||||
|
||||
$wgResourceModules['ext.uls.preferences'] = array(
|
||||
'scripts' => 'resources/js/ext.uls.preferences.js',
|
||||
'dependencies' => array(
|
||||
'mediawiki.user',
|
||||
'mediawiki.api',
|
||||
),
|
||||
) + $resourcePaths;
|
||||
|
||||
$wgResourceModules['ext.uls.compactlinks'] = array(
|
||||
'scripts' => 'resources/js/ext.uls.compactlinks.js',
|
||||
'styles' => 'resources/css/ext.uls.compactlinks.css',
|
||||
'dependencies' => array(
|
||||
'ext.uls.mediawiki',
|
||||
'ext.uls.init',
|
||||
'jquery.uls.compact',
|
||||
'mediawiki.language',
|
||||
'mediawiki.ui.button',
|
||||
),
|
||||
'messages' => array(
|
||||
'ext-uls-compact-link-count',
|
||||
),
|
||||
) + $resourcePaths;
|
||||
|
||||
$wgResourceModules['ext.uls.webfonts'] = array(
|
||||
'scripts' => 'resources/js/ext.uls.webfonts.js',
|
||||
'dependencies' => array(
|
||||
'ext.uls.init',
|
||||
'ext.uls.preferences',
|
||||
),
|
||||
) + $resourcePaths;
|
||||
|
||||
$wgResourceModules['ext.uls.webfonts.fonts'] = array(
|
||||
'dependencies' => array(
|
||||
'jquery.webfonts',
|
||||
'jquery.uls.data',
|
||||
'ext.uls.webfonts.repository',
|
||||
),
|
||||
) + $resourcePaths;
|
||||
|
||||
$wgResourceModules['ext.uls.webfonts.repository'] = array(
|
||||
'scripts' => 'resources/js/ext.uls.webfonts.repository.js',
|
||||
'targets' => array( 'desktop', 'mobile' ),
|
||||
) + $resourcePaths;
|
||||
|
||||
$wgResourceModules['ext.uls.webfonts.mobile'] = array(
|
||||
'scripts' => 'resources/js/ext.uls.webfonts.mobile.js',
|
||||
'targets' => array( 'mobile' ),
|
||||
'dependencies' => array(
|
||||
'jquery.webfonts',
|
||||
'ext.uls.webfonts.repository',
|
||||
),
|
||||
) + $resourcePaths;
|
||||
|
||||
$wgResourceModules['jquery.ime'] = array(
|
||||
'scripts' => 'lib/jquery.ime/jquery.ime.js',
|
||||
'styles' => 'lib/jquery.ime/css/jquery.ime.css',
|
||||
) + $resourcePaths;
|
||||
|
||||
// This module sets default options for the language selector that are
|
||||
// suitable for MediaWiki and loads necessary dependencies like grid,
|
||||
// messages and jquery.uls itself.
|
||||
$wgResourceModules['ext.uls.mediawiki'] = array(
|
||||
'scripts' => 'resources/js/ext.uls.mediawiki.js',
|
||||
'dependencies' => array(
|
||||
'ext.uls.init',
|
||||
'ext.uls.languagenames',
|
||||
'ext.uls.messages',
|
||||
'jquery.uls',
|
||||
'jquery.uls.grid',
|
||||
'mediawiki.util',
|
||||
),
|
||||
) + $resourcePaths;
|
||||
|
||||
$wgResourceModules['jquery.uls'] = array(
|
||||
'scripts' => array(
|
||||
'lib/jquery.uls/src/jquery.uls.core.js',
|
||||
'lib/jquery.uls/src/jquery.uls.lcd.js',
|
||||
'lib/jquery.uls/src/jquery.uls.languagefilter.js',
|
||||
'lib/jquery.uls/src/jquery.uls.regionfilter.js',
|
||||
),
|
||||
'styles' => array(
|
||||
'lib/jquery.uls/css/jquery.uls.css',
|
||||
'lib/jquery.uls/css/jquery.uls.lcd.css',
|
||||
),
|
||||
'dependencies' => array(
|
||||
'jquery.i18n',
|
||||
'jquery.uls.data',
|
||||
'jquery.uls.grid',
|
||||
),
|
||||
) + $resourcePaths;
|
||||
|
||||
$wgResourceModules['jquery.uls.compact'] = array(
|
||||
'styles' => 'lib/jquery.uls/css/jquery.uls.compact.css',
|
||||
'dependencies' => 'jquery.uls',
|
||||
) + $resourcePaths;
|
||||
|
||||
$wgResourceModules['jquery.uls.data'] = array(
|
||||
'scripts' => array(
|
||||
'lib/jquery.uls/src/jquery.uls.data.js',
|
||||
'lib/jquery.uls/src/jquery.uls.data.utils.js',
|
||||
),
|
||||
'targets' => array( 'desktop', 'mobile' ),
|
||||
) + $resourcePaths;
|
||||
|
||||
$wgResourceModules['jquery.uls.grid'] = array(
|
||||
'position' => 'top',
|
||||
'styles' => 'lib/jquery.uls/css/jquery.uls.grid.css',
|
||||
) + $resourcePaths;
|
||||
|
||||
$wgResourceModules['jquery.webfonts'] = array(
|
||||
'scripts' => 'lib/jquery.webfonts.js',
|
||||
'targets' => array( 'desktop', 'mobile' ),
|
||||
) + $resourcePaths;
|
||||
|
||||
$wgResourceModules['ext.uls.pt'] = array(
|
||||
'styles' => 'resources/css/ext.uls.pt.css',
|
||||
) + $resourcePaths;
|
||||
|
||||
$wgResourceModules['ext.uls.interlanguage'] = array(
|
||||
'styles' => 'resources/css/ext.uls.interlanguage.css',
|
||||
) + $resourcePaths;
|
||||
|
||||
// A module named rangy is defined in VisualExtension with more features of rangy.
|
||||
// Here we need only the core library. This module is loaded dynamically from
|
||||
// client when rangy is undefined. If VE is present rangy will be defined, the module
|
||||
// defined in VE will be used. ie, This get loaded only when VE is not present and
|
||||
// user trying to type in a contenteditable
|
||||
$wgResourceModules['rangy.core'] = array(
|
||||
'scripts' => 'lib/rangy/rangy-core.js',
|
||||
) + $resourcePaths;
|
||||
@@ -28,203 +28,6 @@ if ( function_exists( 'wfLoadExtension' ) ) {
|
||||
'see https://www.mediawiki.org/wiki/Extension_registration for more details.'
|
||||
); */
|
||||
return;
|
||||
} else {
|
||||
die( 'Universal Language Selector extension requires MediaWiki 1.25 or later' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Version number used in extension credits and in other placed where needed.
|
||||
*/
|
||||
define( 'ULS_VERSION', '2015-10-27' );
|
||||
|
||||
$wgExtensionCredits['other'][] = array(
|
||||
'path' => __FILE__,
|
||||
'name' => 'UniversalLanguageSelector',
|
||||
'version' => ULS_VERSION,
|
||||
'author' => array(
|
||||
'Alolita Sharma',
|
||||
'Amir Aharoni',
|
||||
'Arun Ganesh',
|
||||
'Brandon Harris',
|
||||
'Niklas Laxström',
|
||||
'Pau Giner',
|
||||
'Santhosh Thottingal',
|
||||
'Siebrand Mazeland'
|
||||
),
|
||||
'url' => 'https://www.mediawiki.org/wiki/Extension:UniversalLanguageSelector',
|
||||
'descriptionmsg' => 'uls-desc',
|
||||
);
|
||||
|
||||
/**
|
||||
* ULS can use geolocation services to suggest languages based on the
|
||||
* country the user is vising from. Setting this to false will prevent
|
||||
* builtin geolocation from being used. You can provide your own geolocation
|
||||
* by setting window.Geo to object which has key 'country_code' or 'country'.
|
||||
* If set to true, it will query Wikimedia's geoip service.
|
||||
*
|
||||
* The service should return jsonp that uses the supplied callback parameter.
|
||||
*/
|
||||
$wgULSGeoService = true;
|
||||
|
||||
/**
|
||||
* Enable language selection, input methods and webfonts for everyone, unless
|
||||
* the behavior is overridden by the configuration variables below.
|
||||
*
|
||||
* Even if false the classes and resource loader modules are registered for the
|
||||
* use of other extensions. Language changing via cookie or setlang query
|
||||
* parameter is not possible.
|
||||
*/
|
||||
$wgULSEnable = true;
|
||||
|
||||
/**
|
||||
* Equivalent to $wgULSEnable for anonymous users only.
|
||||
*
|
||||
* Does not have any effect if $wgULSEnable is false.
|
||||
*/
|
||||
$wgULSEnableAnon = true;
|
||||
|
||||
/**
|
||||
* Allow anonymous users to change language with cookie and setlang
|
||||
* query parameter.
|
||||
*
|
||||
* Do not use if you are caching anonymous page views without
|
||||
* taking cookies into account.
|
||||
*
|
||||
* Does not have any effect if either of $wgULSEnable or
|
||||
* $wgULSEnableAnon is set to false.
|
||||
*
|
||||
* @since 2013.04
|
||||
*/
|
||||
$wgULSAnonCanChangeLanguage = true;
|
||||
|
||||
/**
|
||||
* Try to use preferred interface language for anonymous users.
|
||||
*
|
||||
* Do not use if you are caching anonymous page views without
|
||||
* taking Accept-Language into account.
|
||||
*
|
||||
* Does not have any effect if any of $wgULSEnable, $wgULSEnableAnon
|
||||
* or $wgULSAnonCanChangeLanguage is set to false.
|
||||
*/
|
||||
$wgULSLanguageDetection = true;
|
||||
|
||||
/**
|
||||
* Enable the input methods feature for all users by default.
|
||||
* Can be controlled by the user.
|
||||
*/
|
||||
$wgULSIMEEnabled = true;
|
||||
|
||||
/**
|
||||
* Enable the webfonts feature for all users by default.
|
||||
* Can be controlled by the user.
|
||||
* @since 2014.02
|
||||
*/
|
||||
$wgULSWebfontsEnabled = true;
|
||||
|
||||
/**
|
||||
* Set whether webfont support is loaded within the mobile interface (via the
|
||||
* MobileFrontend extension).
|
||||
*/
|
||||
$wgULSMobileWebfontsEnabled = false;
|
||||
|
||||
/**
|
||||
* The location and the form of the language selection trigger.
|
||||
* The possible values are:
|
||||
* 'personal': as a link near the username or the log in link in
|
||||
* the personal toolbar (default).
|
||||
* 'interlanguage': as an icon near the header of the list of interlanguage
|
||||
* links in the sidebar.
|
||||
*
|
||||
* @since 2013.04
|
||||
*/
|
||||
$wgULSPosition = 'personal';
|
||||
|
||||
/**
|
||||
* Whether to use EventLogging. The EventLogging extension must be installed
|
||||
* if this option is enabled.
|
||||
* @since 2013.06
|
||||
*/
|
||||
$wgULSEventLogging = false;
|
||||
|
||||
/**
|
||||
* Array of jQuery selectors of elements on which IME should be enabled.
|
||||
*
|
||||
* @since 2013.11
|
||||
*/
|
||||
$wgULSImeSelectors = array(
|
||||
'input:not([type])',
|
||||
'input[type=text]',
|
||||
'input[type=search]',
|
||||
'textarea',
|
||||
'[contenteditable]',
|
||||
);
|
||||
|
||||
/**
|
||||
* Array of jQuery selectors of elements on which IME must not be enabled.
|
||||
*
|
||||
* @since 2013.07
|
||||
*/
|
||||
$wgULSNoImeSelectors = array( '#wpCaptchaWord' );
|
||||
|
||||
/**
|
||||
* Array of jQuery selectors of elements on which webfonts must not be applied.
|
||||
* By default exclude elements with .autonym because that style set font as
|
||||
* Autonym
|
||||
* @since 2013.09
|
||||
*/
|
||||
$wgULSNoWebfontsSelectors = array( '#p-lang li.interlanguage-link > a' );
|
||||
|
||||
/**
|
||||
* Base path of ULS font repository.
|
||||
* If not set, will be set to 'UniversalLanguageSelector/data/fontrepo/fonts/',
|
||||
* relative to $wgExtensionAssetsPath.
|
||||
* @since 2013.10
|
||||
*/
|
||||
$wgULSFontRepositoryBasePath = false;
|
||||
|
||||
/**
|
||||
* Whether the "Compact language links" Beta Feature is exposed. Requires
|
||||
* $wgULSPosition to be 'interlanguage'.
|
||||
*
|
||||
* Defaults to false.
|
||||
*
|
||||
* @since 2014.03
|
||||
*/
|
||||
$wgULSCompactLinks = false;
|
||||
|
||||
// Internationalization
|
||||
$wgMessagesDirs['UniversalLanguageSelector'] = __DIR__ . '/i18n';
|
||||
|
||||
// Register auto load for the page class
|
||||
$wgAutoloadClasses += array(
|
||||
'UniversalLanguageSelectorHooks' => __DIR__ . '/UniversalLanguageSelector.hooks.php',
|
||||
'ResourceLoaderULSModule' => __DIR__ . '/includes/ResourceLoaderULSModule.php',
|
||||
'ResourceLoaderULSJsonMessageModule' =>
|
||||
__DIR__ . '/includes/ResourceLoaderULSJsonMessageModule.php',
|
||||
'ApiLanguageSearch' => __DIR__ . '/api/ApiLanguageSearch.php',
|
||||
'ApiULSLocalization' => __DIR__ . '/api/ApiULSLocalization.php',
|
||||
'ULSJsonMessageLoader' => __DIR__ . '/includes/ULSJsonMessageLoader.php',
|
||||
'LanguageNameSearch' => __DIR__ . '/data/LanguageNameSearch.php',
|
||||
);
|
||||
|
||||
$wgHooks['BeforePageDisplay'][] = 'UniversalLanguageSelectorHooks::addModules';
|
||||
$wgHooks['EventLoggingRegisterSchemas'][] =
|
||||
'UniversalLanguageSelectorHooks::onEventLoggingRegisterSchemas';
|
||||
$wgHooks['PersonalUrls'][] = 'UniversalLanguageSelectorHooks::addPersonalBarTrigger';
|
||||
$wgHooks['ResourceLoaderRegisterModules'][] =
|
||||
'UniversalLanguageSelectorHooks::onResourceLoaderRegisterModules';
|
||||
$wgHooks['ResourceLoaderTestModules'][] =
|
||||
'UniversalLanguageSelectorHooks::addTestModules';
|
||||
$wgHooks['ResourceLoaderGetConfigVars'][] = 'UniversalLanguageSelectorHooks::addConfig';
|
||||
$wgHooks['MakeGlobalVariablesScript'][] = 'UniversalLanguageSelectorHooks::addVariables';
|
||||
$wgAPIModules['languagesearch'] = 'ApiLanguageSearch';
|
||||
$wgAPIModules['ulslocalization'] = 'ApiULSLocalization';
|
||||
$wgHooks['UserGetLanguageObject'][] = 'UniversalLanguageSelectorHooks::getLanguage';
|
||||
$wgHooks['SkinTemplateOutputPageBeforeExec'][] =
|
||||
'UniversalLanguageSelectorHooks::onSkinTemplateOutputPageBeforeExec';
|
||||
$wgHooks['EnterMobileMode'][] = 'UniversalLanguageSelectorHooks::onEnterMobileMode';
|
||||
|
||||
$wgDefaultUserOptions['uls-preferences'] = '';
|
||||
$wgHooks['GetPreferences'][] = 'UniversalLanguageSelectorHooks::onGetPreferences';
|
||||
$wgHooks['GetBetaFeaturePreferences'][] =
|
||||
'UniversalLanguageSelectorHooks::onGetBetaFeaturePreferences';
|
||||
|
||||
require __DIR__ . '/Resources.php';
|
||||
|
||||
Reference in New Issue
Block a user