Jump to navigation Jump to search
This page is a translated version of the page Help:Extension:Translate/Configuration and the translation is 100% complete.

Other languages:
Deutsch • ‎English • ‎Nederlands • ‎català • ‎dansk • ‎español • ‎français • ‎italiano • ‎polski • ‎português • ‎português do Brasil • ‎suomi • ‎čeština • ‎русский • ‎українська • ‎العربية • ‎বাংলা • ‎தமிழ் • ‎中文 • ‎日本語

Le MediaWiki Language Extension Bundle vous fournit tout le code et les étapes d'installation réellement nécessaires pour configurer Translate; cette page détaille quelles options de configuration sont disponibles dans le cas où vous auriez besoin de plus et que la page introduction à l'installation et prérequis ne vous a pas aidé.

Exemple de configuration

Cette configuration se trouve en modifiant le fichier LocalSettings.php, dans le dossier racine de MediaWiki.

include_once "$IP/extensions/Translate/Translate.php";
$wgGroupPermissions['translator']['translate'] = true;
$wgGroupPermissions['translator']['skipcaptcha'] = true; // Bug 34182: needed with ConfirmEdit
$wgTranslateDocumentationLanguageCode = 'qqq';

# Ajoutez ceci si vous voulez autoriser l'accès à la traduction des pages
$wgGroupPermissions['sysop']['pagetranslation'] = true;

# Clés d'API privées pour les services de traduction machine
#$wgTranslateTranslationServices['Apertium']['key'] = '';

Droits utilisateur

L'extension Translate introduit des nouveaux droits utilisateur :

Droit de l'utilisateur Définition Description
translate Modifier avec l’interface de traduction Permet aux utilisateurs d'éditer les traductions.
translate-manage Gérer les groupes de message Permet aux utilisateurs d'actualiser et de gérer les groupes de messages avec une interface web.
translate-import Importer les traductions hors ligne Permet aux utilisateurs d'importer des mises à jour de traductions depuis des outils hors ligne utilisant eux-même l'interface web (encore instable). Ce groupe est optionnel. Ce n'est pas nécessaire à moins que les traductions doivent être importées d'une source externe.
pagetranslation Marquer des versions de pages pour être traduites Permet aux utilisateurs de gérer la traduction de pages de contenu.
translate-messagereview Marquer comme relues les traductions Permet aux utilisateurs de marquer les traductions comme relues.
translate-proofr - Ce groupe a le droit translate-messagereview et le droit d'ajouter d'autres utilisateurs au groupe translate-proofr.
translate-groupreview Modifier l'état de flux de travail des groupes de message Permet aux utilisateurs de changer l'état du workflow d'un groupe. Ce groupe est optionnel et n'est pas nécessaire quand la variable $wgTranslateWorkflowStates est désactivée par défaut. Si elle est active, les états de workflow se définissent dans la variable $wgTranslateWorkflowStates.

Paramètres de configuration

Pour votre confort, la documentation suivante est tirée de Translate.php. Les options de configuration changent avec le temps, donc en cas de doute, la documentation de votre Translate.php est la meilleure. L'enregistrement suivant date du 2016-04-21.

Configuration de base

 * 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 = array();

 * 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!!' );

 * Define various web services that provide translation suggestions.
 * Translation memories are documented in our main documentation.
 * @see
 * For Apertium, you should get an API key.
 * @see
 * 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
