1 | <?php |
||
23 | class Translator implements TranslatorInterface |
||
24 | { |
||
25 | protected $translator; |
||
26 | |||
27 | /** @var bool */ |
||
28 | protected $debug = false; |
||
29 | |||
30 | public function __construct(TranslatorInterface $translator) |
||
34 | |||
35 | /** |
||
36 | * Sets the debug mode |
||
37 | * |
||
38 | * @param bool $debug |
||
39 | * |
||
40 | * @return $this |
||
41 | */ |
||
42 | public function setDebug($debug) |
||
48 | |||
49 | /** |
||
50 | * {@inheritdoc} |
||
51 | */ |
||
52 | public function trans($id, array $parameters = array(), $domain = null, $locale = null) |
||
53 | { |
||
54 | if ($this->debug) { |
||
55 | return $id; |
||
56 | } |
||
57 | |||
58 | return $this->translator->trans($id, $parameters, $domain, $locale); |
||
59 | } |
||
60 | |||
61 | /** |
||
62 | * {@inheritdoc} |
||
63 | */ |
||
64 | public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null) |
||
65 | { |
||
66 | if ($this->debug) { |
||
67 | return $id; |
||
68 | } |
||
69 | |||
70 | return $this->translator->transChoice($id, $number, $parameters, $domain, $locale); |
||
71 | } |
||
72 | |||
73 | /** |
||
74 | * {@inheritdoc} |
||
75 | */ |
||
76 | public function setLocale($locale) |
||
80 | |||
81 | /** |
||
82 | * {@inheritdoc} |
||
83 | */ |
||
84 | public function getLocale() |
||
88 | } |
||
89 |