Extension:Mustache i18n

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
Example Screenshot

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

Installation edit

  • 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' );
    
  •   Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Usage edit

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 edit

  • 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 edit

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.