1 | <?php declare(strict_types=1); |
||
24 | class Messages |
||
25 | { |
||
26 | /** |
||
27 | * @var array |
||
28 | */ |
||
29 | private static $translations = []; |
||
30 | |||
31 | /** |
||
32 | * Try to translate the message and format it with the given parameters. |
||
33 | * |
||
34 | * @param string $message |
||
35 | * @param mixed ...$parameters |
||
36 | * |
||
37 | * @return string |
||
38 | */ |
||
|
|||
39 | 10 | public static function compose(string $message, ...$parameters): string |
|
46 | |||
47 | /** |
||
48 | * Translate message if configured or return the original untranslated message. |
||
49 | * |
||
50 | * @param string $message |
||
51 | * |
||
52 | * @return string |
||
53 | */ |
||
54 | 10 | public static function getTranslation(string $message): string |
|
58 | |||
59 | /** |
||
60 | * Set translations for messages. |
||
61 | * |
||
62 | * @param array $translations |
||
63 | * |
||
64 | * @return void |
||
65 | */ |
||
66 | 1 | public static function setTranslations(array $translations): void |
|
70 | } |
||
71 |