1 | <?php |
||
12 | class Language |
||
|
|||
13 | { |
||
14 | /** |
||
15 | * Language files format. |
||
16 | */ |
||
17 | const FORMAT = 'json'; |
||
18 | |||
19 | //Contains module language translations |
||
20 | protected static $languageContainer = []; |
||
21 | protected static $modules = false; |
||
22 | |||
23 | /** |
||
24 | * Functions that gets translated string. |
||
25 | * |
||
26 | * @param string $key - string which need to be translated |
||
27 | * @param string $module - module scope in which the translation need to be check |
||
28 | * @param string $currentLanguage |
||
29 | * |
||
30 | * @return string - translated string |
||
31 | */ |
||
32 | public static function translate(string $key, string $module = 'Basic', string $currentLanguage = ''): string |
||
56 | |||
57 | /** |
||
58 | * Functions that gets translated string by $args. |
||
59 | * |
||
60 | * @param string $key - string which need to be translated |
||
61 | * @param string $moduleName - module scope in which the translation need to be check |
||
62 | * |
||
63 | * @return string - translated string |
||
64 | */ |
||
65 | public static function translateArgs(string $key, string $moduleName = 'Basic'): string |
||
74 | |||
75 | /** |
||
76 | * Function that returns current language. |
||
77 | * |
||
78 | * @return string |
||
79 | */ |
||
80 | public static function getLanguage() |
||
91 | |||
92 | /** |
||
93 | * Function returns language specific translated string. |
||
94 | * |
||
95 | * @param string $language - en_us etc |
||
96 | * @param string $key - label |
||
97 | * @param string $module - module name |
||
98 | * |
||
99 | * @return string translated string or null if translation not found |
||
100 | */ |
||
101 | public static function getLanguageTranslatedString(string $language, string $key, string $module = 'Basic') |
||
114 | |||
115 | public static function getModuleStringsFromFile(string $language, string $module = 'Basic') |
||
125 | |||
126 | /** |
||
127 | * Load language file from JSON. |
||
128 | * |
||
129 | * @param string $language |
||
130 | * @param string $moduleName |
||
131 | * |
||
132 | * @return void |
||
133 | */ |
||
134 | public static function loadLanguageFile(string $language, string $moduleName = 'Basic') |
||
148 | |||
149 | /** |
||
150 | * Functions that gets translated string for Client side. |
||
151 | * |
||
152 | * @param <String> $key - string which need to be translated |
||
153 | * @param <String> $module - module scope in which the translation need to be check |
||
154 | * @param mixed $language |
||
155 | * |
||
156 | * @return <String> - translated string |
||
157 | */ |
||
158 | public static function jstranslate($language, $key, $module = 'Basic') |
||
171 | |||
172 | /** |
||
173 | * Function to returns all language information. |
||
174 | * |
||
175 | * @return string[] |
||
176 | */ |
||
177 | public static function getAllLanguages() |
||
181 | |||
182 | /** |
||
183 | * Function that returns current language short name. |
||
184 | * |
||
185 | * @return <String> - |
||
186 | */ |
||
187 | public static function getShortLanguageName() |
||
192 | |||
193 | /** |
||
194 | * Function returns module strings. |
||
195 | * |
||
196 | * @param <String> $module - module Name |
||
197 | * @param <String> languageStrings or jsLanguageStrings |
||
198 | * @param mixed $type |
||
199 | * |
||
200 | * @return <Array> |
||
201 | */ |
||
202 | public static function export($module, $type = 'php') |
||
218 | |||
219 | public static function translateModule($module) |
||
227 | } |
||
228 |
This check examines a number of code elements and verifies that they conform to the given naming conventions.
You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.