Release status: experimental
|Implementation||Page action, MyWiki, Locale|
|Description||support for content in multiple languages in a single MediaWiki|
|Author(s)||Duesentrieb, Kipmaster (maintainer)|
|License||No license specified|
$wgPolyglotLanguages, $wfPolyglotExcemptNamespaces, $wfPolyglotExcemptTalkPages, $wfPolyglotFollowRedirects
|Translate the Polyglot extension if it is available at translatewiki.net|
|Check usage and version matrix.|
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.
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. Instead, use the Multilang extension for template messages.
- Download and place the file(s) in a directory called
- Add the following code at the bottom of your LocalSettings.php:
- 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.