Open main menu

Help:Extension:Translate/Command line scripts

This documentation is partly outdated and is missing many scripts.

Translate extension has many command line scripts which facilitate heavy processing that is not possible through the web interface. Each script has a --help switch that shows the exact syntax and supported parameters. This page is an overview of the purpose of each script. These scripts can be found at Translate/scripts. If the Translate extension is installed into nonstandard location, you must define MW_INSTALL_PATH environment variable that points to root of the MediaWiki installation.

export.php
export.php is the most important script for most setups. It allows exporting translated messages into filesystem. The output path structure and file formats vary between different message groups. It has --threshold parameter, which takes a completion percentage that must be met for a language to be exported. Languages which have less than the given percentage of messages translated in a group are ignored. This switch increases the export time considerably.
poimport.php
This is a command line variant of Special:ImportTranslations, which can be used to import large changes in one go.
fuzzy.php
This script is used to mark translated outdated = fuzzying. It takes a message name and fuzzies all translations. It's the only way for old-style message groups and can also be used with new-style message groups.
groupStatistics.php
This command line script can be used to create almost any kind of completion statistics table. Special:LanguageStats shows the percentages for all groups in one language, but with this script you can make table with completion percentages in all languages for one ore more message groups. You need an another script to import the script output into MediaWiki.
sync-group.php
For old-style message groups which do not have web interface, this is the script which looks for changes and imports them into the wiki. It can also be used with new-style message groups, but not recommended.
tm-export.php
Run this script to create and populate the translation memory. Hooks in the extension will take care of adding new translation into the translation memory database.
createMessageIndex.php
This script creates a mapping from each message key to the groups it belongs to. This information is used in many places, for example in the statistics features. Usually this task is triggered automatically. Running it manually may fix inconsistent things.