Release status: beta
|Implementation||Ajax, API, User interface|
|Description||Lightweight extension to live-translate articles using the Google Translate service|
|Author(s)||Jeroen De Dauwtalk|
|Latest version||1.3 (2013-07-02)|
|MediaWiki||1.16.0 or higher|
|License||GNU General Public License 3.0 or later|
|Download||Stable releases - All releases|
Translate the Live Translate extension if it is available at translatewiki.net
|Check usage and version matrix; code metrics|
Live Translate allows users to do live translation of wiki pages using either Google Translate or Microsoft Translator. It also enables you to define a "dictionary" of certain words or phrases and their translations; any word or phrase in the original text found in the "dictionary" will be translated using that dictionary, instead of using the Google/Microsoft translation service.
- 1 Feature overview
- 2 Download
- 3 Installation
- 4 Configuration
- 5 Usage
- 6 Version history
- 7 Internationalization
- 8 Roadmap
- 9 Authors
- 10 Screenshots
- 11 See also
Feature overview[edit | edit source]
- Live translation of page contents using either Google's or Microsoft's translation services.
- "Auto-translation" so that, if a user translates a page into a certain language, or has their language preference set to a language other than the wiki's, subsequent pages will automatically get translated to that other language.
- Ability to define translations of special words in-wiki or in a remote file in either a special wiki format or TMX. These are then left alone by Google Translate.
- Support for multiple translation memories which can be added and managed via a GUI.
Download[edit | edit source]
The extension can be retrieved directly from Git [?]:
- Browse code
- Some extensions have tags for stable releases.
- Browse tags
- Select the tag
- Click "snapshot"
- Each branch is associated with a past MediaWiki release. There is also a "master" branch containing the latest alpha version (might require an alpha version of MediaWiki).
- Browse branches
- Select a branch name
- Click "Continue"
Extract the snapshot and place it in the extensions/LiveTranslate/ directory of your MediaWiki installation.
If you are familiar with git and have shell access to your server, you can also obtain the extension as follows:
cd extensions/ git clone
Installation[edit | edit source]
Once you have downloaded the code, place the LiveTranslate directory within your MediaWiki 'extensions' directory. Then add the following code to your LocalSettings.php file:
# Live Translate require_once( "$IP/extensions/LiveTranslate/LiveTranslate.php" );
After this you need to run MediaWiki's update script, which can be found at /maintenance/update.php. You also need to run this when upgrading to version 0.4 or above from an older version.
After doing this, you have installed the extension. To be able to use it in a meaningful way, you also need to take care of some configuration:
Configuration[edit | edit source]
Configuration of Live Translate is done by adding simple PHP statements to your LocalSettings.php file. These statements need to be placed AFTER the inclusion of Live Translate. The options are listed below.
Available languages[edit | edit source]
You have to specify which languages users will be able to translate to. This is done by adding language codes to
$egLiveTranslateLanguages. By default it contains only your wiki's main language (as specified by
$wgLanguageCode in LocalSettings.php). You add languages to it as follows:
$egLiveTranslateLanguages = 'nl'; $egLiveTranslateLanguages = 'de';
If there are no languages available other than the current language of the page, then the translation control will not show up.
Translation service[edit | edit source]
You can make use of either the Google Translate or Micorosft Translation services. You can specify the service with the following setting:
# Translation service to use. $egLiveTranslateService = LTS_MS;
Available values are
LTS_MS. The default is
Google API key[edit | edit source]
# Google API key $egGoogleApiKey = 'INSERT-YOUR-KEY-HERE';
Microsoft Client ID and secret[edit | edit source]
To be able to use the Microsoft Translation service, you need to get a Microsoft Client ID and "secret"; you will need to get a Bing account first, if you don't already have one. Once you get those values, add lines like the following to your LocalSettings.php file, after the inclusion of the extension.
# Microsoft client info $egLiveTranslateMSClientId = 'CLIENT-ID-HERE'; $egLiveTranslateMSClientSecret = 'CLIENT-SECRET-HERE';
Permissions[edit | edit source]
In order to edit the list of translation memories, you need the 'managetms' permission. By default only sysops have this permission.
$wgGroupPermissions['sysop']['managetms'] = true;
Auto-translation[edit | edit source]
By default, Live Translate will automatically translate pages into a specific language, if the user has set that language in their user preferences, or if they have previously translated a page into that language. You can avoid that by adding the following to LocalSettings.php, after the inclusion of the extension:
$egLTAutoTranslate = false;
Avoiding auto-translation may be useful if you have a high-traffic wiki, and you want to make sure that your number of translated bytes per month does not exceed the allowed quota for your account.
Usage[edit | edit source]
The translation control[edit | edit source]
Live Translate adds a "Translate" button to the top right-hand corner of wiki pages, together with a dropdown menu that allows you to select the target language. Hitting the "Translate" button will cause the text in the wiki page to be translated to the selected destination language within the browser (it will not modify the original source text in any way). The source language will be assumed to be the wiki's main language, unless the wiki page's name ends with a "/" and then a language code, e.g., "Main Page/de" - if that is the case, the wiki page's language will be assumed to be the one that corresponds to that language code.
After a user hits the "Translate" button, another button, "Show original", will appear, which if pressed will return the display to its original language.
Managing translation dictionaries[edit | edit source]
You can define multiple translation memories, which can be either local (in a wiki page) or remote (anything in a file), and can be in any of the supported translation memory formats. You can add new memories and manage existing ones via Special:LiveTranslate. By default this page can only by accessed by administrators, but this can be changed, see the configuration section. Saving the translation memories will result into them either getting imported or updated (if they already exist).
Explanation of the interface fields:
- Location: For local memories, this should be the name of the page. For remote memories, it should be the full path to the file.
- Type: The format of the translation memory. See "defining a translation dictionary".
- Local: Are the translations part of a wiki page or not?
- remove: Check this to remove the translation memory from Live Translate. The memory itself (file or wiki page) will continue to exist, but will stop being used in translations done via the Live Translate control.
Protecting local translation memories can be done using the native MediaWiki page protection functionality.
Defining a translation dictionary[edit | edit source]
Live Translate supports two translation memory formats.
Live Translate format[edit | edit source]
This format was created specially for this extension and easy use on wikis. It's a simple CSV (comma-separated values) style format, in which the first row contains the set of relevant language codes, and the successive ones the translations. An example would be:
en, nl, de Hello world, Hallo wereld, Hallo welt Awesome, Geweldig, Große
The format supports defining synonyms. You can add them using the | sign as delimiter. For example, if you want "fantastic" to be translated the same as "awesome", the above dictionary would change to:
en, nl, de Hello world, Hallo wereld, Hallo welt Awesome|fantastic, Geweldig, Große
This means that "fantastic" will be handled exactly the same as "Awesome" when translating from English to one of the other languages. When translating to English, the first word in the synonym list, in this case "Awesome", will be used. So translating the Dutch "Geweldig" to English will result in "Awesome".
Translation Memory eXchange[edit | edit source]
This is a commonly-used standard for translation memories. See the Wikipedia article.
Optional disclaimer[edit | edit source]
Automated translation services produce text which can contain errors of grammar. The translation can be incomplete, or can contain mis-translations, through mis-identification of the correct context of a translated word. This extension is best suited to translating texts to the reader's language (for which it was designed) or to produce a first draft of a translation which is then revised by a human translator before being published. It is not suited to be used to produce text for publication or onward distribution.
Version history[edit | edit source]
Version 1.3[edit | edit source]
- Update for new Microsoft translation API.
- Added auto-translation feature.
Version 1.2.3[edit | edit source]
- Added action-managetms message.
Version 1.2.2[edit | edit source]
- Fixed script loading issue occurring when ResourceLoader debugging is off.
Version 1.2.1[edit | edit source]
- Fixed Internet Explorer compatibility issue.
Version 1.2[edit | edit source]
- Added caching layer utilizing memory and LocalStorage when available to speed up local translations.
- Added API module to query translation memories.
- Added i18n alias file.
- Added TMX admin user rights group.
Version 1.1.1[edit | edit source]
- Fixed Internet Explorer compatibility issue.
- Fixed bug in Microsoft transltion script for MW < 1.17.
- Made Microsoft transltion script more robust by adding timeouts.
Version 1.1[edit | edit source]
- Added support for the Microsoft Translation service.
- Added support for comments in the LiveTranslate TMX format.
Version 1.0.1[edit | edit source]
- Added option (on by default) to store insignificant translations.
- Tweaked the LTF parser to allow specifying a word that should never be translated.
Version 1.0[edit | edit source]
- Fixed bug in the API.
- Added missing right declaration.
Version 0.6[edit | edit source]
- Added settings to specify per-namespace if the translation control should be shown or not.
- Use of FormatJson::encode instead of josn_encode for compatibility with PHP5 < 5.2.
Version 0.5[edit | edit source]
- Modified the LT API to work with batches, so translation doesn't break for big translation memories.
- Fixed regex escaping issue that caused translations to stop when encountering certain characters in special words.
Version 0.4[edit | edit source]
- Added support for multiple translation memories.
- Added Special:LiveTranslate to manage the translation memories that should be used.
- Added support for remote translation memories.
- Added support for the Translation Memory eXchange (TMX) format.
- Added Google branding, which is required when using the Google Translate API.
- Improved translation memory insertion into the database.
- Added better tracking of translation memory sizes and language counts.
Version 0.3[edit | edit source]
- Added compatibility with IE8.
- Fixed issue with trim-prevention, causing |-signs to semi-randomly get inserted into translated text.
- Only show the translation control when an API key is provided.
Version 0.2[edit | edit source]
- Fixed installation compatibility issue with MW 1.16.
- Fixed display of translation control to only happen on existing pages.
- Fixed issues with inserting notranslatre tags into the page source.
Version 0.1[edit | edit source]
- Added simple translation interface to the right top of articles.
- Implemented translation via the Google Translate API.
- Added dictionary for special words with synonyms support.
Internationalization[edit | edit source]
Live Translate is fully internationalized. Translation of Live Translate messages is done through translatewiki.net. The translation for this extension can be found here. To add language values or change existing ones, you should create an account on translatewiki.net, then request permission from the administrators to translate a certain language or languages on this page (this is a very simple process). Once you have permission for a given language, you can log in and add or edit whatever messages you want to in that language.
Roadmap[edit | edit source]
These features would be nice to add at some point:
- Utilize HTML5 localStorage when available to store the TMX data relevant to the user. For TMXs with a few thousands translations, this would eliminate several big HTTP requests that need to happen before each translation, thus providing a significant speedup. Invalidation can be done by requesting a simple hash or timestamp of the last TMX update via some new API module.
Authors[edit | edit source]
Live Translate was written by Jeroen De Dauw as a WikiWorks consultant for Texas Instruments. Additional work was done by Nischay Nahata and Yaron Koren, again as WikiWorks consultants for Texas Instruments.