initial commit; version 22.5.12042
This commit is contained in:
22
tests/templates/i18n/I18n.php
Normal file
22
tests/templates/i18n/I18n.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
1
tests/templates/i18n/i18n.mustache
Normal file
1
tests/templates/i18n/i18n.mustache
Normal file
@ -0,0 +1 @@
|
||||
{{#__}}Hello.{{/__}} {{#__}}My name is {{ name }}.{{/__}}
|
1
tests/templates/i18n/i18n.txt
Normal file
1
tests/templates/i18n/i18n.txt
Normal file
@ -0,0 +1 @@
|
||||
Hola. Me llamo Bob.
|
Reference in New Issue
Block a user