Extension:Mustache i18n

From Linux Web Expert

MediaWiki extensions manual
Mustache_i18n
Release status: unmaintained
File:Mustache i18n screenshot.png
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
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').

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

Installation

  • <translate> <tvar name=1>Download</tvar> and place the file(s) in a directory called <tvar name=name>Mustache_i18n</tvar> in your <tvar name=ext>extensions/</tvar> folder.</translate>
  • <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
    wfLoadExtension( 'Mustache_i18n' );
    
  • 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>

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.