Help:Extension:Translate/Group configuration/MediaWiki

Jump to: navigation, search

This is documentation how to set up MediaWiki extension groups using the simple text configuration file. It is useful if you have hundreds of extensions.

This configuration goes to the LocalSettings.php in the mediawiki directory.

require "$IP/extensions/Translate/Translate.php";

$wgHooks['TranslatePostInitGroups'][] = function ( &$list, &$deps, &$autoload ) {
	$def = "/path/to/mediawiki-extensions.txt";
	$path = '%GROUPROOT%/extensions/';

	$parser = new PremadeMediawikiExtensionGroups( $def, $path );
	$parser->register( $list, $deps, $autoload );

	return true;

Configuration file[edit]

Here is an example configuration file:

Simple Extension

Complex Extension
desc = Some text here.
ignored = sidebar, robots.txt
optional = grouppage-recursive-export
prefix = wmf- | sidebar, grouppage-Staff, group-Staff, group-Staff-member
aliasfile = ComplexExtension.alias.php
magicfile = ComplexExtension.magic.php

The general syntax is: Name of the extension followed by list of keys and values and one empty line before next extension.

ExtensionName: Name of the extension with spaces removed.

The available keys are:

Location of file containing special page alias translations for this extension relative to $wgTranslateExtensionDirectory
Description of the extension shown to translators
A page in MediaWiki namespace containing the description of the extension shown to translators
Location of the file containing messages for this extension. Default value depends on the format:
  • php: ExtensionName/ExtensionName.i18n.php
  • json: ExtensionName/i18n/%CODE%.json
File format used by the extension. Supported values are php and json. Default: format = php
Message group id. Default value is ExtensionName in lowercase prefixed with ext-. For example, "Complex Extension" has default id of "ext-complexextension"
List of comma separated message keys which will not be shown for the translators. This key can be present in multiple times to split the list into multiple lines.
Location of file containing magic word translations for this extension relative to $wgTranslateExtensionDirectory
List of comma separated message keys which will be shown to translators only if they select to see optional messages. Optional messages are not counted as untranslated messages, but translated optional messages are counted as translated. This key can be present multiple times.
To handle conflicting message keys, you can prefix given messages. The syntax is first to have the prefix separated by pipe from comma separated list of message keys. This key can be present multiple times.
Name of the php variable holding the messages. Defaults to $messages.