diff options
Diffstat (limited to 'inc/Twig/Extensions/Extension/I18n.php')
-rw-r--r-- | inc/Twig/Extensions/Extension/I18n.php | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/inc/Twig/Extensions/Extension/I18n.php b/inc/Twig/Extensions/Extension/I18n.php new file mode 100644 index 00000000..3702aa22 --- /dev/null +++ b/inc/Twig/Extensions/Extension/I18n.php | |||
@@ -0,0 +1,44 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of Twig. | ||
5 | * | ||
6 | * (c) 2010 Fabien Potencier | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | class Twig_Extensions_Extension_I18n extends Twig_Extension | ||
12 | { | ||
13 | /** | ||
14 | * Returns the token parser instances to add to the existing list. | ||
15 | * | ||
16 | * @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances | ||
17 | */ | ||
18 | public function getTokenParsers() | ||
19 | { | ||
20 | return array(new Twig_Extensions_TokenParser_Trans()); | ||
21 | } | ||
22 | |||
23 | /** | ||
24 | * Returns a list of filters to add to the existing list. | ||
25 | * | ||
26 | * @return array An array of filters | ||
27 | */ | ||
28 | public function getFilters() | ||
29 | { | ||
30 | return array( | ||
31 | 'trans' => new Twig_Filter_Function('gettext'), | ||
32 | ); | ||
33 | } | ||
34 | |||
35 | /** | ||
36 | * Returns the name of the extension. | ||
37 | * | ||
38 | * @return string The extension name | ||
39 | */ | ||
40 | public function getName() | ||
41 | { | ||
42 | return 'i18n'; | ||
43 | } | ||
44 | } | ||