$wgTranslateTranslationServices = array();
$wgTranslateTranslationServices['TTMServer'] = array(
	'database' => false, // Passed to wfGetDB
	'cutoff' => 0.75,
	'type' => 'ttmserver',
	'public' => false,
$wgTranslateTranslationServices['Microsoft'] = array(
	'url' => '',
	'key' => null,
	'timeout' => 3,
	'type' => 'microsoft',
$wgTranslateTranslationServices['Apertium'] = array(
	'url' => '',
	'pairs' => '',
	'key' => null,
	'timeout' => 3,
	'type' => 'apertium',
$wgTranslateTranslationServices['Yandex'] = array(
	'url' => '',
	'key' => null,
	'pairs' => '',
	'timeout' => 3,
	'langorder' => array( '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 = array(
	'view' => 'ViewMessagesTask',
	'untranslated' => 'ViewUntranslatedTask',
	'optional' => 'ViewOptionalTask',
	'acceptqueue' => 'AcceptQueueMessagesTask',
	'reviewall' => 'ReviewAllMessagesTask',
	'export-as-po' => 'ExportasPoMessagesTask',
	'export-to-file' => 'ExportToFileMessagesTask',
	'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 = array();

 * 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';

Fonctionnalités de la traduction de page

 * 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
$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;

Configuration des groupes de message

 * 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 = array();

 * File containing checks that are to be skipped. See
 * 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 = array();
$wgTranslateAuthorBlacklist[] = array( 'black', '/^.*;.*;.*Bot$/Ui' );

 * List of namespace that contain messages. No talk namespaces.
 * @see
$wgTranslateMessageNamespaces = array();

 * 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 = array();

 * 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 = array();

 * 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 = array();

Configuration relative à l'installation du système

 * 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 = array( '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;


 * 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';

Pilote YAML

 * Currently supported YAML drivers are phpyaml, spyc and syck.
 * For phpyaml see
 * 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.
$wgTranslateYamlLibrary = 'spyc';

Bac à sable

 * 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.
 * @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 = array();

 * Maximum number of translations a user can make in the sandbox.
 * @since 2013.10
$wgTranslateSandboxLimit = 20;

Non trié

 * 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 = array();


Traduction de pages

S'il y a un problème avec l'espace de noms lors de la traductions de pages traductibles (symptômes : la définition ne s'affiche pas, le titre de la page commence avec un caractère deux points), ajoutez ces deux élements à votre fichier LocalSettings.php :

$wgExtraNamespaces[$wgPageTranslationNamespace]   = 'Translations';
$wgExtraNamespaces[$wgPageTranslationNamespace+1] = 'Translations_talk';

Ce problème apparait si quelque chose débloque la classe Language très tôt, et parce que nous ajoutons l'espace de noms tard afin qu'il soit activé conditionellement.

La page à traduire est vide ou affiche l'erreur 'Unbalanced <translate> tag'

A condition d'avoir la balise fermante </translate> , la page source est trop grande. Cela apparaît avec certaines traductions lorsque la taille de la page source atteint environ 50 Ko . Raccourcissez la page, ou augmentez pcre.backtrack_limit en mettant

ini_set( 'pcre.backtrack_limit', 400000 );

dans LocalSettings.php ou


dans votre configuration PHP (php.ini).

Polices avec PHPlot

si les caractères dans certaines langues sont remplacés par des boîtes, vérifiez d'abord que vous avez une police adequate d'installée. Si c'est le cas, activez ensuite le journal pour le débogage des polices. Il est possible que vous ayez à vider le cache MediaWiki d'abord. Sur certains systèmes PHP il n'est pas possible d'acccéder aux polices données par la commande fc-list .

$wgDebugLogGroups['fcfont'] = '/path/to/writable/logfile';

En mode TUX (le nouvel interface utilisateur) aucun message n'est affiché

Si vous avez écrasé $wgTranslateTasks, assurez-vous que la tâche custom ne soit pas exclue de lui.

L'outil ne charge pas Special:Translate

Si vous voyez quelque chose comme ceci avec le message "Loading messages..." répété en boucle, cela signifie que le ResourceLoader est cassé : initialisez $wgResourceLoaderMaxQueryLength = 1024; ou plus petit jusqu'à ce que cela fonctionne.

Si cela ne suffit pas, n'avez-vous pas oublié d'installer et d'activer le UniversalLanguageSelector  ?

Echec de l'enregistrement d'une traduction avec Unknown error: "tpt-unknown-page"

Cela se produit lorsqu'une page a été marquée pour traduction et que la tâche correspondante n'a pas encore été exécutée. Dans ce cas vous pouvez exécuter la file des travaux en attente manuellement, ou même mieux, activer l'exécution continue des tâches comme indiqué dans Manuel:File d’attente des travaux . Si cela ne résoud pas le problème, essayez d'exécuter php extensions/Translate/scripts/createMessageIndex.php.