Jforrester has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/391645 )
Change subject: [WIP] Convert to static extension loading ...................................................................... [WIP] Convert to static extension loading What a mess. Not tested. Almost certainly doesn't work, and some bits definitely won't. Bug: T87985 Change-Id: I410a4d499c44a18fb686626775f17187547e74f1 --- D Resources.php M Translate.php M TranslateHooks.php A extension.json 4 files changed, 1,306 insertions(+), 1,248 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate refs/changes/45/391645/1 diff --git a/Resources.php b/Resources.php deleted file mode 100644 index 66c90e2..0000000 --- a/Resources.php +++ /dev/null @@ -1,581 +0,0 @@ -<?php - -/** - * JavaScript and CSS resource definitions. - * - * @file - * @license GPL-2.0+ - */ - -global $wgResourceModules; - -$resourcePaths = [ - 'localBasePath' => __DIR__, - 'remoteExtPath' => 'Translate', - 'targets' => [ 'desktop', 'mobile' ], -]; - -$wgResourceModules['ext.translate'] = [ - 'styles' => 'resources/css/ext.translate.css', - 'position' => 'top', -] + $resourcePaths; - -$wgResourceModules['ext.translate.base'] = [ - 'scripts' => 'resources/js/ext.translate.base.js', - 'dependencies' => [ - 'ext.translate.hooks', - 'mediawiki.api', - 'mediawiki.util', - ], - 'messages' => [ - 'translate-js-support-unsaved-warning', - ], -] + $resourcePaths; - -$wgResourceModules['ext.translate.dropdownmenu'] = [ - 'styles' => 'resources/css/ext.translate.dropdownmenu.css', - 'scripts' => 'resources/js/ext.translate.dropdownmenu.js', -] + $resourcePaths; - -$wgResourceModules['ext.translate.editor'] = [ - 'scripts' => [ - 'resources/js/ext.translate.editor.helpers.js', - 'resources/js/ext.translate.editor.js', - 'resources/js/ext.translate.editor.shortcuts.js', - 'resources/js/ext.translate.pagemode.js', - 'resources/js/ext.translate.proofread.js', - ], - 'styles' => [ - 'resources/css/ext.translate.editor.css', - 'resources/css/ext.translate.pagemode.css', - 'resources/css/ext.translate.proofread.css', - ], - 'dependencies' => [ - 'ext.translate.base', - 'ext.translate.dropdownmenu', - 'ext.translate.hooks', - 'ext.translate.storage', - 'jquery.accessKeyLabel', - 'jquery.autosize', - 'jquery.makeCollapsible', - 'jquery.textSelection', - 'jquery.textchange', - 'mediawiki.Uri', - 'mediawiki.api', - 'mediawiki.api.parse', - 'mediawiki.jqueryMsg', - 'mediawiki.language', - 'mediawiki.user', - 'mediawiki.util', - ], - 'messages' => [ - 'translate-edit-askpermission', - 'translate-edit-nopermission', - 'tux-editor-add-desc', - 'tux-editor-ask-help', - 'tux-editor-cancel-button-label', - 'tux-editor-close-tooltip', - 'tux-editor-collapse-tooltip', - 'tux-editor-confirm-button-label', - 'tux-editor-discard-changes-button-label', - 'tux-editor-doc-editor-cancel', - 'tux-editor-doc-editor-placeholder', - 'tux-editor-doc-editor-save', - 'tux-editor-edit-desc', - 'tux-editor-expand-tooltip', - 'tux-editor-in-other-languages', - 'tux-editor-loading', - 'tux-editor-message-desc-less', - 'tux-editor-message-desc-more', - 'tux-editor-message-tools-show-editor', - 'tux-editor-message-tools-delete', - 'tux-editor-message-tools-history', - 'tux-editor-message-tools-translations', - 'tux-editor-n-uses', - 'tux-editor-need-more-help', - 'tux-editor-outdated-warning', - 'tux-editor-outdated-warning-diff-link', - 'tux-editor-paste-original-button-label', - 'tux-editor-placeholder', - 'tux-editor-editsummary-placeholder', - 'tux-editor-proofread-button-label', - 'tux-editor-save-button-label', - 'tux-editor-save-failed', - 'tux-editor-shortcut-info', - 'tux-editor-skip-button-label', - 'tux-editor-suggestions-title', - 'tux-editor-tm-match', - 'tux-proofread-action-tooltip', - 'tux-proofread-edit-label', - 'tux-proofread-translated-by-self', - 'tux-session-expired', - 'tux-status-saving', - 'tux-status-translated', - 'tux-status-unsaved', - 'tux-save-unknown-error', - 'tux-warnings-hide', - 'tux-warnings-more', - 'spamprotectiontext', - ], - 'position' => 'top', -] + $resourcePaths; - -$wgResourceModules['ext.translate.groupselector'] = [ - 'styles' => 'resources/css/ext.translate.groupselector.css', - 'scripts' => 'resources/js/ext.translate.groupselector.js', - 'position' => 'top', - 'dependencies' => [ - 'ext.translate.base', - 'ext.translate.loader', - 'ext.translate.statsbar', - 'jquery.ui.position', - 'mediawiki.jqueryMsg', - ], - 'messages' => [ - 'translate-msggroupselector-search-all', - 'translate-msggroupselector-search-placeholder', - 'translate-msggroupselector-search-recent', - 'translate-msggroupselector-view-subprojects', - ], -] + $resourcePaths; - -$wgResourceModules['ext.translate.hooks'] = [ - 'scripts' => 'resources/js/ext.translate.hooks.js', - 'position' => 'top', -] + $resourcePaths; - -$wgResourceModules['ext.translate.legacy'] = [ - 'styles' => 'resources/css/ext.translate.legacy.css', - 'position' => 'top', -] + $resourcePaths; - -$wgResourceModules['ext.translate.loader'] = [ - 'styles' => 'resources/css/ext.translate.loader.css', - 'position' => 'top', -] + $resourcePaths; - -$wgResourceModules['ext.translate.messagetable'] = [ - 'scripts' => 'resources/js/ext.translate.messagetable.js', - 'styles' => 'resources/css/ext.translate.messagetable.less', - 'position' => 'bottom', - 'dependencies' => [ - 'ext.translate.base', - 'ext.translate.hooks', - 'ext.translate.loader', - 'ext.translate.parsers', - 'jquery.textchange', - 'jquery.throttle-debounce', - 'mediawiki.Uri', - 'mediawiki.jqueryMsg', - 'mediawiki.util', - ], - 'messages' => [ - 'api-error-badtoken', - 'api-error-emptypage', - 'api-error-fuzzymessage', - 'api-error-invalidrevision', - 'api-error-owntranslation', - 'api-error-unknownerror', - 'api-error-unknownmessage', - 'tpt-unknown-page', - 'translate-edit-title', - 'translate-language-disabled', - 'tux-edit', - 'tux-empty-list-all', - 'tux-empty-list-all-guide', - 'tux-empty-list-other', - 'tux-empty-list-other-action', - 'tux-empty-list-other-guide', - 'tux-empty-list-other-link', - 'tux-empty-list-translated', - 'tux-empty-list-translated-action', - 'tux-empty-list-translated-guide', - 'tux-empty-no-messages-to-display', - 'tux-empty-no-outdated-messages', - 'tux-empty-nothing-new-to-proofread', - 'tux-empty-nothing-to-proofread', - 'tux-empty-show-optional-messages', - 'tux-empty-there-are-optional', - 'tux-empty-you-can-help-providing', - 'tux-empty-you-can-review-already-proofread', - 'tux-message-filter-advanced-button', - 'tux-message-filter-placeholder', - 'tux-message-filter-result', - 'tux-messagetable-loading-messages', - 'tux-messagetable-more-messages', - 'tux-status-fuzzy', - 'tux-status-optional', - 'tux-status-proofread', - 'tux-status-translated', - ], -] + $resourcePaths; - -$wgResourceModules['ext.translate.messagewebimporter'] = [ - 'styles' => 'resources/css/ext.translate.messagewebimporter.css', - 'position' => 'top', -] + $resourcePaths; - -$wgResourceModules['ext.translate.multiselectautocomplete'] = [ - 'scripts' => 'resources/js/ext.translate.multiselectautocomplete.js', - 'dependencies' => [ - 'jquery.ui.autocomplete', - ], - 'position' => 'top', - 'targets' => [ 'desktop' ], -] + $resourcePaths; - -$wgResourceModules['ext.translate.navitoggle'] = [ - 'skinScripts' => [ - 'vector' => 'resources/js/ext.translate.navitoggle.js', - ], - 'skinStyles' => [ - 'vector' => 'resources/css/ext.translate.navitoggle.css', - ], -] + $resourcePaths; - -$wgResourceModules['ext.translate.pagetranslation.uls'] = [ - 'scripts' => 'resources/js/ext.translate.pagetranslation.uls.js', - 'dependencies' => [ - 'ext.uls.mediawiki', - 'mediawiki.util', - ], -] + $resourcePaths; - -$wgResourceModules['ext.translate.parsers'] = [ - 'scripts' => 'resources/js/ext.translate.parsers.js', - 'dependencies' => [ - 'mediawiki.util', - ], -] + $resourcePaths; - -$wgResourceModules['ext.translate.quickedit'] = [ - 'scripts' => 'resources/js/ext.translate.quickedit.js', - 'styles' => 'resources/css/ext.translate.quickedit.css', - 'messages' => [ 'translate-js-nonext', 'translate-js-save-failed' ], - 'dependencies' => [ - 'ext.translate.hooks', - 'jquery.accessKeyLabel', - 'jquery.autosize', - 'jquery.form', - 'jquery.ui.dialog', - 'mediawiki.util', - ], - 'targets' => [ 'desktop' ], -] + $resourcePaths; - -$wgResourceModules['ext.translate.selecttoinput'] = [ - 'scripts' => 'resources/js/ext.translate.selecttoinput.js', -] + $resourcePaths; - -$wgResourceModules['ext.translate.special.aggregategroups'] = [ - 'scripts' => 'resources/js/ext.translate.special.aggregategroups.js', - 'styles' => 'resources/css/ext.translate.special.aggregategroups.css', - 'position' => 'top', - 'dependencies' => [ - 'jquery.ui.autocomplete', - 'mediawiki.api', - 'mediawiki.util', - ], - 'messages' => [ - 'tpt-aggregategroup-add', - 'tpt-aggregategroup-edit-description', - 'tpt-aggregategroup-edit-name', - 'tpt-aggregategroup-remove-confirm', - 'tpt-aggregategroup-update', - 'tpt-aggregategroup-update-cancel', - 'tpt-invalid-group', - ], - 'targets' => [ 'desktop' ], -] + $resourcePaths; - -$wgResourceModules['ext.translate.special.importtranslations'] = [ - 'scripts' => 'resources/js/ext.translate.special.importtranslations.js', - 'dependencies' => [ - 'jquery.ui.autocomplete', - ], - 'targets' => [ 'desktop' ], -] + $resourcePaths; - -$wgResourceModules['ext.translate.special.languagestats'] = [ - 'scripts' => 'resources/js/ext.translate.special.languagestats.js', - 'styles' => 'resources/css/ext.translate.special.languagestats.css', - 'messages' => [ - 'translate-langstats-collapse', - 'translate-langstats-collapseall', - 'translate-langstats-expand', - 'translate-langstats-expandall', - ], - 'dependencies' => 'jquery.tablesorter', - 'targets' => [ 'desktop' ], -] + $resourcePaths; - -$wgResourceModules['ext.translate.special.managegroups'] = [ - 'styles' => 'resources/css/ext.translate.special.managegroups.css', - 'position' => 'top', -] + $resourcePaths; - -$wgResourceModules['ext.translate.special.managetranslatorsandbox'] = [ - 'scripts' => 'resources/js/ext.translate.special.managetranslatorsandbox.js', - 'dependencies' => [ - 'ext.translate.loader', - 'ext.translate.translationstashstorage', - 'ext.uls.mediawiki', - 'jquery.ui.dialog', - 'mediawiki.api', - 'mediawiki.jqueryMsg', - 'mediawiki.language', - ], - 'messages' => [ - 'tsb-accept-all-button-label', - 'tsb-accept-button-label', - 'tsb-reject-confirmation', - 'tsb-accept-confirmation', - 'tsb-all-languages-button-label', - 'tsb-didnt-make-any-translations', - 'tsb-no-requests-from-new-users', - 'tsb-older-requests', - 'tsb-reject-all-button-label', - 'tsb-reject-button-label', - 'tsb-reminder-failed', - 'tsb-reminder-link-text', - 'tsb-reminder-sending', - 'tsb-reminder-sent', - 'tsb-reminder-sent-new', - 'tsb-request-count', - 'tsb-selected-count', - 'tsb-translations-current', - 'tsb-translations-source', - 'tsb-translations-user', - 'tsb-user-posted-a-comment', - ], - 'targets' => [ 'desktop' ], -] + $resourcePaths; - -$wgResourceModules['ext.translate.special.managetranslatorsandbox.styles'] = [ - 'styles' => 'resources/css/ext.translate.special.managetranslatorsandbox.css', -] + $resourcePaths; - -$wgResourceModules['ext.translate.special.pagemigration'] = [ - 'styles' => 'resources/css/ext.translate.special.pagemigration.css', - 'scripts' => 'resources/js/ext.translate.special.pagemigration.js', - 'dependencies' => [ - 'jquery.ajaxdispatcher', - 'mediawiki.api', - 'mediawiki.api.edit', - 'mediawiki.ui', - 'mediawiki.ui.button', - ], - 'messages' => [ - 'pm-add-icon-hover-text', - 'pm-delete-icon-hover-text', - 'pm-extra-units-warning', - 'pm-langcode-missing', - 'pm-old-translations-missing', - 'pm-page-does-not-exist', - 'pm-pagename-missing', - 'pm-pagetitle-invalid', - 'pm-pagetitle-missing', - 'pm-swap-icon-hover-text', - 'pm-on-import-message-text', - 'pm-on-save-message-text', - 'pm-savepages-button-label', - 'pm-cancel-button-label', - ], -] + $resourcePaths; - -$wgResourceModules['ext.translate.special.pagepreparation'] = [ - 'styles' => 'resources/css/ext.translate.special.pagepreparation.css', - 'scripts' => 'resources/js/ext.translate.special.pagepreparation.js', - 'dependencies' => [ - 'mediawiki.RegExp', - 'mediawiki.Title', - 'mediawiki.diff.styles', - 'mediawiki.api', - 'mediawiki.jqueryMsg', - 'mediawiki.ui', - ], - 'messages' => [ - 'pp-already-prepared-message', - 'pp-pagename-missing', - 'pp-prepare-message', - 'pp-save-button-label', - 'pp-save-message', - ], -] + $resourcePaths; - -$wgResourceModules['ext.translate.special.pagetranslation'] = [ - 'scripts' => 'resources/js/ext.translate.special.pagetranslation.js', - 'dependencies' => [ - 'ext.translate.multiselectautocomplete', - 'mediawiki.ui.button', - 'mediawiki.Uri', - 'user.tokens', - ], - 'position' => 'top', - 'targets' => [ 'desktop' ], -] + $resourcePaths; - -$wgResourceModules['ext.translate.special.pagetranslation.styles'] = [ - 'styles' => 'resources/css/ext.translate.special.pagetranslation.css', - 'position' => 'top', -] + $resourcePaths; - -$wgResourceModules['ext.translate.special.searchtranslations'] = [ - 'scripts' => 'resources/js/ext.translate.special.searchtranslations.js', - 'dependencies' => [ - 'ext.translate.editor', - 'ext.translate.groupselector', - 'ext.uls.mediawiki', - 'mediawiki.Uri', - 'mediawiki.language', - ], - 'messages' => [ - 'translate-documentation-language', - 'translate-search-more-groups-info', - 'translate-search-more-languages-info', - ], - 'position' => 'top', -] + $resourcePaths; - -$wgResourceModules['ext.translate.special.searchtranslations.operatorsuggest'] = [ - 'scripts' => 'resources/js/ext.translate.special.operatorsuggest.js', - 'dependencies' => [ - 'jquery.ui.autocomplete', - ], - 'targets' => [ 'desktop' ], -] + $resourcePaths; - -$wgResourceModules['ext.translate.special.searchtranslations.styles'] = [ - 'styles' => 'resources/css/ext.translate.special.searchtranslations.css', - 'position' => 'top', -] + $resourcePaths; - -$wgResourceModules['ext.translate.special.supportedlanguages'] = [ - 'styles' => 'resources/css/ext.translate.special.supportedlanguages.css', - 'position' => 'top', -] + $resourcePaths; - -$wgResourceModules['ext.translate.special.translate'] = [ - 'scripts' => 'resources/js/ext.translate.special.translate.js', - 'dependencies' => [ - 'ext.translate.base', - 'ext.translate.groupselector', - 'ext.translate.messagetable', - 'ext.translate.navitoggle', - 'ext.translate.recentgroups', - 'ext.translate.workflowselector', - 'jquery.uls.data', - 'mediawiki.Uri', - 'mediawiki.api', - 'mediawiki.api.parse', - 'mediawiki.jqueryMsg', - ], - 'messages' => [ - 'tpt-discouraged-language-content', - 'tpt-discouraged-language-force-content', - 'tpt-discouraged-language-force-header', - 'tpt-discouraged-language-header', - 'translate-documentation-language', - 'tux-editor-proofreading-hide-own-translations', - 'tux-editor-proofreading-show-own-translations', - ], -] + $resourcePaths; - -$wgResourceModules['ext.translate.special.translate.legacy'] = [ - 'scripts' => 'resources/js/ext.translate.special.translate.legacy.js', - 'dependencies' => [ - 'mediawiki.api', - ], - 'messages' => [ - 'translate-messagereview-done', - 'translate-messagereview-failure', - 'translate-messagereview-progress', - ], -] + $resourcePaths; - -$wgResourceModules['ext.translate.special.translate.styles'] = [ - 'styles' => 'resources/css/ext.translate.special.translate.css', - 'position' => 'top', -] + $resourcePaths; - -$wgResourceModules['ext.translate.special.translationstash'] = [ - 'scripts' => 'resources/js/ext.translate.special.translationstash.js', - 'styles' => 'resources/css/ext.translate.special.translationstash.css', - 'position' => 'top', - 'dependencies' => [ - 'ext.translate.editor', - 'ext.translate.messagetable', - 'ext.translate.translationstashstorage', - 'ext.uls.mediawiki', - 'mediawiki.api', - 'mediawiki.language', - ], - 'messages' => [ - 'translate-translationstash-skip-button-label', - 'translate-translationstash-translations', - 'tsb-limit-reached-body', - 'tsb-limit-reached-title', - ], -] + $resourcePaths; - -$wgResourceModules['ext.translate.special.translationstats'] = [ - 'scripts' => 'resources/js/ext.translate.special.translationstats.js', -] + $resourcePaths; - -$wgResourceModules['ext.translate.statsbar'] = [ - 'styles' => 'resources/css/ext.translate.statsbar.css', - 'scripts' => 'resources/js/ext.translate.statsbar.js', - 'messages' => [ - 'translate-statsbar-tooltip', - 'translate-statsbar-tooltip-with-fuzzy', - ], - 'position' => 'top', -] + $resourcePaths; - -$wgResourceModules['ext.translate.storage'] = [ - 'scripts' => 'resources/js/ext.translate.storage.js', -] + $resourcePaths; - -$wgResourceModules['ext.translate.tabgroup'] = [ - 'styles' => 'resources/css/ext.translate.tabgroup.css', - 'position' => 'top', -] + $resourcePaths; - -$wgResourceModules['ext.translate.tag.languages'] = [ - 'styles' => 'resources/css/ext.translate.tag.languages.css', - 'position' => 'top', -] + $resourcePaths; - -$wgResourceModules['ext.translate.translationstashstorage'] = [ - 'scripts' => 'resources/js/ext.translate.translationstashstorage.js', - 'dependencies' => [ - 'mediawiki.api', - ], -] + $resourcePaths; - -$wgResourceModules['ext.translate.workflowselector'] = [ - 'styles' => 'resources/css/ext.translate.workflowselector.css', - 'scripts' => 'resources/js/ext.translate.workflowselector.js', - 'messages' => [ - 'translate-workflow-set-doing', - 'translate-workflow-state-', - 'translate-workflowstatus', - ], - 'dependencies' => [ - 'ext.translate.dropdownmenu', - 'mediawiki.api', - ], -] + $resourcePaths; - -// Third party module -$wgResourceModules['jquery.ajaxdispatcher'] = [ - 'scripts' => 'resources/js/jquery.ajaxdispatcher.js', -] + $resourcePaths; - -$wgResourceModules['jquery.autosize'] = [ - 'scripts' => 'resources/js/jquery.autosize.js', -] + $resourcePaths; - -$wgResourceModules['jquery.textchange'] = [ - 'scripts' => 'resources/js/jquery.textchange.js', -] + $resourcePaths; diff --git a/Translate.php b/Translate.php index b9edc9d..692bf6a 100644 --- a/Translate.php +++ b/Translate.php @@ -1,9 +1,10 @@ <?php -if ( !defined( 'MEDIAWIKI' ) ) { - die(); -} + /** * An extension to ease the translation of Mediawiki and other projects. + * + * This PHP entry point is deprecated. Please use wfLoadExtension() and the extension.json file + * instead. See https://www.mediawiki.org/wiki/Manual:Extension_registration for more details. * * @file * @ingroup Extensions @@ -14,671 +15,23 @@ * @license GPL-2.0+ */ -/** - * Version number used in extension credits and in other places where needed. - */ -define( 'TRANSLATE_VERSION', '2017-10-30' ); +if ( function_exists( 'wfLoadExtension' ) ) { + wfLoadExtension( 'Translate' ); -/** - * Extension credits properties. - */ -$wgExtensionCredits['specialpage'][] = [ - 'path' => __FILE__, - 'name' => 'Translate', - 'namemsg' => 'translate-extensionname', - 'version' => TRANSLATE_VERSION, - 'author' => [ - 'Niklas Laxström', - 'Santhosh Thottingal', - 'Siebrand Mazeland' - ], - 'descriptionmsg' => 'translate-desc', - 'url' => 'https://www.mediawiki.org/wiki/Extension:Translate', - 'license-name' => 'GPL-2.0+', -]; + // Keep i18n globals so mergeMessageFileList.php doesn't break + $wgMessagesDirs['PageTranslation'] = __DIR__ . '/i18n/pagetranslation'; + $wgMessagesDirs['Translate'] = __DIR__ . '/i18n/core'; + $wgMessagesDirs['TranslateSearch'] = __DIR__ . '/i18n/search'; + $wgMessagesDirs['TranslateSandbox'] = __DIR__ . '/i18n/sandbox'; + $wgMessagesDirs['TranslateApi'] = __DIR__ . '/i18n/api'; + $wgExtensionMessagesFiles['TranslateAlias'] = __DIR__ . '/Translate.alias.php'; + $wgExtensionMessagesFiles['TranslateMagic'] = __DIR__ . '/Translate.i18n.magic.php'; -/** - * @cond file_level_code - * Setup class autoloading. - */ -$dir = __DIR__; -require_once "$dir/Autoload.php"; -/** @endcond */ - -/** - * Registering various resources - * @cond file_level_code - */ - -$wgMessagesDirs['PageTranslation'] = __DIR__ . '/i18n/pagetranslation'; -$wgMessagesDirs['Translate'] = __DIR__ . '/i18n/core'; -$wgMessagesDirs['TranslateSearch'] = __DIR__ . '/i18n/search'; -$wgMessagesDirs['TranslateSandbox'] = __DIR__ . '/i18n/sandbox'; -$wgMessagesDirs['TranslateApi'] = __DIR__ . '/i18n/api'; -$wgExtensionMessagesFiles['TranslateAlias'] = "$dir/Translate.alias.php"; -$wgExtensionMessagesFiles['TranslateMagic'] = "$dir/Translate.i18n.magic.php"; - -// Register initialization code -$wgExtensionFunctions[] = 'TranslateHooks::setupTranslate'; -$wgHooks['CanonicalNamespaces'][] = 'TranslateHooks::setupNamespaces'; -$wgHooks['ResourceLoaderTestModules'][] = 'TranslateHooks::onResourceLoaderTestModules'; -$wgHooks['UnitTestsList'][] = 'TranslateHooks::setupUnitTests'; -$wgHooks['LoadExtensionSchemaUpdates'][] = 'TranslateHooks::schemaUpdates'; -$wgHooks['ParserTestTables'][] = 'TranslateHooks::parserTestTables'; -$wgHooks['PageContentLanguage'][] = 'TranslateHooks::onPageContentLanguage'; -$wgHooks['ResourceLoaderRegisterModules'][] = 'TranslateHooks::onResourceLoaderRegisterModules'; - -// Register special pages into MediaWiki -$wgSpecialPages['Translate'] = 'SpecialTranslate'; -$wgSpecialPages['Translations'] = 'SpecialTranslations'; -// Disabled by default -// $wgSpecialPages['Magic'] = 'SpecialMagic'; -$wgSpecialPages['TranslationStats'] = 'SpecialTranslationStats'; -$wgSpecialPages['LanguageStats'] = 'SpecialLanguageStats'; -$wgSpecialPages['MessageGroupStats'] = 'SpecialMessageGroupStats'; -$wgSpecialPages['ImportTranslations'] = 'SpecialImportTranslations'; -$wgSpecialPages['ExportTranslations'] = 'SpecialExportTranslations'; -$wgSpecialPages['ManageMessageGroups'] = 'SpecialManageGroups'; -$wgSpecialPages['SupportedLanguages'] = 'SpecialSupportedLanguages'; -$wgSpecialPages['AggregateGroups'] = 'SpecialAggregateGroups'; -$wgSpecialPages['SearchTranslations'] = 'SpecialSearchTranslations'; - -// API -$wgAPIListModules['messagecollection'] = 'ApiQueryMessageCollection'; -$wgAPIMetaModules['languagestats'] = 'ApiQueryLanguageStats'; -$wgAPIMetaModules['messagegroups'] = 'ApiQueryMessageGroups'; -$wgAPIMetaModules['messagegroupstats'] = 'ApiQueryMessageGroupStats'; -$wgAPIMetaModules['messagetranslations'] = 'ApiQueryMessageTranslations'; -$wgAPIModules['aggregategroups'] = 'ApiAggregateGroups'; -$wgAPIModules['groupreview'] = 'ApiGroupReview'; -$wgAPIModules['translatesandbox'] = 'ApiTranslateSandbox'; -$wgAPIModules['translationaids'] = 'ApiTranslationAids'; -$wgAPIModules['translationreview'] = 'ApiTranslationReview'; -$wgAPIModules['translationstash'] = 'ApiTranslationStash'; -$wgAPIModules['ttmserver'] = 'ApiTTMServer'; -$wgAPIModules['searchtranslations'] = 'ApiSearchTranslations'; - -// Register hooks. -$wgHooks['EditPage::showEditForm:initial'][] = 'TranslateEditAddons::addTools'; -$wgHooks['AlternateEdit'][] = 'TranslateEditAddons::suppressIntro'; -$wgHooks['getUserPermissionsErrorsExpensive'][] = 'TranslateEditAddons::disallowLangTranslations'; -$wgHooks['EditPageBeforeEditButtons'][] = 'TranslateEditAddons::buttonHack'; -$wgHooks['LanguageGetTranslatedLanguageNames'][] = - 'TranslateHooks::translateMessageDocumentationLanguage'; -$wgHooks['TranslateSupportedLanguages'][] = - 'TranslateHooks::translateMessageDocumentationLanguage'; -$wgHooks['ArticlePrepareTextForEdit'][] = 'TranslateEditAddons::disablePreSaveTransform'; -$wgHooks['ParserFirstCallInit'][] = 'TranslateHooks::setupTranslateParserFunction'; -$wgHooks['UserGetReservedNames'][] = 'TranslateHooks::onUserGetReservedNames'; - -// Prevent translations creating bogus categories -$wgHooks['LinksUpdate'][] = 'TranslateHooks::preventCategorization'; -// Fuzzy tags for speed. -$wgHooks['PageContentSaveComplete'][] = 'TranslateEditAddons::onSave'; - -$wgHooks['Translate:newTranslation'][] = 'TranslateEditAddons::updateTransverTag'; - -$wgHooks['SkinTemplateNavigation::SpecialPage'][] = 'SpecialTranslate::tabify'; -$wgHooks['SkinTemplateNavigation::SpecialPage'][] = 'SpecialManageGroups::tabify'; - -// Custom preferences -$wgDefaultUserOptions['translate'] = 0; -$wgDefaultUserOptions['translate-editlangs'] = 'default'; -$wgDefaultUserOptions['translate-recent-groups'] = ''; -$wgHooks['GetPreferences'][] = 'TranslatePreferences::onGetPreferences'; -$wgHooks['GetPreferences'][] = 'TranslatePreferences::translationAssistLanguages'; - -// Recent changes filters -$wgHooks['ChangesListSpecialPageQuery'][] = 'TranslateRcFilter::translationFilter'; -$wgHooks['SpecialRecentChangesPanel'][] = 'TranslateRcFilter::translationFilterForm'; -$wgHooks['ChangesListSpecialPageStructuredFilters'][] = - 'TranslateRcFilter::onChangesListSpecialPageStructuredFilters'; -$wgHooks['SkinTemplateToolboxEnd'][] = 'TranslateToolbox::toolboxAllTranslations'; -$wgHooks['AbortEmailNotification'][] = 'TranslateHooks::onAbortEmailNotificationReview'; - -// Translation memory related -$wgHooks['ArticleDeleteComplete'][] = 'TTMServer::onDelete'; -$wgHooks['TranslateEventMessageMembershipChange'][] = 'TTMServer::onGroupChange'; - -// Translation display related -$wgHooks['ArticleContentOnDiff'][] = 'TranslateEditAddons::displayOnDiff'; - -// Search profile -$wgHooks['SpecialSearchProfiles'][] = 'TranslateHooks::searchProfile'; -$wgHooks['SpecialSearchProfileForm'][] = 'TranslateHooks::searchProfileForm'; -$wgHooks['SpecialSearchSetupEngine'][] = 'TranslateHooks::searchProfileSetupEngine'; - -$wgHooks['TitleIsAlwaysKnown'][] = 'TranslateHooks::onTitleIsAlwaysKnown'; - -// Stats table manipulation -$wgHooks['Translate:MessageGroupStats:isIncluded'][] = - 'TranslateHooks::hideDiscouragedFromStats'; -$wgHooks['Translate:MessageGroupStats:isIncluded'][] = - 'TranslateHooks::hideRestrictedFromStats'; - -$wgHooks['MakeGlobalVariablesScript'][] = 'TranslateHooks::addConfig'; - -// Internal event listeners -$wgHooks['TranslateEventTranslationReview'][] = 'MessageGroupStats::clear'; -$wgHooks['TranslateEventTranslationReview'][] = 'MessageGroupStatesUpdaterJob::onChange'; - -// Internal groups registers -$wgHooks['TranslatePostInitGroups'][] = 'MessageGroups::getCCGroups'; -$wgHooks['TranslatePostInitGroups'][] = 'MessageGroups::getTranslatablePages'; -$wgHooks['TranslatePostInitGroups'][] = 'MessageGroups::getConfiguredGroups'; -$wgHooks['TranslatePostInitGroups'][] = 'MessageGroups::getWorkflowGroups'; -$wgHooks['TranslatePostInitGroups'][] = 'MessageGroups::getAggregateGroups'; - -// Other extensions -$wgHooks['AdminLinks'][] = 'TranslateHooks::onAdminLinks'; -$wgHooks['MergeAccountFromTo'][] = 'TranslateHooks::onMergeAccountFromTo'; -$wgHooks['DeleteAccount'][] = 'TranslateHooks::onDeleteAccount'; -$wgHooks['AbuseFilter-filterAction'][] = 'TranslateHooks::onAbuseFilterFilterAction'; -$wgHooks['AbuseFilter-computeVariable'][] = 'TranslateHooks::onAbuseFilterComputeVariable'; -$wgHooks['AbuseFilter-builder'][] = 'TranslateHooks::onAbuseFilterBuilder'; - -// New rights -// right-translate -$wgAvailableRights[] = 'translate'; -// right-translate-import action-translate-import -$wgAvailableRights[] = 'translate-import'; -// right-translate-manage action-translate-manage -$wgAvailableRights[] = 'translate-manage'; -// right-translate-messagereview -$wgAvailableRights[] = 'translate-messagereview'; -// right-translate-groupreview -$wgAvailableRights[] = 'translate-groupreview'; - -// Logs. More logs are defined in TranslateHooks::setupTranslate -// log-name-translationreview log-descriptionmsg-translationreview -$wgLogTypes[] = 'translationreview'; -// logentry-translationreview-message logentry-translationreview-group -$wgLogActionsHandlers['translationreview/message'] = 'TranslateLogFormatter'; -$wgLogActionsHandlers['translationreview/group'] = 'TranslateLogFormatter'; - -// New jobs -$wgJobClasses['MessageIndexRebuildJob'] = 'MessageIndexRebuildJob'; -$wgJobClasses['MessageUpdateJob'] = 'MessageUpdateJob'; -$wgJobClasses['MessageGroupStatesUpdaterJob'] = 'MessageGroupStatesUpdaterJob'; -$wgJobClasses['TTMServerMessageUpdateJob'] = 'TTMServerMessageUpdateJob'; - -$wgParserTestFiles[] = "$dir/tests/parser/translateParserTests.txt"; - -require "$dir/Resources.php"; - -/** @endcond */ - -# == Configuration variables == - -# === Basic configuration === -# <source lang=php> -/** - * Language code for message documentation. Suggested values are qqq or info. - * If set to false (default), message documentation feature is disabled. - */ -$wgTranslateDocumentationLanguageCode = false; - -/** - * Name of the bot which will invalidate translations and do maintenance - * for page translation feature. Also used for importing messages from external - * sources. - */ -$wgTranslateFuzzyBotName = 'FuzzyBot'; - -/** - * Add a preference "Do not send me email newsletters" in the email preferences. - */ -$wgTranslateNewsletterPreference = false; - -/** - * Default values for list of languages to show translators as an aid when - * translating. Each user can override this setting in their preferences. - * Example: - * $wgTranslateLanguageFallbacks['fi'] = 'sv'; - * $wgTranslateLanguageFallbacks['sv'] = array( 'da', 'no', 'nn' ); - */ -$wgTranslateLanguageFallbacks = []; - -/** - * Text that will be shown in translations if the translation is outdated. - * Must be something that does not conflict with actual content. - */ -if ( !defined( 'TRANSLATE_FUZZY' ) ) { - define( 'TRANSLATE_FUZZY', '!!FUZZY!!' ); + /* wfWarn( + 'Deprecated PHP entry point used for Translate extension. Please use wfLoadExtension '. + 'instead, see https://www.mediawiki.org/wiki/Extension_registration for more details.' + ); */ + return true; } -/** - * Define various web services that provide translation suggestions. - * - * Translation memories are documented in our main documentation. - * @see https://www.mediawiki.org/wiki/Help:Extension:Translate/Translation_memories - * - * For Apertium, you should get an API key. - * @see http://wiki.apertium.org/wiki/Apertium_web_service - * - * Yandex translation helper also provides langlimit option to limit total - * number of suggestions (set to 0 to get all possible translations) - * and langorder array to sort languages. Yandex translate engine is based on - * wordnet, generated from search index, so number of indexed websites should be - * a good heuristic to define the default language order. - * - * The machine translation services are provided with the following information: - * - server ip address - * - versions of MediaWiki and Translate extension - * - clients ip address encrypted with $wgProxyKey - * - source text to translate - * - private API key if provided - */ -$wgTranslateTranslationDefaultService = 'TTMServer'; -$wgTranslateTranslationServices = []; -$wgTranslateTranslationServices['TTMServer'] = [ - 'database' => false, // Passed to wfGetDB - 'cutoff' => 0.75, - 'type' => 'ttmserver', - 'public' => false, -]; -$wgTranslateTranslationServices['Microsoft'] = [ - 'url' => 'http://api.microsofttranslator.com/V2/Http.svc/Translate', - 'key' => null, - 'timeout' => 3, - 'type' => 'microsoft', -]; -$wgTranslateTranslationServices['Apertium'] = [ - 'url' => 'http://api.apertium.org/json/translate', - 'pairs' => 'http://api.apertium.org/json/listPairs', - 'key' => null, - 'timeout' => 3, - 'type' => 'apertium', -]; -$wgTranslateTranslationServices['Yandex'] = [ - 'url' => 'https://translate.yandex.net/api/v1.5/tr.json/translate', - 'key' => null, - 'pairs' => 'https://translate.yandex.net/api/v1.5/tr.json/getLangs', - 'timeout' => 3, - 'langorder' => [ 'en', 'ru', 'uk', 'de', 'fr', 'pl', 'it', 'es', 'tr' ], - 'langlimit' => 1, - 'type' => 'yandex', -]; - -/** - * List of tasks in Special:Translate. If you are only using page translation - * feature, you might want to disable 'optional' task. Example: - * unset($wgTranslateTasks['optional']); - */ -$wgTranslateTasks = [ - 'view' => 'ViewMessagesTask', - 'untranslated' => 'ViewUntranslatedTask', - 'optional' => 'ViewOptionalTask', - 'acceptqueue' => 'AcceptQueueMessagesTask', - 'reviewall' => 'ReviewAllMessagesTask', - 'custom' => 'CustomFilteredMessagesTask', -]; - -/** - * Experimental support for an "Ask" help button. - * Might change into a hook later on. - * This is an array with keys page, url and params. - * - page is a title of a local wiki page - * - url is an URL to use as is (e.g. an issue tracker submission form) - * which will override the page if set - * - params is an array of key-value pairs of request params - * -- each param value can contain the variable %MESSAGE% - * which will be replaced with the full page name. - * @since 2011-03-11 - */ -$wgTranslateSupportUrl = false; - -/** - * Like $wgTranslateSupportUrl, but for a specific namespace. - * Each $wgTranslateSupportUrl-like array needs to be the value - * assigned to the numerical ID of a namespace of the wiki. - * @since 2015.09 - */ -$wgTranslateSupportUrlNamespace = []; - -/** - * When unprivileged users open a translation editor, they will - * see a message stating that a special permission is needed for translating - * messages. If this variable is defined, there is a button which will - * take the user to that page to ask for permission. - * The target needs to be reiterated with the second variable to have - * the same result with sandbox enabled where users can't enter the sandbox. - */ -$wgTranslatePermissionUrl = 'Project:Translator'; -$wgTranslateSecondaryPermissionUrl = 'Project:Translator'; - -# </source> -# === Page translation feature === -# <source lang=php> -/** - * Enable page translation feature. - * - * Page translation feature allows structured translation of wiki pages - * with simple markup and automatic tracking of changes. - * - * @defgroup PageTranslation Page Translation - * @see https://www.mediawiki.org/wiki/Help:Extension:Translate/Page_translation_administration - */ -$wgEnablePageTranslation = true; - -/** - * Number for the Translations namespace. Change this if it conflicts with - * other namespace in your wiki. - */ -$wgPageTranslationNamespace = 1198; - -/** - * If set to true, when a user selects an interface language via ULS (Universal - * Language Selector), if the current page is a translatable page or a translation - * page then the user is also redirected to the corresponding translation page - * in the selected language. - * - * The language of the translation pages visited afterwards will still depend on the - * links followed (it will be the interface language only if the links use the - * Special:MyLanguage syntax). - * @since 2013-03-10 - */ -$wgTranslatePageTranslationULS = false; - -/** - * If set to true, when a translated page has some units marked as outdated, the - * outdated translation will be shown. If set to false, the original updated unit - * in the original language will be shown. - * - * Changing this setting requires the following script to be run to take effect on - * existing changes: scripts/refresh-translatable-pages.php - * @since 2016.12 - */ -$wgTranslateKeepOutdatedTranslations = true; - -# </source> -# === Message group configuration === -# <source lang=php> - -/** - * Two-dimensional array of languages that cannot be translated. - * Input can be exact group name, first part before '-' or '*' for all. - * Second dimension should be language code mapped to reason for disabling. - * Reason is parsed as wikitext. - * - * Example: - * $wgTranslateBlacklist = array( - * '*' => array( // All groups - * 'en' => 'English is the source language.', - * ), - * 'core' => array( // Exact group - * 'mul' => 'Not a real language.', - * ), - * 'ext' => array( // Wildcard-like group - * 'mul' => 'Not a real language', - * ), - * ); - */ - -$wgTranslateBlacklist = []; - -/** - * File containing checks that are to be skipped. See - * https://gerrit.wikimedia.org/r/gitweb?p=translatewiki.git;a=blob;f=check-blacklist.php;hb=HEAD - * for example. - * - * @since 2012-10-15 - */ -$wgTranslateCheckBlacklist = false; - -/** - * Two-dimensional array of rules that blacklists certain authors from appearing - * in the exports. This is useful for keeping bots and people doing maintenance - * work in translations not to appear besides real translators everywhere. - * - * Rules are arrays, where first element is type: white or black. Whitelisting - * always overrules blacklisting. Second element should be a valid pattern that - * can be given a preg_match(). It will be matched against string of format - * "group-id;language;author name", without quotes. - * As an example by default we have rule that ignores all authors whose name - * ends in a bot for all languages and all groups. - */ -$wgTranslateAuthorBlacklist = []; -$wgTranslateAuthorBlacklist[] = [ 'black', '/^.*;.*;.*Bot$/Ui' ]; - -/** - * List of namespace that contain messages. No talk namespaces. - * @see https://www.mediawiki.org/wiki/Help:Extension:Translate/Group_configuration - */ -$wgTranslateMessageNamespaces = []; - -/** - * CC = Custom classes. - * Custom classes can register themselves here. - * Key is always the group id, while the value is an message group object - * or callable function. - * @deprecated Use TranslatePostInitGroups hook instead. - */ -$wgTranslateCC = []; - -/** - * Location in the filesystem to which paths are relative in custom groups. - */ -$wgTranslateGroupRoot = '/var/www/externals'; - -/** - * The newest and recommended way of adding custom groups is YAML files. - * See examples under Translate/groups - * Usage example: - * $wgTranslateGroupFiles[] = "$IP/extensions/Translate/groups/Shapado/Shapado.yml"; - */ -$wgTranslateGroupFiles = []; - -/** - * List of possible message group review workflow states and properties - * for each state. - * The currently supported properties are: - * * color: the color that is used for displaying the state in the tables. - * * right: additional right that is needed to set the state. - * Users who have the translate-groupreview right can set this in - * Special:Translate. - * The state is visible in Special:Translate, Special:MessageGroupStats and - * Special:LanguageStats. - * If the value is false, the workflow states feature is disabled. - * State name can be up to 32 characters maximum. - * Example: - * $wgTranslateWorkflowStates = array( - * 'new' => array( 'color' => 'FF0000' ), // red - * 'needs_proofreading' => array( 'color' => '0000FF' ), // blue - * 'ready' => array( 'color' => 'FFFF00' ), // yellow - * 'published' => array( - * 'color' => '00FF00', // green - * 'right' => 'centralnotice-admin', - * ), - * ); - */ -$wgTranslateWorkflowStates = false; - -/** - * Map from deprecated group IDs to their current ID - * Example value: array( 'core' => 'mediawiki-core' ) - */ -$wgTranslateGroupAliases = []; - -# </source> -# === System setup related configuration === -# <source lang=php> -/** - * Set location of cache files. Defaults to $wgCacheDirectory. - */ -$wgTranslateCacheDirectory = false; - -/** - * Configures how the message index is stored. - * The other backends need $wgCacheDirectory to be functional. - */ -$wgTranslateMessageIndex = [ 'DatabaseMessageIndex' ]; -// $wgTranslateMessageIndex = array( 'SerializedMessageIndex' ); -// $wgTranslateMessageIndex = array( 'CDBMessageIndex' ); - -/** - * If you have lots of message groups, especially file based ones, and the - * message index rebuilding gets slow, set this to true to delay the rebuilding - * via JobQueue. This only makes sense if you have configured jobs to be - * processed outside of requests via cron or similar. - * @since 2012-05-03 - */ -$wgTranslateDelayedMessageIndexRebuild = false; - -# </source> -# ==== PHPlot ==== -# <source lang=php> -/** - * For Special:TranslationStats PHPlot is needed to produce graphs. - * Set this the location of phplot.php. - */ -$wgTranslatePHPlot = false; - -/** - * The default font for PHPlot for drawing text. Only used if the automatic - * best font selection fails. The automatic best font selector uses language - * code to call fc-match program. If you have open_basedir restriction or - * safe-mode, using the found font is likely to fail. In this case you need - * to change the code to use hard-coded font, or copy fonts to location PHP - * can access them, and make sure fc-match returns only those fonts. - */ -$wgTranslatePHPlotFont = '/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf'; - -# </source> -# ==== YAML driver ==== -# <source lang=php> -/** - * Currently supported YAML drivers are phpyaml, spyc and syck. - * - * For phpyaml see https://secure.php.net/manual/en/book.yaml.php. - * - * For syck we're shelling out to perl. So you need: - * - * * At least perl 5.8 (find out what you have by running "perl -v") - * * Install these modules from CPAN - * * YAML::Syck - * * PHP::Serialization. - * * File::Slurp - * - * You should be able to do this with: - * for module in 'YAML::Syck' 'PHP::Serialization' 'File::Slurp'; do cpanp -i $module; done - * - * For the shell to work, you also need an en.UTF-8 locale installed on your system. - * add a line "en.UTF-8" to your /etc/locale.gen or uncomment an existing one and run locale-gen - * if you do not have it already. - * - * phpyaml is the fastest and based on libyaml so the output should be most - * compatible. spyc output format is least compatible. syck is slowest but - * almost as good as phpyaml. - * - * spyc needs to be installed using composer. See https://www.mediawiki.org/wiki/Composer - */ -$wgTranslateYamlLibrary = function_exists( 'yaml_parse' ) ? 'phpyaml' : 'spyc'; - -# </source> -# ==== Sandbox ==== -# <source lang=php> - -/** - * Whether to allow users to sign up via a sandbox. Sandboxed users cannot do - * much until approved and thus they can be get rid of easily. This only works - * with MediaWiki 1.27 and newer, and only if registration is configured to not - * use account creation providers which give REDIRECT or UI responses or - * require any other field than the default username/password/email. - * @since 2013.04 - */ -$wgTranslateUseSandbox = false; - -/** - * To which group the translators are promoted. If left at false, they will just - * be removed from sandbox and become normal users. - * @since 2013.04 - */ -$wgTranslateSandboxPromotedGroup = false; - -/** - * List of page names to always suggest for sandboxed users. - * @since 2013.10 - */ -$wgTranslateSandboxSuggestions = []; - -/** - * Maximum number of translations a user can make in the sandbox. - * @since 2013.10 - */ -$wgTranslateSandboxLimit = 20; - -# </source> -# === Unsorted === -# <source lang=php> -/** - * Pre-save transform for message pages. MediaWiki does this by default - * (including for pages in the MediaWiki-namespace). By setting this to - * false it allows users to put untransformed syntax such as "~~~~" into - * a page without having them be transformed upon save. - */ -$wgTranslateUsePreSaveTransform = false; - -/** - * Default action for the RecentChanges filter, which makes it possible to filter - * translations away or show them only. - * Possible values: ('noaction', 'only', 'filter', 'site') - */ -$wgTranslateRcFilterDefault = 'filter'; - -/** - * Set this to config like $wgTranslateTranslationServices if you want to run - * SolrTTMServer tests. - * @since 2013-01-04 - */ -$wgTranslateTestTTMServer = null; - -/** - * List of user names that are allowed to alter their privileges and do other - * things. Used for supporting integration testing. - * @since 2013.10 - */ -$wgTranslateTestUsers = []; - -# </source> - -/** - * Helper function for adding namespace for message groups. - * - * It defines constants for the namespace (and talk namespace) and sets up - * restrictions and some other configuration. - * @param \int $id Namespace number - * @param \string $name Name of the namespace - * @param \string $constant (optional) name of namespace constant, defaults to - * NS_ followed by upper case version of $name, e.g., NS_MEDIAWIKI - */ -function wfAddNamespace( $id, $name, $constant = null ) { - global $wgExtraNamespaces, $wgContentNamespaces, $wgTranslateMessageNamespaces, - $wgNamespaceProtection, $wgNamespacesWithSubpages, $wgNamespacesToBeSearchedDefault; - - if ( is_null( $constant ) ) { - $constant = strtoupper( "NS_$name" ); - } - - define( $constant, $id ); - define( $constant . '_TALK', $id + 1 ); - - $wgExtraNamespaces[$id] = $name; - $wgExtraNamespaces[$id + 1] = $name . '_talk'; - - $wgContentNamespaces[] = $id; - $wgTranslateMessageNamespaces[] = $id; - - $wgNamespacesWithSubpages[$id] = true; - $wgNamespacesWithSubpages[$id + 1] = true; - - $wgNamespaceProtection[$id] = [ 'translate' ]; - - $wgNamespacesToBeSearchedDefault[$id] = true; -} - -/** @defgroup TranslateSpecialPage Special pages of Translate extension */ - -if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) { - require_once __DIR__ . '/vendor/autoload.php'; -} +die( 'This version of the Translate extension requires MediaWiki 1.25+.' ); diff --git a/TranslateHooks.php b/TranslateHooks.php index a06a57b..00c78f1 100644 --- a/TranslateHooks.php +++ b/TranslateHooks.php @@ -828,3 +828,43 @@ $resourceLoader->register( $modules ); } } + +/** + * Version number used in extension credits and in other places where needed. + */ +define( 'TRANSLATE_VERSION', '2017-10-30' ); + +/** + * Helper function for adding namespace for message groups. + * + * It defines constants for the namespace (and talk namespace) and sets up + * restrictions and some other configuration. + * @param \int $id Namespace number + * @param \string $name Name of the namespace + * @param \string $constant (optional) name of namespace constant, defaults to + * NS_ followed by upper case version of $name, e.g., NS_MEDIAWIKI + */ +function wfAddNamespace( $id, $name, $constant = null ) { + global $wgExtraNamespaces, $wgContentNamespaces, $wgTranslateMessageNamespaces, + $wgNamespaceProtection, $wgNamespacesWithSubpages, $wgNamespacesToBeSearchedDefault; + + if ( is_null( $constant ) ) { + $constant = strtoupper( "NS_$name" ); + } + + define( $constant, $id ); + define( $constant . '_TALK', $id + 1 ); + + $wgExtraNamespaces[$id] = $name; + $wgExtraNamespaces[$id + 1] = $name . '_talk'; + + $wgContentNamespaces[] = $id; + $wgTranslateMessageNamespaces[] = $id; + + $wgNamespacesWithSubpages[$id] = true; + $wgNamespacesWithSubpages[$id + 1] = true; + + $wgNamespaceProtection[$id] = [ 'translate' ]; + + $wgNamespacesToBeSearchedDefault[$id] = true; +} diff --git a/extension.json b/extension.json new file mode 100644 index 0000000..7a0547a --- /dev/null +++ b/extension.json @@ -0,0 +1,1246 @@ +{ + "manifest_version": 2, + "name": "Translate", + "type": "specialpage", + "author": [ + "Niklas Laxström", + "Santhosh Thottingal", + "Christian Williams", + "Siebrand Mazeland", + "..." + ], + "version": "2017-10-30", + "url": "https://www.mediawiki.org/wiki/Extension:Translate", + "descriptionmsg": "translate-desc", + "license-name": "GPL-2.0+", + "requires": { + "MediaWiki": ">= 1.27.0" + }, + "AutoloadClasses": { + "Translate": "Autoload.php", + "TranslateVendor": "vendor/autoload.php" + }, + "callback": "TranslateHooks::setupTranslate", + "MessagesDirs": { + "PageTranslation": "/i18n/pagetranslation", + "Translate": "/i18n/core", + "TranslateSearch": "/i18n/search", + "TranslateSandbox": "/i18n/sandbox", + "TranslateApi": "/i18n/api" + }, + "ExtensionMessagesFiles": { + "TranslateAlias": "Translate.alias.php", + "TranslateMagic": "Translate.i18n.magic.php" + }, + "Hooks": { + "CanonicalNamespaces": [ + "TranslateHooks::setupNamespaces" + ], + "ResourceLoaderTestModules": [ + "TranslateHooks::onResourceLoaderTestModules" + ], + "UnitTestsList": [ + "TranslateHooks::setupUnitTests" ], + "LoadExtensionSchemaUpdates": [ + "TranslateHooks::schemaUpdates" ], + "ParserTestTables": [ + "TranslateHooks::parserTestTables" + ], + "PageContentLanguage": [ + "TranslateHooks::onPageContentLanguage" + ], + "ResourceLoaderRegisterModules": [ + "TranslateHooks::onResourceLoaderRegisterModules" + ], + "EditPage::showEditForm:initial": [ + "TranslateEditAddons::addTools" + ], + "AlternateEdit": [ + "TranslateEditAddons::suppressIntro" + ], + "getUserPermissionsErrorsExpensive": [ + "TranslateEditAddons::disallowLangTranslations" + ], + "EditPageBeforeEditButtons": [ + "TranslateEditAddons::buttonHack" + ], + "LanguageGetTranslatedLanguageNames": [ + "TranslateHooks::translateMessageDocumentationLanguage" + ], + "TranslateSupportedLanguages": [ + "TranslateHooks::translateMessageDocumentationLanguage" + ], + "ArticlePrepareTextForEdit": [ + "TranslateEditAddons::disablePreSaveTransform" + ], + "ParserFirstCallInit": [ + "TranslateHooks::setupTranslateParserFunction" + ], + "UserGetReservedNames": [ + "TranslateHooks::onUserGetReservedNames" + ], + "LinksUpdate": [ + "TranslateHooks::preventCategorization" + ], + "PageContentSaveComplete": [ + "TranslateEditAddons::onSave" + ], + "Translate:newTranslation": [ + "TranslateEditAddons::updateTransverTag" + ], + "SkinTemplateNavigation::SpecialPage": [ + "SpecialTranslate::tabify", + "SpecialManageGroups::tabify" + ], + "GetPreferences": [ + "TranslatePreferences::onGetPreferences", + "TranslatePreferences::translationAssistLanguages" + ], + "ChangesListSpecialPageQuery": [ + "TranslateRcFilter::translationFilter" + ], + "SpecialRecentChangesPanel": [ + "TranslateRcFilter::translationFilterForm" + ], + "ChangesListSpecialPageStructuredFilters": [ + "TranslateRcFilter::onChangesListSpecialPageStructuredFilters" + ], + "SkinTemplateToolboxEnd": [ + "TranslateToolbox::toolboxAllTranslations" + ], + "AbortEmailNotification": [ + "TranslateHooks::onAbortEmailNotificationReview" + ], + "ArticleDeleteComplete": [ + "TTMServer::onDelete" + ], + "TranslateEventMessageMembershipChange": [ + "TTMServer::onGroupChange" + ], + "ArticleContentOnDiff": [ + "TranslateEditAddons::displayOnDiff" + ], + "SpecialSearchProfiles": [ + "TranslateHooks::searchProfile" + ], + "SpecialSearchProfileForm": [ + "TranslateHooks::searchProfileForm" + ], + "SpecialSearchSetupEngine": [ + "TranslateHooks::searchProfileSetupEngine" + ], + "TitleIsAlwaysKnown": [ + "TranslateHooks::onTitleIsAlwaysKnown" + ], + "Translate:MessageGroupStats:isIncluded": [ + "TranslateHooks::hideDiscouragedFromStats", + "TranslateHooks::hideRestrictedFromStats" + ], + "MakeGlobalVariablesScript": [ + "TranslateHooks::addConfig" + ], + "TranslateEventTranslationReview": [ + "MessageGroupStats::clear", + "MessageGroupStatesUpdaterJob::onChange" + ], + "TranslatePostInitGroups": [ + "MessageGroups::getCCGroups", + "MessageGroups::getTranslatablePages", + "MessageGroups::getConfiguredGroups", + "MessageGroups::getWorkflowGroups", + "MessageGroups::getAggregateGroups" + ], + "AdminLinks": [ + "TranslateHooks::onAdminLinks" + ], + "MergeAccountFromTo": [ + "TranslateHooks::onMergeAccountFromTo" + ], + "DeleteAccount": [ + "TranslateHooks::onDeleteAccount" + ], + "AbuseFilter-filterAction": [ + "TranslateHooks::onAbuseFilterFilterAction" + ], + "AbuseFilter-computeVariable": [ + "TranslateHooks::onAbuseFilterComputeVariable" + ], + "AbuseFilter-builder": [ + "TranslateHooks::onAbuseFilterBuilder" + ] + }, + "SpecialPages": { + "Translate": "SpecialTranslate", + "Translations": "SpecialTranslations", + "TranslationStats": "SpecialTranslationStats", + "LanguageStats": "SpecialLanguageStats", + "MessageGroupStats": "SpecialMessageGroupStats", + "ImportTranslations": "SpecialImportTranslations", + "ExportTranslations": "SpecialExportTranslations", + "ManageMessageGroups": "SpecialManageGroups", + "SupportedLanguages": "SpecialSupportedLanguages", + "AggregateGroups": "SpecialAggregateGroups", + "SearchTranslations": "SpecialSearchTranslations" + }, + "APIListModules": { + "messagecollection": "ApiQueryMessageCollection" + }, + "APIMetaModules": { + "languagestats": "ApiQueryLanguageStats", + "messagegroups": "ApiQueryMessageGroups", + "messagegroupstats": "ApiQueryMessageGroupStats", + "messagetranslations": "ApiQueryMessageTranslations" + }, + "APIModules": { + "aggregategroups": "ApiAggregateGroups", + "groupreview": "ApiGroupReview", + "translatesandbox": "ApiTranslateSandbox", + "translationaids": "ApiTranslationAids", + "translationreview": "ApiTranslationReview", + "translationstash": "ApiTranslationStash", + "ttmserver": "ApiTTMServer", + "searchtranslations": "ApiSearchTranslations" + }, + "APIFormatModules": { + "type": "object" + }, + "APIPropModules": { + "type": "object" + }, + "DefaultUserOptions": { + "translate": 0, + "translate-editlangs": "default", + "translate-recent-groups": "" + }, + "AvailableRights": [ + "translate", + "translate-import", + "translate-manage", + "translate-messagereview", + "translate-groupreview" + ], + "LogTypes": [ + "translationreview" + ], + "LogActionsHandlers": { + "translationreview/message": "TranslateLogFormatter", + "translationreview/group": "TranslateLogFormatter" + }, + "JobClasses": { + "MessageIndexRebuildJob": "MessageIndexRebuildJob", + "MessageUpdateJob": "MessageUpdateJob", + "MessageGroupStatesUpdaterJob": "MessageGroupStatesUpdaterJob", + "TTMServerMessageUpdateJob": "TTMServerMessageUpdateJob" + }, + "ParserTestFiles": [ + "tests/parser/translateParserTests.txt" + ], + "ResourceFileModulePaths": { + "localBasePath": "", + "remoteExtPath": "Translate" + }, + "ResourceModules": { + "ext.translate": { + "styles": "resources/css/ext.translate.css", + "position": "top", + "targets": [ + "desktop", + "mobile" + ] + }, + "ext.translate.base": { + "scripts": "resources/js/ext.translate.base.js", + "dependencies": [ + "ext.translate.hooks", + "mediawiki.api", + "mediawiki.util" + ], + "messages": "translate-js-support-unsaved-warning", + "targets": [ + "desktop", + "mobile" + ] + }, + "ext.translate.dropdownmenu": { + "scripts": "resources/js/ext.translate.dropdownmenu.js", + "styles": "resources/css/ext.translate.dropdownmenu.css", + "targets": [ + "desktop", + "mobile" + ] + }, + "ext.translate.editor": { + "scripts": [ + "resources/js/ext.translate.editor.helpers.js", + "resources/js/ext.translate.editor.js", + "resources/js/ext.translate.editor.shortcuts.js", + "resources/js/ext.translate.pagemode.js", + "resources/js/ext.translate.proofread.js" + ], + "styles": [ + "resources/css/ext.translate.editor.css", + "resources/css/ext.translate.pagemode.css", + "resources/css/ext.translate.proofread.css" + ], + "dependencies": [ + "ext.translate.base", + "ext.translate.dropdownmenu", + "ext.translate.hooks", + "ext.translate.storage", + "jquery.accessKeyLabel", + "jquery.autosize", + "jquery.makeCollapsible", + "jquery.textSelection", + "jquery.textchange", + "mediawiki.Uri", + "mediawiki.api", + "mediawiki.api.parse", + "mediawiki.jqueryMsg", + "mediawiki.language", + "mediawiki.user", + "mediawiki.util" + ], + "messages": [ + "translate-edit-askpermission", + "translate-edit-nopermission", + "tux-editor-add-desc", + "tux-editor-ask-help", + "tux-editor-cancel-button-label", + "tux-editor-close-tooltip", + "tux-editor-collapse-tooltip", + "tux-editor-confirm-button-label", + "tux-editor-discard-changes-button-label", + "tux-editor-doc-editor-cancel", + "tux-editor-doc-editor-placeholder", + "tux-editor-doc-editor-save", + "tux-editor-edit-desc", + "tux-editor-expand-tooltip", + "tux-editor-in-other-languages", + "tux-editor-loading", + "tux-editor-message-desc-less", + "tux-editor-message-desc-more", + "tux-editor-message-tools-show-editor", + "tux-editor-message-tools-delete", + "tux-editor-message-tools-history", + "tux-editor-message-tools-translations", + "tux-editor-n-uses", + "tux-editor-need-more-help", + "tux-editor-outdated-warning", + "tux-editor-outdated-warning-diff-link", + "tux-editor-paste-original-button-label", + "tux-editor-placeholder", + "tux-editor-editsummary-placeholder", + "tux-editor-proofread-button-label", + "tux-editor-save-button-label", + "tux-editor-save-failed", + "tux-editor-shortcut-info", + "tux-editor-skip-button-label", + "tux-editor-suggestions-title", + "tux-editor-tm-match", + "tux-proofread-action-tooltip", + "tux-proofread-edit-label", + "tux-proofread-translated-by-self", + "tux-session-expired", + "tux-status-saving", + "tux-status-translated", + "tux-status-unsaved", + "tux-save-unknown-error", + "tux-warnings-hide", + "tux-warnings-more", + "spamprotectiontext" + ], + "position": "top", + "targets": [ + "desktop", + "mobile" + ] + }, + "ext.translate.groupselector": { + "scripts": "resources/js/ext.translate.groupselector.js", + "styles": "resources/css/ext.translate.groupselector.css", + "dependencies": [ + "ext.translate.base", + "ext.translate.loader", + "ext.translate.statsbar", + "jquery.ui.position", + "mediawiki.jqueryMsg" + ], + "messages": [ + "translate-msggroupselector-search-all", + "translate-msggroupselector-search-placeholder", + "translate-msggroupselector-search-recent", + "translate-msggroupselector-view-subprojects" + ], + "position": "top", + "targets": [ + "desktop", + "mobile" + ] + }, + "ext.translate.hooks": { + "scripts": "resources/js/ext.translate.hooks.js", + "position": "top", + "targets": [ + "desktop", + "mobile" + ] + }, + "ext.translate.legacy": { + "styles": "resources/css/ext.translate.legacy.css", + "position": "top", + "targets": [ + "desktop", + "mobile" + ] + }, + "ext.translate.loader": { + "styles": "resources/css/ext.translate.loader.css", + "position": "top", + "targets": [ + "desktop", + "mobile" + ] + }, + "ext.translate.messagetable": { + "scripts": "resources/js/ext.translate.messagetable.js", + "styles": "resources/css/ext.translate.messagetable.less", + "dependencies": [ + "ext.translate.base", + "ext.translate.hooks", + "ext.translate.loader", + "ext.translate.parsers", + "jquery.textchange", + "jquery.throttle-debounce", + "mediawiki.Uri", + "mediawiki.jqueryMsg", + "mediawiki.util" + ], + "messages": [ + "api-error-badtoken", + "api-error-emptypage", + "api-error-fuzzymessage", + "api-error-invalidrevision", + "api-error-owntranslation", + "api-error-unknownerror", + "api-error-unknownmessage", + "tpt-unknown-page", + "translate-edit-title", + "translate-language-disabled", + "tux-edit", + "tux-empty-list-all", + "tux-empty-list-all-guide", + "tux-empty-list-other", + "tux-empty-list-other-action", + "tux-empty-list-other-guide", + "tux-empty-list-other-link", + "tux-empty-list-translated", + "tux-empty-list-translated-action", + "tux-empty-list-translated-guide", + "tux-empty-no-messages-to-display", + "tux-empty-no-outdated-messages", + "tux-empty-nothing-new-to-proofread", + "tux-empty-nothing-to-proofread", + "tux-empty-show-optional-messages", + "tux-empty-there-are-optional", + "tux-empty-you-can-help-providing", + "tux-empty-you-can-review-already-proofread", + "tux-message-filter-advanced-button", + "tux-message-filter-placeholder", + "tux-message-filter-result", + "tux-messagetable-loading-messages", + "tux-messagetable-more-messages", + "tux-status-fuzzy", + "tux-status-optional", + "tux-status-proofread", + "tux-status-translated" + ], + "position": "bottom", + "targets": [ + "desktop", + "mobile" + ] + }, + "ext.translate.messagewebimporter": { + "styles": "resources/css/ext.translate.messagewebimporter.css", + "position": "top", + "targets": [ + "desktop", + "mobile" + ] + }, + "ext.translate.multiselectautocomplete": { + "scripts": "resources/js/ext.translate.multiselectautocomplete.js", + "dependencies": "jquery.ui.autocomplete", + "position": "top", + "targets": [ + "desktop" + ] + }, + "ext.translate.navitoggle": { + "scripts": "resources/js/ext.translate.navitoggle.js", + "skinStyles": { + "vector": "resources/css/ext.translate.navitoggle.css" + }, + "targets": [ + "desktop", + "mobile" + ] + }, + "ext.translate.pagetranslation.uls": { + "scripts": "resources/js/ext.translate.pagetranslation.uls.js", + "dependencies": [ + "ext.uls.mediawiki", + "mediawiki.util" + ], + "targets": [ + "desktop", + "mobile" + ] + }, + "ext.translate.parsers": { + "scripts": "resources/js/ext.translate.parsers.js", + "dependencies": "mediawiki.util", + "targets": [ + "desktop", + "mobile" + ] + }, + "ext.translate.quickedit": { + "scripts": "resources/js/ext.translate.quickedit.js", + "styles": "resources/css/ext.translate.quickedit.css", + "dependencies": [ + "ext.translate.hooks", + "jquery.accessKeyLabel", + "jquery.autosize", + "jquery.form", + "jquery.ui.dialog", + "mediawiki.util" + ], + "messages": [ + "translate-js-nonext", + "translate-js-save-failed" + ], + "targets": [ + "desktop" + ] + }, + "ext.translate.selecttoinput": { + "scripts": "resources/js/ext.translate.selecttoinput.js", + "targets": [ + "desktop", + "mobile" + ] + }, + "ext.translate.special.aggregategroups": { + "scripts": "resources/js/ext.translate.special.aggregategroups.js", + "styles": "resources/css/ext.translate.special.aggregategroups.css", + "dependencies": [ + "jquery.ui.autocomplete", + "mediawiki.api", + "mediawiki.util" + ], + "messages": [ + "tpt-aggregategroup-add", + "tpt-aggregategroup-edit-description", + "tpt-aggregategroup-edit-name", + "tpt-aggregategroup-remove-confirm", + "tpt-aggregategroup-update", + "tpt-aggregategroup-update-cancel", + "tpt-invalid-group" + ], + "position": "top", + "targets": [ + "desktop" + ] + }, + "ext.translate.special.importtranslations": { + "scripts": "resources/js/ext.translate.special.importtranslations.js", + "dependencies": "jquery.ui.autocomplete", + "targets": [ + "desktop" + ] + }, + "ext.translate.special.languagestats": { + "scripts": "resources/js/ext.translate.special.languagestats.js", + "styles": "resources/css/ext.translate.special.languagestats.css", + "dependencies": "jquery.tablesorter", + "messages": [ + "translate-langstats-collapse", + "translate-langstats-collapseall", + "translate-langstats-expand", + "translate-langstats-expandall" + ], + "targets": [ + "desktop" + ] + }, + "ext.translate.special.managegroups": { + "styles": "resources/css/ext.translate.special.managegroups.css", + "position": "top", + "targets": [ + "desktop", + "mobile" + ] + }, + "ext.translate.special.managetranslatorsandbox": { + "scripts": "resources/js/ext.translate.special.managetranslatorsandbox.js", + "dependencies": [ + "ext.translate.loader", + "ext.translate.translationstashstorage", + "ext.uls.mediawiki", + "jquery.ui.dialog", + "mediawiki.api", + "mediawiki.jqueryMsg", + "mediawiki.language" + ], + "messages": [ + "tsb-accept-all-button-label", + "tsb-accept-button-label", + "tsb-reject-confirmation", + "tsb-accept-confirmation", + "tsb-all-languages-button-label", + "tsb-didnt-make-any-translations", + "tsb-no-requests-from-new-users", + "tsb-older-requests", + "tsb-reject-all-button-label", + "tsb-reject-button-label", + "tsb-reminder-failed", + "tsb-reminder-link-text", + "tsb-reminder-sending", + "tsb-reminder-sent", + "tsb-reminder-sent-new", + "tsb-request-count", + "tsb-selected-count", + "tsb-translations-current", + "tsb-translations-source", + "tsb-translations-user", + "tsb-user-posted-a-comment" + ], + "targets": [ + "desktop" + ] + }, + "ext.translate.special.managetranslatorsandbox.styles": { + "styles": "resources/css/ext.translate.special.managetranslatorsandbox.css", + "targets": [ + "desktop", + "mobile" + ] + }, + "ext.translate.special.pagemigration": { + "scripts": "resources/js/ext.translate.special.pagemigration.js", + "styles": "resources/css/ext.translate.special.pagemigration.css", + "dependencies": [ + "jquery.ajaxdispatcher", + "mediawiki.api", + "mediawiki.api.edit", + "mediawiki.ui", + "mediawiki.ui.button" + ], + "messages": [ + "pm-add-icon-hover-text", + "pm-delete-icon-hover-text", + "pm-extra-units-warning", + "pm-langcode-missing", + "pm-old-translations-missing", + "pm-page-does-not-exist", + "pm-pagename-missing", + "pm-pagetitle-invalid", + "pm-pagetitle-missing", + "pm-swap-icon-hover-text", + "pm-on-import-message-text", + "pm-on-save-message-text", + "pm-savepages-button-label", + "pm-cancel-button-label" + ], + "targets": [ + "desktop", + "mobile" + ] + }, + "ext.translate.special.pagepreparation": { + "scripts": "resources/js/ext.translate.special.pagepreparation.js", + "styles": "resources/css/ext.translate.special.pagepreparation.css", + "dependencies": [ + "mediawiki.RegExp", + "mediawiki.Title", + "mediawiki.diff.styles", + "mediawiki.api", + "mediawiki.jqueryMsg", + "mediawiki.ui" + ], + "messages": [ + "pp-already-prepared-message", + "pp-pagename-missing", + "pp-prepare-message", + "pp-save-button-label", + "pp-save-message" + ], + "targets": [ + "desktop", + "mobile" + ] + }, + "ext.translate.special.pagetranslation": { + "scripts": "resources/js/ext.translate.special.pagetranslation.js", + "dependencies": [ + "ext.translate.multiselectautocomplete", + "mediawiki.ui.button", + "mediawiki.Uri", + "user.tokens" + ], + "position": "top", + "targets": [ + "desktop" + ] + }, + "ext.translate.special.pagetranslation.styles": { + "styles": "resources/css/ext.translate.special.pagetranslation.css", + "position": "top", + "targets": [ + "desktop", + "mobile" + ] + }, + "ext.translate.special.searchtranslations": { + "scripts": "resources/js/ext.translate.special.searchtranslations.js", + "dependencies": [ + "ext.translate.editor", + "ext.translate.groupselector", + "ext.uls.mediawiki", + "mediawiki.Uri", + "mediawiki.language" + ], + "messages": [ + "translate-documentation-language", + "translate-search-more-groups-info", + "translate-search-more-languages-info" + ], + "position": "top", + "targets": [ + "desktop", + "mobile" + ] + }, + "ext.translate.special.searchtranslations.operatorsuggest": { + "scripts": "resources/js/ext.translate.special.operatorsuggest.js", + "dependencies": "jquery.ui.autocomplete", + "targets": [ + "desktop" + ] + }, + "ext.translate.special.searchtranslations.styles": { + "styles": "resources/css/ext.translate.special.searchtranslations.css", + "position": "top", + "targets": [ + "desktop", + "mobile" + ] + }, + "ext.translate.special.supportedlanguages": { + "styles": "resources/css/ext.translate.special.supportedlanguages.css", + "position": "top", + "targets": [ + "desktop", + "mobile" + ] + }, + "ext.translate.special.translate": { + "scripts": "resources/js/ext.translate.special.translate.js", + "dependencies": [ + "ext.translate.base", + "ext.translate.groupselector", + "ext.translate.messagetable", + "ext.translate.navitoggle", + "ext.translate.recentgroups", + "ext.translate.workflowselector", + "jquery.uls.data", + "mediawiki.Uri", + "mediawiki.api", + "mediawiki.api.parse", + "mediawiki.jqueryMsg" + ], + "messages": [ + "tpt-discouraged-language-content", + "tpt-discouraged-language-force-content", + "tpt-discouraged-language-force-header", + "tpt-discouraged-language-header", + "translate-documentation-language", + "tux-editor-proofreading-hide-own-translations", + "tux-editor-proofreading-show-own-translations" + ], + "targets": [ + "desktop", + "mobile" + ] + }, + "ext.translate.special.translate.legacy": { + "scripts": "resources/js/ext.translate.special.translate.legacy.js", + "dependencies": "mediawiki.api", + "messages": [ + "translate-messagereview-done", + "translate-messagereview-failure", + "translate-messagereview-progress" + ], + "targets": [ + "desktop", + "mobile" + ] + }, + "ext.translate.special.translate.styles": { + "styles": "resources/css/ext.translate.special.translate.css", + "position": "top", + "targets": [ + "desktop", + "mobile" + ] + }, + "ext.translate.special.translationstash": { + "scripts": "resources/js/ext.translate.special.translationstash.js", + "styles": "resources/css/ext.translate.special.translationstash.css", + "dependencies": [ + "ext.translate.editor", + "ext.translate.messagetable", + "ext.translate.translationstashstorage", + "ext.uls.mediawiki", + "mediawiki.api", + "mediawiki.language" + ], + "messages": [ + "translate-translationstash-skip-button-label", + "translate-translationstash-translations", + "tsb-limit-reached-body", + "tsb-limit-reached-title" + ], + "position": "top", + "targets": [ + "desktop", + "mobile" + ] + }, + "ext.translate.special.translationstats": { + "scripts": "resources/js/ext.translate.special.translationstats.js", + "targets": [ + "desktop", + "mobile" + ] + }, + "ext.translate.statsbar": { + "scripts": "resources/js/ext.translate.statsbar.js", + "styles": "resources/css/ext.translate.statsbar.css", + "messages": [ + "translate-statsbar-tooltip", + "translate-statsbar-tooltip-with-fuzzy" + ], + "position": "top", + "targets": [ + "desktop", + "mobile" + ] + }, + "ext.translate.storage": { + "scripts": "resources/js/ext.translate.storage.js", + "targets": [ + "desktop", + "mobile" + ] + }, + "ext.translate.tabgroup": { + "styles": "resources/css/ext.translate.tabgroup.css", + "position": "top", + "targets": [ + "desktop", + "mobile" + ] + }, + "ext.translate.tag.languages": { + "styles": "resources/css/ext.translate.tag.languages.css", + "position": "top", + "targets": [ + "desktop", + "mobile" + ] + }, + "ext.translate.translationstashstorage": { + "scripts": "resources/js/ext.translate.translationstashstorage.js", + "dependencies": "mediawiki.api", + "targets": [ + "desktop", + "mobile" + ] + }, + "ext.translate.workflowselector": { + "scripts": "resources/js/ext.translate.workflowselector.js", + "styles": "resources/css/ext.translate.workflowselector.css", + "dependencies": [ + "ext.translate.dropdownmenu", + "mediawiki.api" + ], + "messages": [ + "translate-workflow-set-doing", + "translate-workflow-state-", + "translate-workflowstatus" + ], + "targets": [ + "desktop", + "mobile" + ] + }, + "jquery.ajaxdispatcher": { + "scripts": "resources/js/jquery.ajaxdispatcher.js", + "targets": [ + "desktop", + "mobile" + ] + }, + "jquery.autosize": { + "scripts": "resources/js/jquery.autosize.js", + "targets": [ + "desktop", + "mobile" + ] + }, + "jquery.textchange": { + "scripts": "resources/js/jquery.textchange.js", + "targets": [ + "desktop", + "mobile" + ] + } + }, + "config": { + "TranslateDocumentationLanguageCode": { + "value": false, + "description": "Language code for message documentation. Suggested values are qqq or info. If set to false (default), message documentation feature is disabled.", + "public": true + }, + "TranslateFuzzyBotName": { + "value": "FuzzyBot", + "description": "Name of the bot which will invalidate translations and do maintenance for page translation feature. Also used for importing messages from external sources.", + "public": true + }, + "TranslateNewsletterPreference": { + "value": false, + "description": "Add a preference 'Do not send me email newsletters' in the email preferences.", + "public": true + }, + "TranslateLanguageFallbacks": { + "value": [], + "description": "Default values for list of languages to show translators as an aid when translating. Each user can override this setting in their preferences.\n\nExample: LanguageFallbacks['fi'] = 'sv' or LanguageFallbacks['sv'] = [ 'da', 'no', 'nn' ].", + "public": true + }, + "TranslateTranslationDefaultService": { + "value": "TTMServer", + "description": "Define various web services that provide translation suggestions.\n\nTranslation memories are documented in our main documentation. See https://www.mediawiki.org/wiki/Help:Extension:Translate/Translation_memories\n\nFor Apertium, you should get an API key. See http://wiki.apertium.org/wiki/Apertium_web_service\n\nYandex translation helper also provides langlimit option to limit total number of suggestions (set to 0 to get all possible translations) and langorder array to sort languages. Yandex translate engine is based on wordnet, generated from search index, so number of indexed websites should be a good heuristic to define the default language order.\n\nThe machine translation services are provided with the following information: server ip address; versions of MediaWiki and Translate extension; clients ip address encrypted with $wgProxyKey; source text to translate; private API key if provided", + "public": true + }, + "TranslateTranslationServices": { + "TTMServer": { + "type" : { + "value": "ttmserver", + "description": "…", + "public": true + }, + "database" : { + "value": false, + "description": "Passed to wfGetDB", + "public": true + }, + "cutoff" : { + "value": 0.75, + "description": "…", + "public": true + }, + "public" : { + "value": "false", + "description": "…", + "public": true + } + }, + "Microsoft": { + "type" : { + "value": "microsoft", + "description": "…", + "public": true + }, + "url" : { + "value": "http://api.microsofttranslator.com/V2/Http.svc/Translate", + "description": "…", + "public": true + }, + "key" : { + "value": null, + "description": "…", + "public": false + } + }, + "Apertium": { + "type" : { + "value": "apertium", + "description": "…", + "public": true + }, + "url" : { + "value": "http://api.apertium.org/json/translate", + "description": "…", + "public": true + }, + "pairs": { + "value": "http://api.apertium.org/json/listPairs", + "description": "…", + "public": true + }, + "timeout" : { + "value": 3, + "description": "…", + "public": true + }, + "key" : { + "value": null, + "description": "…", + "public": false + } + }, + "Yandex": { + "type" : { + "value": "yandex", + "description": "…", + "public": true + }, + "url" : { + "value": "https://translate.yandex.net/api/v1.5/tr.json/translate", + "description": "…", + "public": true + }, + "pairs" : { + "value": "https://translate.yandex.net/api/v1.5/tr.json/getLangs", + "description": "…", + "public": true + }, + "timeout" : { + "value": 3, + "description": "…", + "public": true + }, + "langorder" : { + "value": [ + "en", + "ru", + "uk", + "de", + "fr", + "pl", + "it", + "es", + "tr" + ], + "description": "…", + "public": true + }, + "langlimit" : { + "value": 1, + "description": "…", + "public": true + }, + "key" : { + "value": null, + "description": "…", + "public": false + } + } + }, + "TranslateTasks": { + "description": "List of tasks in Special:Translate. If you are only using page translation feature, you might want to disable 'optional' task. Example: unset($wgTranslateTasks['optional']);", + "view": { + "value": "ViewMessagesTask", + "description": "…", + "public": true + }, + "untranslated": { + "value": "ViewUntranslatedTask", + "description": "…", + "public": true + }, + "optional": { + "value": "ViewOptionalTask", + "description": "…", + "public": true + }, + "acceptqueue": { + "value": "AcceptQueueMessagesTask", + "description": "…", + "public": true + }, + "reviewall": { + "value": "ReviewAllMessagesTask", + "description": "…", + "public": true + }, + "custom": { + "value": "CustomFilteredMessagesTask", + "description": "…", + "public": true + } + }, + "TranslateSupportUrl": { + "value": false, + "description": "Experimental support since 2011-03-11 for an 'Ask' help button. Might change into a hook later on. This is an array with keys page, url and params: page is a title of a local wiki page; url is an URL to use as is (e.g. an issue tracker submission form) which will override the page if set; params is an array of key-value pairs of request params -- each param value can contain the variable %MESSAGE% which will be replaced with the full page name.", + "public": true + }, + "TranslateSupportUrlNamespace": { + "value": [], + "description": "Like $wgTranslateSupportUrl, but for a specific namespace. Each $wgTranslateSupportUrl-like array needs to be the value assigned to the numerical ID of a namespace of the wiki. Since 2015-09.", + "public": true + }, + "TranslatePermissionUrl": { + "value": "Project:Translator", + "description": "When unprivileged users open a translation editor, they will see a message stating that a special permission is needed for translating messages. If this variable is defined, there is a button which will take the user to that page to ask for permission. The target needs to be reiterated with the second variable to have the same result with sandbox enabled where users can't enter the sandbox.", + "public": true + }, + "TranslateSecondaryPermissionUrl": { + "value": "Project:Translator", + "description": "…", + "public": true + }, + "EnablePageTranslation": { + "value": true, + "description": "Enable page translation feature.\n\nPage translation feature allows structured translation of wiki pages with simple markup and automatic tracking of changes. See https://www.mediawiki.org/wiki/Help:Extension:Translate/Page_translation_administration", + "public": true + }, + "PageTranslationNamespace": { + "value": 1198, + "description": "Number for the Translations namespace. Change this if it conflicts with other namespace in your wiki.", + "public": true + }, + "TranslatePageTranslationULS": { + "value": false, + "description": "If set to true, when a user selects an interface language via ULS (Universal Language Selector), if the current page is a translatable page or a translation page then the user is also redirected to the corresponding translation page in the selected language.\n\n The language of the translation pages visited afterwards will still depend on the links followed (it will be the interface language only if the links use the Special:MyLanguage syntax).\n\nSince 2013-03-10.", + "public": true + }, + "TranslateKeepOutdatedTranslations": { + "value": true, + "description": "If set to true, when a translated page has some units marked as outdated, the outdated translation will be shown. If set to false, the original updated unit in the original language will be shown.\n\nChanging this setting requires the following script to be run to take effect on existing changes: scripts/refresh-translatable-pages.php\n\n Since 2016.12.", + "public": true + }, + "TranslateBlacklist": { + "value": [], + "description": "Two-dimensional array of languages that cannot be translated. Input can be exact group name, first part before '-' or '*' for all. Second dimension should be language code mapped to reason for disabling. Reason is parsed as wikitext.\n\nExample:\n'TranslateBlacklist': { '*': { 'en': 'English is the source language.' }, 'core': { 'mul': 'Not a real language.' }, 'ext': { 'mul': 'Not a real language.'} }", + "public": true + }, + "TranslateCheckBlacklist": { + "value": false, + "description": "File containing checks that are to be skipped. See https://gerrit.wikimedia.org/r/gitweb?p=translatewiki.git;a=blob;f=check-blacklist.php;hb=HEAD for example.\nSince 2012-10-15.", + "public": true + }, + "TranslateAuthorBlacklist": { + "value": [ + [ + "black", + "/^.*;.*;.*Bot$/Ui" + ] + ], + "description": "Two-dimensional array of rules that blacklists certain authors from appearing in the exports. This is useful for keeping bots and people doing maintenance work in translations not to appear besides real translators everywhere.\n\nRules are arrays, where first element is type: white or black. Whitelisting always overrules blacklisting. Second element should be a valid pattern that can be given a preg_match(). It will be matched against string of format 'group-id;language;author name', without quotes.\n\nAs an example, by default we have rule that ignores all authors whose name ends in a bot for all languages and all groups.", + "public": true + }, + "TranslateMessageNamespaces": { + "value": [], + "description": "List of namespace that contain messages. No talk namespaces. See https://www.mediawiki.org/wiki/Help:Extension:Translate/Group_configuration", + "public": true + }, + "TranslateCC": { + "value": [], + "description": "Custom classes can register themselves here. Key is always the group id, while the value is an message group object or callable function. This is deprecated – Use TranslatePostInitGroups hook instead.", + "public": true + }, + "TranslateGroupRoot": { + "value": "/var/www/externals", + "description": "Location in the filesystem to which paths are relative in custom groups.", + "public": false + }, + "TranslateGroupFiles": { + "value": [], + "description": "The newest and recommended way of adding custom groups is YAML files. See examples under Translate/groups.\n\n Usage example: $IP/extensions/Translate/groups/Shapado/Shapado.yml", + "public": false + }, + "TranslateWorkflowStates": { + "value": false, + "description": "List of possible message group review workflow states and properties for each state. The currently supported properties are 'color', the color that is used for displaying the state in the tables, and 'right', the additional right that is needed to set the state. Users who have the translate-groupreview right can set this in Special:Translate. The state is visible in Special:Translate, Special:MessageGroupStats and Special:LanguageStats. If the value is false, the workflow states feature is disabled. State name can be up to 32 characters maximum.\n\nExample:\n'TranslateWorkflowStates': {\n\n'new': { 'color': 'FF0000' },\n'needs_proofreading': { 'color': '0000FF' },\n'ready': { 'color': 'FFFF00'},\n'published': { 'color': '00FF00', 'right': 'centralnotice-admin' }\n}", + "public": true + }, + "TranslateGroupAliases": { + "value": {}, + "description": "Map from deprecated group IDs to their current ID. Example value: { 'core': 'mediawiki-core' }", + "public": true + }, + "TranslateCacheDirectory": { + "value": "false", + "description": "Set location of cache files. Defaults to $wgCacheDirectory.", + "public": true + }, + "TranslateMessageIndex": { + "value": [ "DatabaseMessageIndex" ], + "description": "Configures how the message index is stored. Possible values are 'DatabaseMessageIndex', 'SerializedMessageIndex', and 'CDBMessageIndex'. The last two backends need $wgCacheDirectory to be functional.", + "public": true + }, + "TranslateDelayedMessageIndexRebuild": { + "value": false, + "description": "If you have lots of message groups, especially file based ones, and the message index rebuilding gets slow, set this to true to delay the rebuilding via JobQueue. This only makes sense if you have configured jobs to be processed outside of requests via cron or similar.", + "public": true + }, + "TranslatePHPlot": { + "value": false, + "description": "For Special:TranslationStats PHPlot is needed to produce graphs. Set this the location of phplot.php.", + "public": false + }, + "TranslatePHPlotFont": { + "value": "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf", + "description": "The default font for PHPlot for drawing text. Only used if the automatic best font selection fails. The automatic best font selector uses language code to call fc-match program. If you have open_basedir restriction or safe-mode, using the found font is likely to fail. In this case you need to change the code to use hard-coded font, or copy fonts to location PHP can access them, and make sure fc-match returns only those fonts.", + "public": false + }, + "TranslateUseSandbox": { + "value": false, + "description": "Whether to allow users to sign up via a sandbox. Sandboxed users cannot do much until approved and thus they can be get rid of easily. This only works with MediaWiki 1.27 and newer, and only if registration is configured to not use account creation providers which give REDIRECT or UI responses or require any other field than the default username/password/email.", + "public": true + }, + "TranslateSandboxPromotedGroup": { + "value": false, + "description": "To which group the translators are promoted. If left at false, they will just be removed from sandbox and become normal users.", + "public": true + }, + "TranslateSandboxSuggestions": { + "value": [], + "description": "List of page names to always suggest for sandboxed users.", + "public": true + }, + "TranslateSandboxLimit": { + "value": 20, + "description": "Maximum number of translations a user can make in the sandbox.", + "public": true + }, + "TranslateUsePreSaveTransform": { + "value": false, + "description": "Pre-save transform for message pages. MediaWiki does this by default (including for pages in the MediaWiki-namespace). By setting this to false it allows users to put untransformed syntax such as '~~~~' into a page without having them be transformed upon save.", + "public": true + }, + "TranslateRcFilterDefault": { + "value": "filter", + "description": "Default action for the RecentChanges filter, which makes it possible to filter translations away or show them only. Possible values: 'noaction', 'only', 'filter', 'site'.", + "public": true + }, + "TranslateTestTTMServer": { + "value": null, + "description": "Set this to config like $wgTranslateTranslationServices if you want to run SolrTTMServer tests.", + "public": true + }, + "TranslateTestUsers": { + "value": [], + "description": "List of user names that are allowed to alter their privileges and do other things. Used for supporting integration testing.", + "public": true + }, + "TranslateYamlLibrary": { + "value": "phpyaml", + "description": "Currently supported YAML drivers are phpyaml, spyc and syck.\n\nFor phpyaml see https://secure.php.net/manual/en/book.yaml.php.\nFor syck we're shelling out to perl. So you need at least perl 5.8 (find out what you have by running `perl -v`), and to install these modules from CPAN: YAML::Syck, PHP::Serialization, and File::Slurp.\n\nYou should be able to do this with: `for module in 'YAML::Syck' 'PHP::Serialization' 'File::Slurp'; do cpanp -i $module; done`\n\nFor the shell to work, you also need an en.UTF-8 locale installed on your system. add a line `en.UTF-8` to your /etc/locale.gen or uncomment an existing one and run locale-gen if you do not have it already.\n\nphpyaml is the fastest and based on libyaml so the output should be most compatible. spyc output format is least compatible. syck is slowest but almost as good as phpyaml. spyc needs to be installed using composer. See https://www.mediawiki.org/wiki/Composer", + "public": true + } + } +} -- To view, visit https://gerrit.wikimedia.org/r/391645 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I410a4d499c44a18fb686626775f17187547e74f1 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Translate Gerrit-Branch: master Gerrit-Owner: Jforrester <jforres...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits