Files
Mustache/test/fixtures/examples/i18n/I18n.php
T
Justin Hileman 2448992cc8 Update to proposed PSR-1 coding standard.
* 4 space (no tab) indent
 * K&R-style braces
2012-05-01 22:03:39 -07:00

23 lines
484 B
PHP

<?php
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;
}
}