Jump to content

Extension:ContentTranslation

From mediawiki.org
MediaWiki extensions manual
ContentTranslation
Release status: stable
Implementation User interface, Page action
Description Tool that allows editors to translate an article from one language to another with the help of machine translation and other translation aids.
Author(s) Language team
Compatibility policy Snapshots releases along with MediaWiki. Master is not backward compatible.
MediaWiki 1.37+
PHP 7.2+
Database changes Yes
Composer mediawiki/content-translation
Tables cx_translations
cx_translators
cx_lists
cx_suggestions
cx_corpora
cx_notification_log
cx_significant_edits
cx_section_translations
License GNU General Public License 2.0 or later
Download
Help Help:Extension:ContentTranslation/en
  • $wgContentTranslationEnableSuggestions
  • $wgContentTranslationTargetNamespace
  • $wgContentTranslationContentImportForSectionTranslation
  • $wgContentTranslationDomainCodeMapping
  • $wgContentTranslationCXServerAuth
  • $wgContentTranslationEnableAnonSectionTranslation
  • $wgContentTranslationExcludedNamespaces
  • $wgContentTranslationCluster
  • $wgAutomaticTranslationLanguageSearcherEntrypointEnabledLanguages
  • $wgContentTranslationAsBetaFeature
  • $wgContentTranslationTranslateInTarget
  • $wgContentTranslationDevMode
  • $wgRecommendToolAPIURL
  • $wgDraftMaxAge
  • $wgContentTranslationEnableUnifiedDashboard
  • $wgContentTranslationEnableMT
  • $wgSectionTranslationTargetLanguages
  • $wgContentTranslationEnableSectionTranslation
  • $wgContentTranslationSiteTemplates
  • $wgContentTranslationUnmodifiedMTThresholdForPublish
  • $wgContentTranslationVersion
  • $wgContentTranslationPublishRequirements
  • $wgContentTranslationCampaigns
  • $wgContentTranslationDatabase
Quarterly downloads 26 (Ranked 108th)
Translate the ContentTranslation extension if it is available at translatewiki.net
Issues Open tasks · Report a bug

The ContentTranslation extension is a tool that allows editors to translate an article from one language to another with the help of machine translation and other translation aids. See Content translation for background and additional information. The extension is being developed by the Wikimedia Language Engineering team.

Installation

This extension requires a Content Translation server to be setup first. Morover it has three extension dependencies.
  • Download and move the extracted ContentTranslation folder to your extensions/ directory.
    Developers and code contributors should install the extension from Git instead, using:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/ContentTranslation
  • Only when installing from Git, run Composer to install PHP dependencies, by issuing composer install --no-dev in the extension directory. (See task T173141 for potential complications.)
  • Add the following code at the bottom of your LocalSettings.php file:
    wfLoadExtension( 'ContentTranslation' );
    
  • Run the update script which will automatically create the necessary database tables that this extension needs.
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.


Vagrant installation:

  • If using Vagrant , install with vagrant roles enable contenttranslation --provision

Content Translation server

The extension needs the Content Translation server (a.k.a. cxserver) up and running. See Content translation/cxserver/Setup for setting up the Content Translation server. When running Content Translation locally, following can be added to LocalSettings.php to use production cxserver:

$wgContentTranslationSiteTemplates['cx'] = 'https://cxserver.wikimedia.org/v1';

Translations database

This extension has an optional dashboard feature, which allows translators to see all the translations across all languages. In a multilingual installation of this extension, for example in Wikimedia wikis, a central database is required to serve the dashboard feature. Table definitions for that database are in sql directory in the extension source code; Content translation/Product Definition/Database has more details. Once database is created, set the $wgContentTranslationDatabase global configuration variable as the name of database:

$wgContentTranslationDatabase = 'db_name';

Extension dependencies

ContentTranslation depends on the following extensions:

UniversalLanguageSelector Required
VisualEditor Required Required for editor component.
Cite Required Required if you want to support references while translating.
GuidedTour Optional If installed, it will be used to show an explanation about moving a page out of user space.
Echo Optional If installed, it will be used for showing "congratulations" notifications after completing translation milestones.
Wikibase Optional If installed and configured similarly to Wikipedia, it will be used for automatic addition of interlanguage links (as sitelinks).
EventLogging Optional If installed, can be used to log publishing, errors, and other events.
BetaFeatures Optional If installed, ContentTranslation will appear as a beta feature in the preferences.

Configuration variables

For the full list and defaults, see extension.json in the source repository.

ContentTranslationDomainCodeMapping
Used to map between non-standard language codes and actual domains. The default is the same as in Wikipedia codes and domains.
ContentTranslationRESTBase
Configuration of RESTBase URL and connection parameters. The defaults are for Wikipedia.
ContentTranslationDatabase
The name of the database in which the common tables for managing translations across wikis are stored. The default is null, which means that the default database is used.
ContentTranslationCluster
In a Wikipedia-like database configuration, the name of the cluster on which the database is hosted. The default is null, which means that the default cluster is used.
ContentTranslationEventLogging
Whether EventLogging is enabled. The default is false.
ContentTranslationHighMTCategory
A category to which pages that have a high level of machine translation are added upon publishing. The default is null.
ContentTranslationSiteTemplates
Templates for essential URLs. The defaults assume Wikipedia, so this variable must be configured differently for other sites. Where relevant, $1 is replaced by the language code, and $2 is replaced by the page title.
ContentTranslationTranslateInTarget
Whether to open Special:ContentTranslation in the target wiki when clicking the button in the entry point. The domain will be based on $wgContentTranslationSiteTemplates. The default is to open Special:ContentTranslation on the same wiki. (For Wikipedia this is set to true.)
ContentTranslationAsBetaFeature
Whether ContentTranslation is a beta feature.
ContentTranslationTargetNamespace
The default target namespace for published articles. The default is Main.
ContentTranslationCampaigns
Campaigns that are available in the URL as valid values for the campaign parameter in the URL. This allows automatic enabling of the beta feature and event logging.
ContentTranslationCXServerAuth
CXServer connection configuration.
ContentTranslationEnableSuggestions
Whether to use the suggestions tab and automatic suggestions. This needs the GapFinder API. This is false by default, but true in Wikipedia.
RecommendToolAPIURL
The URL for the GapFinder API, needed if ContentTranslationEnableSuggestions is true.

Url parameters

Content Translation mainly works on the special page Special:ContentTranslation. The URL parameters are

  • page: source title
  • targettitle: target title
  • from: source language
  • to: target language
  • campaign: campaign name
    • In Wikimedia wikis, if content translation is not enabled in the user settings then only links to pre-defined campaign will work. Campaigns are defined in InitialiseSettings.php wmgContentTranslationCampaigns variable.

Example

See also