Extension:Multilang

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual
Crystal Clear action run.png
Multilang

Release status: beta

Implementation Tag, Locale
Description A multilanguage extension
Author(s) Daniel Arnold
Latest version 0.11 (2006-01-17)
MediaWiki > 1.7 (1.6.10) < 1.16
License GPL
Download Template:WikimediaDownload/svn
Hooks used
ParserClearState

ParserFirstCallInit

Translate the Multilang extension if it is available at translatewiki.net

Check usage and version matrix; code metrics

Multilang is a multi language extension for MediaWiki using <multilang> tag for selective text display depending on user language settings. It is inspired by the Multilanguage extension which sadly does not work on newer MediaWiki systems and which has some bugs that led to this rewrite.

This extension can be combined with the LanguageSelector extension, and perhaps Polyglot, for more comprehensive support of multilingual content.

Usage[edit | edit source]

Especially small parts of texts like in templates (where you are forced to use exactly the same template name) can efficiently and easily be made multilingual using the Multilang extension. You can use it the following way:

<multilang>
@de|"Das ist ein deutscher Text."
@en|"This is an English text."
</multilang>

On a wiki that has this extension you will see depending on your user language setting (from Special:Preferences) either only the message in your language or if this is not existing the default system language. If your preferred language and the fallback language is not among the provided alternatives the extension shows the first text alternative as default. If you're interested to know your own language setting you can use:

<multilang />

It will display the language codes of the preferred language and the default language, separated by a comma.

Installation[edit | edit source]

You need at least MediaWiki 1.7 (people also reported that it works on MediaWiki 1.6.8, the latest version of 1.6.x series) in order to run this MediaWiki extension.

It seems not to work starting form MediaWiki 1.17, it was with MediaWiki 1.16 (see discussion page).

Download the multilang files, extract them and copy Multilang.php and Multilang.class.php into your extension folder and include it from your LocalSettings.php with: require_once( "$IP/extensions/Multilang/Multilang.php" );

You can configure the plugin setting the $wgMultilangUseBrowserLanguage variable in LocalSettings.php. $wgMultilangUseBrowserLanguage = true; will respect browser language setting of the wiki user instead of the user language setting in the wiki. Default is $wgMultilangUseBrowserLanguage = false; and thus using the user language settings from the wiki.

The browser language method has the advantage that you have more than one fallback language in case no text alternative in your favorite language was found. However this feature is not very much tested and might could cause some confusion if the user language setting in the wiki differs from the browser language setting.

<multilang> @de|"Das ist ein deutscher Text." @en|"This is an English text." </multilang>

TODO[edit | edit source]

  • Check entered language codes for validity (using Names.php) and throw a nice red parse error in case not.
  • Reader should be able to expand the list (via a small GUI-link) so that they can see the text in all languages and be able to switch the displayed text to any language, without influencing the interface language itself.

See also[edit | edit source]