Extension:I18nTags

From Linux Web Expert

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
Composer mediawiki/i18n-tags
License GNU General Public License 2.0 or later
Download
Example translatewiki.net
Quarterly downloads Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin').
Public wikis using Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin').
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

  • <translate> [[<tvar name=2>Special:ExtensionDistributor/I18nTags</tvar>|Download]] and move the extracted <tvar name=name>I18nTags</tvar> folder to your <tvar name=ext>extensions/</tvar> directory.</translate>
    <translate> Developers and code contributors should install the extension [[<tvar name=git>Special:MyLanguage/Download from Git</tvar>|from Git]] instead, using:</translate>cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/I18nTags
  • <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
    wfLoadExtension( 'I18nTags' );
    
  • Optionally install the CLDR extension to get languages names in any language.
  • File:OOjs UI icon check-constructive.svg <translate> Done</translate> – <translate> Navigate to <tvar name=special>Special:Version</tvar> on your wiki to verify that the extension is successfully installed.</translate>

Features

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.