Release status: experimental
|Implementation||Page action, MyWiki, Locale|
|Description||support for content in multiple languages in a single MediaWiki|
|License||GNU General Public License 2.0 or later|
|Quarterly downloads||9 (Ranked 167th)|
|Translate the Polyglot extension if it is available at translatewiki.net|
The Polyglot extension provides automatic redirects based on user language. This allows for multilingual content to be handled more easily on a single wiki. Polyglot also changes the interlanguage links in the sidebar to automatically show available localized versions of each page on the same wiki.
For more comprehensive support for multilingual content, Polyglot can be combined with the LanguageSelector extensions.
Automatic redirects are performed based on a naming scheme: when visiting the page Foo with the user language set to de (German), Polyglot would redirect the user to Foo/de, if it exists. This automatic redirection can be bypassed by visiting Foo/, which will always show Foo proper. The base page (Foo in this example) is considered to be associated with the wiki's content language ($wgLanguageCode in LocalSettings.php).
Note that, in Wikitext links, [[Foo/|Foo (English)]] won’t work, use [[Foo|Foo (English)]] instead, i.e. omit the trailing slash. This is only for visiting pages, e.g. from the address bar.
Note that Polyglot can not readily be used to localize templates.
- Download and place the file(s) in a directory called
- Add the following code at the bottom of your
- Configure as required
- Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
You can specify the following settings in your LocalSettings.php (after including the extension file):
- Languages to be considered when looking for matching subpages (localized versions). If set to NULL (the default), all languages known to MediaWiki (by $wgExtraLanguageNames) are considered. If the LanguageSelector extension is installed and $wgLanguageSelectorLanguages is set, that value will be used as a fallback. Setting $wgPolyglotLanguages to a shorter list may speed things up, especially on large wikis. For example, to let people choose between English (en), German (de) and French (fr), use
$wgPolyglotLanguages = array('en', 'de', 'fr');
- $wfPolyglotExcemptNamespaces [sic]
- Namespaces that should not have magic redirection applied by Polyglot. Per default, this includes the Category, Image, Template, MediaWiki, Media, and Special namespaces. There should be no reason to remove any of those, but you can add more namespaces to be left alone.
- $wfPolyglotExcemptTalkPages [sic]
- Whether talk pages should be imune to magic redirection by Polyglot. True per default.
- Whether Polyglot should follow redirects it finds as the target of a magic redirect. This is false per default; setting it to true causes an additional database lookup on every magic redirect, but it allows for localized page titles. For example, Main_Page/de could redirect to Hauptseite, so people with the user language set to "de" (German) would end up on a page called "Hauptseite" instead of the clunky "Main_Page/de". NOTE: currently, the magic interlanguage links don't take into consideration this type of redirect.
- Allow users to define page localization links manually, using the standard interlanguage link syntax and mechanism. Which links are treated as interlanguage links is determined by the interwiki table. An additional hook in Title.php would be needed to solved that, or dummy entries in the interwiki table.
- When following redirects ( base -> local -> target ), make the "redirected from" bit show both, the base and the referring page. Would require a skin hack.
- When following redirects, look at the redirecting pages subpages and siblings, and merge the result with the target page's language links.
- Experimental extensions
- Page action extensions
- Personalization extensions
- Internationalization extensions
- GPL licensed extensions
- Extensions in Wikimedia version control
- ParserAfterTidy extensions
- InitializeArticleMaybeRedirect extensions
- SkinTemplateOutputPageBeforeExec extensions
- All extensions
- Redirect extensions