You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class I18n
{
// Variable to be interpolated
public $name = 'Bob';
// Add a {{#__}} lambda for i18n
public $__ = array(__CLASS__, '__trans');
// A *very* small i18n dictionary :)
private static $dictionary = array(
'Hello.' => 'Hola.',
'My name is {{ name }}.' => 'Me llamo {{ name }}.',
);
public static function __trans($text)
{
return isset(self::$dictionary[$text]) ? self::$dictionary[$text] : $text;
}
}
$mustache = new Mustache_Engine( array(
'loader' => new Mustache_Loader_FilesystemLoader($BASE.'../templates', array('extension' => '.html')),
'partials_loader' => new Mustache_Loader_FilesystemLoader($BASE.'../templates/partials', array('extension' => '.html')),
'escape' => function($value) {
return htmlspecialchars($value, ENT_COMPAT, 'UTF-8');
},
'helpers' => array('i18n' => function ($text) {
// What should i do here ?
}),
'charset' => 'UTF-8',
'strict_callables' => true,
));
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: