Jump to content

Extension:I18nTags

From mediawiki.org
MediaWiki extensions manual
I18nTags
Release status: stable
Implementation Tag , Parser function
Description Provides access the i18n functions for number formatting, grammar and plural in any available language
Author(s) Niklas Laxström (Nikerabbittalk)
Latest version 2018-08-06
MediaWiki >= 1.35.0
Database changes No
License GNU General Public License 2.0 or later
Download
Example translatewiki.net
Quarterly downloads 1 (Ranked 139th)
Translate the I18nTags extension if it is available at translatewiki.net

The I18nTags extension provides access to i18n functions for number formatting, grammar and plural in any available language.

Installation

[edit]
  • Download and move the extracted I18nTags folder to your extensions/ directory.
    Developers and code contributors should install the extension from Git instead, using:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/I18nTags
  • Add the following code at the bottom of your LocalSettings.php file:
    wfLoadExtension( 'I18nTags' );
    
  • Optionally install the CLDR extension to get languages names in any language.
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Features

[edit]
This section is outdated, see the discussion page
{{#languagename:}}
Get the language's name in the user language. You can override the user language by passing in a language code (or native) as an additional parameter.
Syntax User language Output
{{#languagename:fr}} English French
{{#languagename:fr}} German Französisch
{{#languagename:fr|de}} any Französisch
{{#languagename:fr|fr}} any Français
{{#languagename:fr|native}} any Français
<formatnum>
Like {{#formatnum:}} but for any language. To choose the language, use <formatnum lang="..."></formatnum>.
<grammar>
Like {{#grammar:}} but for any language. To choose the language, use <grammar lang="..."></grammar>.
<plural>
Like {{#plural:}} but for any language. To choose the language, use <plural lang="..." n="..."></plural>. For example, <plural lang="cs" n="8">soubor|soubory|souborů</plural> is equivalent to {{PLURAL:$1|soubor|soubory|souborů}}, with the language being Czech (cs) and $1 being 8.
<linktrail>
Emulates the linktrail for a specific language.