1 | <?php |
||
14 | class Prefix { |
||
15 | /** |
||
16 | * @var string |
||
17 | */ |
||
18 | protected $prefix; |
||
19 | /** |
||
20 | * Initialization with some prefix |
||
21 | * |
||
22 | * @param string $prefix |
||
23 | */ |
||
24 | 12 | public function __construct ($prefix) { |
|
27 | /** |
||
28 | * Get translation |
||
29 | * |
||
30 | * @param string $item |
||
31 | * @param false|string $language If specified - translation for specified language will be returned, otherwise for current |
||
32 | * |
||
33 | * @return string |
||
34 | */ |
||
35 | public function get ($item, $language = false) { |
||
36 | return Language::instance()->get($item, $language, $this->prefix); |
||
37 | } |
||
38 | /** |
||
39 | * Get translation |
||
40 | * |
||
41 | * @param string $item |
||
42 | * |
||
43 | * @return string |
||
44 | */ |
||
45 | 12 | public function __get ($item) { |
|
48 | /** |
||
49 | * Time formatting according to the current language (adding correct endings) |
||
50 | * |
||
51 | * @param int $in time (number) |
||
52 | * @param string $type Type of formatting<br> |
||
53 | * s - seconds<br>m - minutes<br>h - hours<br>d - days<br>M - months<br>y - years |
||
54 | * |
||
55 | * @return string |
||
56 | */ |
||
57 | 6 | public function time ($in, $type) { |
|
60 | /** |
||
61 | * Allows to use formatted strings in translations |
||
62 | * |
||
63 | * @see format() |
||
64 | * |
||
65 | * @param string $item |
||
66 | * @param array $arguments |
||
67 | * |
||
68 | * @return string |
||
69 | */ |
||
70 | 6 | public function __call ($item, $arguments) { |
|
73 | /** |
||
74 | * Allows to use formatted strings in translations |
||
75 | * |
||
76 | * @param string $item |
||
77 | * @param string[] $arguments |
||
78 | * @param false|string $language If specified - translation for specified language will be returned, otherwise for current |
||
79 | * |
||
80 | * @return string |
||
81 | */ |
||
82 | public function format ($item, $arguments, $language = false) { |
||
85 | /** |
||
86 | * Formatting data according to language locale (translating months names, days of week, etc.) |
||
87 | * |
||
88 | * @param string|string[] $data |
||
89 | * @param bool $short_may When in date() or similar functions "M" format option is used, third month "May" have the same short textual |
||
90 | * representation as full, so, this option allows to specify, which exactly form of representation do you want |
||
91 | * |
||
92 | * @return string|string[] |
||
93 | */ |
||
94 | public function to_locale ($data, $short_may = false) { |
||
97 | } |
||
98 |