Extension: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 |
| 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 place the file(s) in a directory called
I18nTagsin yourextensions/folder. - Add the following code at the bottom of your LocalSettings.php:
wfLoadExtension( 'I18nTags' );
- Optionally install the CLDR extension to get languages names in any language.
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$1being 8. <linktrail>- Emulates the linktrail for a specific language.
