This is a MediaWiki extension that adds some simple functionality to help manage the multilingual nature of the ATITD Wiki.
- Download and place the files in a directory called
ELanguage
in yourextensions/
folder. - Add the following code at the bottom of your
LocalSettings.php
:
wfLoadExtension( 'Interwiki' );
wfLoadExtension( 'ELanguage' );
$wgPageLanguageUseDB = true;
$wgGroupPermissions['user']['pagelang'] = true;
$wgAlwaysShowLanguages = [ "en", "fr" ];
- Feel free to add additional language codes to the
$wgAlwaysShowLanguages
configuration array. Language codes included here will always display links to default interlanguage pages (e.g.Bricks
linking toBricks/fr
), regardless of manually defined interlanguage links. - The Interwiki extension is required and any language codes you'd like to use should be added as interlanguage prefixes with a URL pointing back to the Wiki, and with the Forward and Transclude (iw_local and iw_trans) flags toggled on.
- Done — Navigate to
Special:Version
on your wiki to verify that the extension is successfully installed.
With the new Wiki extension, there is no more need to add {{Languages}}
to the top of pages to get a language bar. The language bar is always there on "main" Wiki pages and links are automatically created to other languages (just English and French by default for now).
The language bar is shown for all pages in the main and Project namespaces. Links are automatically generated by simply appending /fr
to the end of English page titles and vice versa. With the way the old {{Languages}}
template was being used, most of the French pages already have a redirect for /fr
pages.
While it's great that this is all automatic, it's not necessarily ideal in all situations, though, so you can also add Wikipedia-style interlanguage links which will replace the automatic links. For example, if you want the "Bricks" page to have a link to the French "Briques" instead of "Bricks/fr", you just need to add [[fr:Briques]]
anywhere on the page and the link in the language bar will be updated. Likewise, you can add [[en:Bricks]]
to the French page to give an ideal link back. These are special links in MediaWiki so you don't have to worry about these links showing up in your actual page text.
One other new thing is that you can set the Page Language when creating and editing pages. The option is a dropdown menu on the right hand side of the page towards the bottom of the form. Having a correct page language will help the extension generate the automatic language links in the language bar. For most of us, just leaving it as the default English selection should work fine.