1 | <?php |
||
19 | trait TranslateMethods |
||
20 | { |
||
21 | |||
22 | /** |
||
23 | * @var TranslatorInterface |
||
24 | */ |
||
25 | protected $translator; |
||
26 | |||
27 | /** |
||
28 | 2 | * Translate the provided message |
|
29 | * |
||
30 | 2 | * @param string $message |
|
31 | * |
||
32 | * @return string The translated message |
||
33 | */ |
||
34 | public function translate($message) |
||
39 | |||
40 | /** |
||
41 | * Translates the provided message to singular or plural according to the number |
||
42 | 2 | * |
|
43 | * @param string $singular |
||
44 | 2 | * @param string $plural |
|
45 | 2 | * @param integer $number |
|
46 | * |
||
47 | * @return string |
||
48 | */ |
||
49 | public function translatePlural($singular, $plural, $number) |
||
50 | { |
||
51 | $this->checkTranslator(); |
||
52 | return $this->translator->translatePlural($singular, $plural, $number); |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * Checks if translate property is set |
||
57 | */ |
||
58 | private function checkTranslator() |
||
68 | } |