Open main menu

Extension:Mustache i18n

MediaWiki extensions manual
OOjs UI icon advanced.svg
Mustache_i18n
Release status: experimental
Mustance 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
Translate the Mustache i18n extension if it is available at translatewiki.net
Check usage and version matrix.

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

InstallationEdit

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

UsageEdit

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" }}

LimitationsEdit

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

WarningsEdit

  Note: Please note: 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.