Mastering MediaWiki: A Deep Dive into the Content Translation Extension
Why “Content Translation” Matters (and why it isn’t just another plug‑in)
Picture this: you’ve just written a solid article on “Quantum tunneling” in English, and a handful of volunteers in Spain, Japan, and Brazil are itching to read it in their native tongues. You could copy‑paste the whole thing into Google Translate, fix a few glaring errors, and call it a day – but that’s the boring route. The Content Translation extension (let’s call it CT for short) is built to make that workflow feel like a natural conversation between editors, not a clunky back‑and‑forth.
First off, CT isn’t a stand‑alone monster. It leans on the Translate extension for the heavy lifting – message handling, workflow states, and all that jazz. Think of CT as the friendly UI that lets you sit side‑by‑side with the source article, while Translate does the backstage plumbing.
Getting the Basics Right – Installation in a Nutshell
Alright, let’s roll up our sleeves. If you’ve ever set up Extension:VisualEditor or Extension:ParserFunctions, you’ll feel right at home. Here’s the quick‑and‑dirty steps you’ll likely follow:
- Grab the latest release from MediaWiki’s extension page.
- Drop the folder into your
/extensionsdirectory. - Add the following to your
LocalSettings.php(yes, the same file you keep tweaking for the odd wgEnableUploads flag).
wfLoadExtension( 'ContentTranslation' ); $wgEnableContentTranslation = true; // remember to flip this on
After that, fire up php maintenance/update.php to make sure the DB schema is in sync. If you run into a “missing column” error, double‑check you’ve also enabled Translate – it’s a prerequisite, not an afterthought.
Under the Hood – What CT Actually Does
At its core, CT creates a “translation page” that mirrors the source. The page lives side‑by‑side, same namespace, different language code. When you hit “Translate” on an article, MediaWiki spawns a new page like es:Quantum tunneling for Spanish or ja:Quantum tunneling for Japanese.
From there, a few magic things happen:
- Machine‑assisted pre‑translation – the extension can pull suggestions from Apertium, Google, or a self‑hosted MT engine (you set it up via
$wgTranslateMachineTranslation). - Section‑by‑section workflow – each heading becomes a “translation chunk”. Editors can lock a chunk, translate, and then mark it as reviewed. It’s like a kitchen ticket system, but for sentences.
- Proofreading integration
Proofreading isn’t just a tick‑box. The Translate extension adds reviewers, quality scores, and even a “translation memory” that suggests phrasing you’ve used before. If you’ve ever gotten a “duplicate content” warning on Wikipedia, you’ll recognize that vibe.
Configuring the Machine‑Translation Backend
Don’t assume the default MT “whatever the internet gives me” will cut it for a serious project. You can point CT at a specific service like this:
$wgTranslateMachineTranslation = [ 'service' => 'Google', 'apiKey' => 'YOUR_API_KEY_GOES_HERE', ];
Or, if you want a DIY approach, spin up Bitextor and point CT to its endpoint. The trick is to keep the apiKey safe – don’t commit it to GitHub, unless you like public embarrassment.
Workflow in Action – From Scratch to Published
What does a day in the life of a CT editor look like? Here’s a quick walk‑through (and feel free to skip the parts that sound like “blah‑blah‑blah” – I’m being honest, some steps feel repetitive).
- Open the source article. Click the Translate tab that CT adds to the top navigation.
- Choose your target language from the dropdown. The system creates a new page, pre‑filled with MT suggestions.
- Pick a section. Usually you’ll see a “Lock this section” button – click it to claim ownership.
- Enter your translation. You can edit raw wikitext or use the VisualEditor if you’ve got it enabled.
- Hit “Mark as done”. The section slides into the “reviewed” queue.
- Another reviewer – maybe a native speaker – takes a look, adds comments, and either approves or sends it back.
- Once all sections are approved, the translated page gets the “published” badge and shows up in language‑specific search results.
That “reviewer” step is where Translate shines. It records who approved, when, and even a brief “confidence score”. If you’re a community manager, that data can become a dashboard you brag about at meetings.
Tips & Tricks – Getting the Most Out of Content Translation
- Don’t rely solely on MT. Use it as a “first draft”. Human polish still matters – especially for technical jargon.
- Leverage translation memory. CT will automatically suggest phrasing you’ve already approved in other articles. It’s a time‑saver.
- Use custom tags. If your project has domain‑specific markup (
<math>or<ref>), add them to$wgContentTranslationAllowedTagsso they survive the MT process. - Set up “watchers”. A small
extension.jsonsnippet can auto‑notify language admins when new translations land:
{ "Hooks": { "ContentTranslationAfterPublish": "MyExtension\\Hooks::notifyAdmins" } }
Inside MyExtension\\Hooks, you’d use MediaWiki\\Hooks\\WatchPageHook or the newer event system – I won’t go into the full code, but the idea is simple: ping the right people so they can keep the quality bar high.
Common Pitfalls – What Not to Do
Even seasoned Wiki‑admins stumble into a few traps. Here are the ones you’ll probably see:
- Skipping the
Translateinstall. CT will silently fail ifTranslateisn’t active – you’ll get a “missing table” error and wonder why nothing works. - Hard‑coding language codes. Use
Language::getCodes()to dynamically fetch supported languages. Hard‑codedenorfrstrings lock you out of future expansions. - Ignoring the “template” sections. If a source article relies heavily on transcluded templates, CT can’t translate those automatically. You’ll need to duplicate the templates or set up
TemplateTranslation(a separate extension). - Over‑optimizing MT scores. Some admins set the MT acceptance threshold to 0.9, but that can block decent translations that just need a little human tweak.
Future‑Proofing – Where CT Is Heading
Even though CT feels stable today, the MediaWiki community is already looking at a few enhancements. Rumor has it (and I read this on the dev mailing list just this week) that a next‑generation UI is being prototyped – one that merges the “translation pane” directly into the VisualEditor sidebar, making the “lock” button a thumb‑sized widget.
Another hot topic is “cross‑language search”. Right now, a search for “quantum tunneling” in Spanish will only hit the es article. The upcoming CrossLanguageSearch extension aims to index source content and present translations on the fly. If that lands, CT will become a central hub for multilingual knowledge graphs.
Wrapping Up – My Take
Honestly, I’m still amazed at how far MediaWiki has come from the days of plain wikitext. The Content Translation extension feels like the “Swiss Army knife” of multilingual collaboration – you pull out whatever blade you need, whether it’s MT suggestions, a lockable chunk, or a reviewer’s note. Of course, like any tool, it works best when you understand its quirks, keep your configuration tidy, and involve a community that values both speed and quality.