MediaWiki extensions manual
Mustache_i18n
Release status: unmaintained
Description Adds i18n support for Mediawiki Mustache templating engine
Author(s) Vedmakatalk
Latest version 0.1
MediaWiki 1.25+
Database changes No
License MIT License
Download

GitHub:

Note:
No localisation updates are
provided by translatewiki.net .

Example Screenshot
Hooks used
  • BeforePageDisplay

The Mustache_i18n extension adds internationalization support to Mustache templating engine integrated into MediaWiki.

Installation

  • Download and place the file(s) in a directory called Mustache_i18n in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php file:
    wfLoadExtension( 'Mustache_i18n' );
    
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Usage

After being installed this extension add two "helpers" to Mustache engine:

  • _ (underscore) — process provided message key and returns plain string
  • __ (double underscore) — process provided message key and returns parsed string

Examples:

This is plain string message: {{ _ "my-i18n-message-key" }}

This is parsed string message: {{ __ "my-i18n-message-key" }}

Limitations

  • Parametrized messages are not supported
  • Any other output formats except plain and parsed are not supported
  • Templates cache can lead to messed up messages and localizations mustache for users. In general it is not Mustache_i18n problem, but templating system itself.

Warnings

due lack of hooks in MediaWiki templating code this extensions use its own TemplateParser class by replacing classes loading list (via $wgAutoloadLocalClasses). This should not be a big problem, but can lead to confusing situation if you'll forget to update this extension after new MediaWiki release.
This article is issued from Mediawiki. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.