Extension:LanguageTag

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png
LanguageTag

Release status:Extension status stable

ImplementationTemplate:Extension#type Tag, Locale
DescriptionTemplate:Extension#description Allows to use XML-style language tags to markup different languages, and display them properly
Author(s)Template:Extension#username István Király (LaKingtalk)
Latest versionTemplate:Extension#version 1.0 (2013-10-28)
MediaWikiTemplate:Extension#mediawiki 1.21+
PHPTemplate:Extension#php 5.4+
Database changesTemplate:Extension#needs-updatephp No
LicenseTemplate:Extension#license GPL
Download
ParametersTemplate:Extension#parameters
  • wgLanguageTagLanguages
Hooks usedTemplate:Extension#hook
ParserFirstCallInitManual:Hooks/ParserFirstCallInit

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

Check usage and version matrix.

The LanguageTag extension allows to use XML-style language tags to markup different languages, and display them according the markup, and the user language setting.
This extension may and should be used together with the UniversalLanguageSelector extension, to give the user the ability to choose his locale.

Usage[edit]

It can be used on a per-page basis. Installed and activated it will parse XML language tags, like <en>text</en> and display it only if the user language is english.

Example
<en>'''This''' is some text in English. It will only be visible for users in English locale.</en>
<de>Dies ist ein deutschsprachiger Text.</de>
<hu>Ez a mediawiki magyar hangja. Írásban.<hu>

If the user Language does not match, the extension will include the text in the html page, as a comment.

Installation[edit]

  • Download and place the file(s) in a directory called LanguageTag in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    require_once "$IP/extensions/LanguageTag/LanguageTag.php";
    $wgLanguageTagLanguages = array( "en", "de", "hu" ); // Adjust that array to set what language tag's should be parsed.
    
  • YesY Done - Navigate to Special:Version on your wiki to verify that the extension is successfully installed.