]> git.immae.eu Git - github/wallabag/wallabag.git/blob - vendor/symfony/translation/Symfony/Component/Translation/IdentityTranslator.php
f30556b58853132cb03ddc584f7eeed11e2f1b63
[github/wallabag/wallabag.git] / vendor / symfony / translation / Symfony / Component / Translation / IdentityTranslator.php
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Component\Translation;
13
14 /**
15 * IdentityTranslator does not translate anything.
16 *
17 * @author Fabien Potencier <fabien@symfony.com>
18 *
19 * @api
20 */
21 class IdentityTranslator implements TranslatorInterface
22 {
23 private $selector;
24
25 /**
26 * Constructor.
27 *
28 * @param MessageSelector $selector The message selector for pluralization
29 *
30 * @api
31 */
32 public function __construct(MessageSelector $selector)
33 {
34 $this->selector = $selector;
35 }
36
37 /**
38 * {@inheritdoc}
39 *
40 * @api
41 */
42 public function setLocale($locale)
43 {
44 }
45
46 /**
47 * {@inheritdoc}
48 *
49 * @api
50 */
51 public function getLocale()
52 {
53 }
54
55 /**
56 * {@inheritdoc}
57 *
58 * @api
59 */
60 public function trans($id, array $parameters = array(), $domain = 'messages', $locale = null)
61 {
62 return strtr((string) $id, $parameters);
63 }
64
65 /**
66 * {@inheritdoc}
67 *
68 * @api
69 */
70 public function transChoice($id, $number, array $parameters = array(), $domain = 'messages', $locale = null)
71 {
72 return strtr($this->selector->choose((string) $id, (int) $number, $locale), $parameters);
73 }
74 }