@@ -16,9 +16,9 @@ |
||
16 | 16 | die('<b>ERROR:</b> Autoloader not present. Run composer update first.'); |
17 | 17 | } |
18 | 18 | |
19 | - /** |
|
20 | - * The composer autoloader |
|
21 | - */ |
|
19 | + /** |
|
20 | + * The composer autoloader |
|
21 | + */ |
|
22 | 22 | require_once $autoload; |
23 | 23 | |
24 | 24 | // the folder in which the localization .ini files are stored |
@@ -20,9 +20,9 @@ discard block |
||
20 | 20 | */ |
21 | 21 | abstract class Localization_Event |
22 | 22 | { |
23 | - /** |
|
24 | - * @var array |
|
25 | - */ |
|
23 | + /** |
|
24 | + * @var array |
|
25 | + */ |
|
26 | 26 | protected $args; |
27 | 27 | |
28 | 28 | public function __construct(array $args) |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | $this->args = $args; |
31 | 31 | } |
32 | 32 | |
33 | - /** |
|
34 | - * Fetches the argument at the specified index in the |
|
35 | - * event's arguments list, if it exists. |
|
36 | - * |
|
37 | - * @param int $index Zero-based index number. |
|
38 | - * @return mixed|NULL |
|
39 | - */ |
|
33 | + /** |
|
34 | + * Fetches the argument at the specified index in the |
|
35 | + * event's arguments list, if it exists. |
|
36 | + * |
|
37 | + * @param int $index Zero-based index number. |
|
38 | + * @return mixed|NULL |
|
39 | + */ |
|
40 | 40 | public function getArgument(int $index) |
41 | 41 | { |
42 | 42 | if(isset($this->args[$index])) { |
@@ -33,14 +33,14 @@ discard block |
||
33 | 33 | */ |
34 | 34 | protected $country; |
35 | 35 | |
36 | - /** |
|
37 | - * @var string |
|
38 | - */ |
|
36 | + /** |
|
37 | + * @var string |
|
38 | + */ |
|
39 | 39 | protected $countryCode; |
40 | 40 | |
41 | - /** |
|
42 | - * @var string |
|
43 | - */ |
|
41 | + /** |
|
42 | + * @var string |
|
43 | + */ |
|
44 | 44 | protected $languageCode; |
45 | 45 | |
46 | 46 | /** |
@@ -69,11 +69,11 @@ discard block |
||
69 | 69 | $this->languageCode = $tokens[0]; |
70 | 70 | } |
71 | 71 | |
72 | - /** |
|
73 | - * Retrieves the two-letter language code of the locale. |
|
74 | - * |
|
75 | - * @return string Language code, e.g. "en", "de" |
|
76 | - */ |
|
72 | + /** |
|
73 | + * Retrieves the two-letter language code of the locale. |
|
74 | + * |
|
75 | + * @return string Language code, e.g. "en", "de" |
|
76 | + */ |
|
77 | 77 | public function getLanguageCode() : string |
78 | 78 | { |
79 | 79 | return $this->languageCode; |
@@ -100,25 +100,25 @@ discard block |
||
100 | 100 | return $this->localeName; |
101 | 101 | } |
102 | 102 | |
103 | - /** |
|
104 | - * Retrieves the shortened version of the locale name, |
|
105 | - * e.g. "en" or "de". |
|
106 | - * |
|
107 | - * @return string |
|
108 | - * @deprecated |
|
109 | - * @see Localization_Locale::getLanguageCode() |
|
110 | - */ |
|
103 | + /** |
|
104 | + * Retrieves the shortened version of the locale name, |
|
105 | + * e.g. "en" or "de". |
|
106 | + * |
|
107 | + * @return string |
|
108 | + * @deprecated |
|
109 | + * @see Localization_Locale::getLanguageCode() |
|
110 | + */ |
|
111 | 111 | public function getShortName() : string |
112 | 112 | { |
113 | 113 | return $this->getLanguageCode(); |
114 | 114 | } |
115 | 115 | |
116 | - /** |
|
117 | - * Retrieves the two-letter country code of |
|
118 | - * the locale. |
|
119 | - * |
|
120 | - * @return string Lowercase code, e.g. "uk" |
|
121 | - */ |
|
116 | + /** |
|
117 | + * Retrieves the two-letter country code of |
|
118 | + * the locale. |
|
119 | + * |
|
120 | + * @return string Lowercase code, e.g. "uk" |
|
121 | + */ |
|
122 | 122 | public function getCountryCode() : string |
123 | 123 | { |
124 | 124 | return $this->countryCode; |
@@ -6,9 +6,9 @@ |
||
6 | 6 | |
7 | 7 | class Localization_Scanner_StringsCollection_Warning |
8 | 8 | { |
9 | - /** |
|
10 | - * @var array |
|
11 | - */ |
|
9 | + /** |
|
10 | + * @var array |
|
11 | + */ |
|
12 | 12 | protected $data; |
13 | 13 | |
14 | 14 | public function __construct(array $data) |
@@ -12,8 +12,8 @@ |
||
12 | 12 | const SERIALIZED_PROPERTIES = 'properties'; |
13 | 13 | |
14 | 14 | /** |
15 | - * @var Localization_Scanner_StringsCollection |
|
16 | - */ |
|
15 | + * @var Localization_Scanner_StringsCollection |
|
16 | + */ |
|
17 | 17 | protected $collection; |
18 | 18 | |
19 | 19 | /** |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | const EVENT_LOCALE_CHANGED = 'LocaleChanged'; |
49 | 49 | |
50 | 50 | /** |
51 | - * Collection of all locales by namespace (application, content, custom...). |
|
52 | - * |
|
53 | - * @var array<string,array<string,Localization_Locale>> |
|
54 | - * @see Localization::addLocale() |
|
55 | - */ |
|
51 | + * Collection of all locales by namespace (application, content, custom...). |
|
52 | + * |
|
53 | + * @var array<string,array<string,Localization_Locale>> |
|
54 | + * @see Localization::addLocale() |
|
55 | + */ |
|
56 | 56 | protected static $locales = array(); |
57 | 57 | |
58 | 58 | /** |
@@ -61,57 +61,57 @@ discard block |
||
61 | 61 | */ |
62 | 62 | private static $initDone = false; |
63 | 63 | |
64 | - /** |
|
65 | - * Path to the file in which the scanner results are stored. |
|
66 | - * @var string |
|
67 | - * @see Localization::configure() |
|
68 | - */ |
|
64 | + /** |
|
65 | + * Path to the file in which the scanner results are stored. |
|
66 | + * @var string |
|
67 | + * @see Localization::configure() |
|
68 | + */ |
|
69 | 69 | protected static $storageFile = ''; |
70 | 70 | |
71 | - /** |
|
72 | - * Path to the folder into which the client libraries are written. |
|
73 | - * @var string |
|
74 | - * @see Localization::setClientLibrariesFolder() |
|
75 | - */ |
|
71 | + /** |
|
72 | + * Path to the folder into which the client libraries are written. |
|
73 | + * @var string |
|
74 | + * @see Localization::setClientLibrariesFolder() |
|
75 | + */ |
|
76 | 76 | protected static $clientFolder = ''; |
77 | 77 | |
78 | - /** |
|
79 | - * If this key changes, client libraries are refreshed. |
|
80 | - * @var string |
|
81 | - * @see Localization::setClientLibrariesCacheKey() |
|
82 | - */ |
|
78 | + /** |
|
79 | + * If this key changes, client libraries are refreshed. |
|
80 | + * @var string |
|
81 | + * @see Localization::setClientLibrariesCacheKey() |
|
82 | + */ |
|
83 | 83 | protected static $clientCacheKey = ''; |
84 | 84 | |
85 | - /** |
|
86 | - * Whether the configuration has been made. |
|
87 | - * @var bool |
|
88 | - * @see Localization::configure() |
|
89 | - */ |
|
85 | + /** |
|
86 | + * Whether the configuration has been made. |
|
87 | + * @var bool |
|
88 | + * @see Localization::configure() |
|
89 | + */ |
|
90 | 90 | protected static $configured = false; |
91 | 91 | |
92 | - /** |
|
93 | - * Stores event listener instances. |
|
94 | - * @var array |
|
95 | - */ |
|
92 | + /** |
|
93 | + * Stores event listener instances. |
|
94 | + * @var array |
|
95 | + */ |
|
96 | 96 | protected static $listeners = array(); |
97 | 97 | |
98 | - /** |
|
99 | - * @var integer |
|
100 | - * @see Localization::addEventListener() |
|
101 | - */ |
|
98 | + /** |
|
99 | + * @var integer |
|
100 | + * @see Localization::addEventListener() |
|
101 | + */ |
|
102 | 102 | protected static $listenersCounter = 0; |
103 | 103 | |
104 | - /** |
|
105 | - * @var Localization_Translator|NULL |
|
106 | - */ |
|
104 | + /** |
|
105 | + * @var Localization_Translator|NULL |
|
106 | + */ |
|
107 | 107 | protected static $translator; |
108 | 108 | |
109 | - /** |
|
110 | - * Initializes the localization layer. This is done |
|
111 | - * automatically, and only once per request. |
|
112 | - * |
|
113 | - * (Called at the end of this file) |
|
114 | - */ |
|
109 | + /** |
|
110 | + * Initializes the localization layer. This is done |
|
111 | + * automatically, and only once per request. |
|
112 | + * |
|
113 | + * (Called at the end of this file) |
|
114 | + */ |
|
115 | 115 | public static function init() : void |
116 | 116 | { |
117 | 117 | if(self::$initDone) { |
@@ -150,12 +150,12 @@ discard block |
||
150 | 150 | return self::getLocalesByNS(self::NAMESPACE_APPLICATION); |
151 | 151 | } |
152 | 152 | |
153 | - /** |
|
154 | - * Retrieves all locales in the specified namespace. |
|
155 | - * |
|
156 | - * @param string $namespace |
|
157 | - * @return Localization_Locale[] |
|
158 | - */ |
|
153 | + /** |
|
154 | + * Retrieves all locales in the specified namespace. |
|
155 | + * |
|
156 | + * @param string $namespace |
|
157 | + * @return Localization_Locale[] |
|
158 | + */ |
|
159 | 159 | public static function getLocalesByNS(string $namespace) |
160 | 160 | { |
161 | 161 | if(isset(self::$locales[$namespace])) { |
@@ -172,35 +172,35 @@ discard block |
||
172 | 172 | ); |
173 | 173 | } |
174 | 174 | |
175 | - /** |
|
176 | - * Adds an application locale to use in the application. |
|
177 | - * |
|
178 | - * @param string $localeName |
|
179 | - * @return Localization_Locale |
|
180 | - */ |
|
175 | + /** |
|
176 | + * Adds an application locale to use in the application. |
|
177 | + * |
|
178 | + * @param string $localeName |
|
179 | + * @return Localization_Locale |
|
180 | + */ |
|
181 | 181 | public static function addAppLocale(string $localeName) : Localization_Locale |
182 | 182 | { |
183 | 183 | return self::addLocaleByNS($localeName, self::NAMESPACE_APPLICATION); |
184 | 184 | } |
185 | 185 | |
186 | - /** |
|
187 | - * Adds a content locale to use for content in the application. |
|
188 | - * |
|
189 | - * @param string $localeName |
|
190 | - * @return Localization_Locale |
|
191 | - */ |
|
186 | + /** |
|
187 | + * Adds a content locale to use for content in the application. |
|
188 | + * |
|
189 | + * @param string $localeName |
|
190 | + * @return Localization_Locale |
|
191 | + */ |
|
192 | 192 | public static function addContentLocale(string $localeName) : Localization_Locale |
193 | 193 | { |
194 | 194 | return self::addLocaleByNS($localeName, self::NAMESPACE_CONTENT); |
195 | 195 | } |
196 | 196 | |
197 | - /** |
|
198 | - * Adds a locale to the specified namespace. |
|
199 | - * |
|
200 | - * @param string $localeName |
|
201 | - * @param string $namespace |
|
202 | - * @return Localization_Locale |
|
203 | - */ |
|
197 | + /** |
|
198 | + * Adds a locale to the specified namespace. |
|
199 | + * |
|
200 | + * @param string $localeName |
|
201 | + * @param string $namespace |
|
202 | + * @return Localization_Locale |
|
203 | + */ |
|
204 | 204 | public static function addLocaleByNS(string $localeName, string $namespace) : Localization_Locale |
205 | 205 | { |
206 | 206 | if(!isset(self::$locales[$namespace])) { |
@@ -242,11 +242,11 @@ discard block |
||
242 | 242 | return new $className(); |
243 | 243 | } |
244 | 244 | |
245 | - /** |
|
246 | - * Retrieves the currency of the selected app locale. |
|
247 | - * |
|
248 | - * @return Localization_Currency |
|
249 | - */ |
|
245 | + /** |
|
246 | + * Retrieves the currency of the selected app locale. |
|
247 | + * |
|
248 | + * @return Localization_Currency |
|
249 | + */ |
|
250 | 250 | public static function getAppCurrency() : Localization_Currency |
251 | 251 | { |
252 | 252 | return self::getCurrencyNS(self::NAMESPACE_APPLICATION); |
@@ -283,44 +283,44 @@ discard block |
||
283 | 283 | return self::getSelectedLocaleByNS(self::NAMESPACE_APPLICATION); |
284 | 284 | } |
285 | 285 | |
286 | - /** |
|
287 | - * Retrieves the name of the selected application locale. |
|
288 | - * |
|
289 | - * @return string |
|
290 | - */ |
|
286 | + /** |
|
287 | + * Retrieves the name of the selected application locale. |
|
288 | + * |
|
289 | + * @return string |
|
290 | + */ |
|
291 | 291 | public static function getAppLocaleName() : string |
292 | 292 | { |
293 | 293 | return self::getLocaleNameByNS(self::NAMESPACE_APPLICATION); |
294 | 294 | } |
295 | 295 | |
296 | - /** |
|
297 | - * Retrieves the names of the available application locales. |
|
298 | - * @return string[] |
|
299 | - */ |
|
296 | + /** |
|
297 | + * Retrieves the names of the available application locales. |
|
298 | + * @return string[] |
|
299 | + */ |
|
300 | 300 | public static function getAppLocaleNames() : array |
301 | 301 | { |
302 | 302 | return self::getLocaleNamesByNS(self::NAMESPACE_APPLICATION); |
303 | 303 | } |
304 | 304 | |
305 | - /** |
|
306 | - * Retrieves the selected locale name in the specified namespace. |
|
307 | - * |
|
308 | - * @param string $namespace |
|
309 | - * @throws Localization_Exception |
|
310 | - * @return string |
|
311 | - */ |
|
305 | + /** |
|
306 | + * Retrieves the selected locale name in the specified namespace. |
|
307 | + * |
|
308 | + * @param string $namespace |
|
309 | + * @throws Localization_Exception |
|
310 | + * @return string |
|
311 | + */ |
|
312 | 312 | public static function getLocaleNameByNS(string $namespace) : string |
313 | 313 | { |
314 | 314 | return self::getSelectedLocaleByNS($namespace)->getName(); |
315 | 315 | } |
316 | 316 | |
317 | - /** |
|
318 | - * Retrieves the selected locale instance for the specified namespace. |
|
319 | - * |
|
320 | - * @param string $namespace |
|
321 | - * @return Localization_Locale |
|
322 | - * @throws Localization_Exception |
|
323 | - */ |
|
317 | + /** |
|
318 | + * Retrieves the selected locale instance for the specified namespace. |
|
319 | + * |
|
320 | + * @param string $namespace |
|
321 | + * @return Localization_Locale |
|
322 | + * @throws Localization_Exception |
|
323 | + */ |
|
324 | 324 | public static function getSelectedLocaleByNS(string $namespace) : Localization_Locale |
325 | 325 | { |
326 | 326 | self::requireNamespace($namespace); |
@@ -339,24 +339,24 @@ discard block |
||
339 | 339 | ); |
340 | 340 | } |
341 | 341 | |
342 | - /** |
|
343 | - * Stores the selected locale names by namespace. |
|
344 | - * @var array<string,Localization_Locale> |
|
345 | - */ |
|
342 | + /** |
|
343 | + * Stores the selected locale names by namespace. |
|
344 | + * @var array<string,Localization_Locale> |
|
345 | + */ |
|
346 | 346 | protected static $selected = array(); |
347 | 347 | |
348 | - /** |
|
349 | - * Selects the active locale for the specified namespace. |
|
350 | - * |
|
351 | - * NOTE: Triggers the "LocaleChanged" event. |
|
352 | - * |
|
353 | - * @param string $localeName |
|
354 | - * @param string $namespace |
|
355 | - * @return Localization_Locale |
|
356 | - * @throws Localization_Exception |
|
357 | - * |
|
358 | - * @see Localization_Event_LocaleChanged |
|
359 | - */ |
|
348 | + /** |
|
349 | + * Selects the active locale for the specified namespace. |
|
350 | + * |
|
351 | + * NOTE: Triggers the "LocaleChanged" event. |
|
352 | + * |
|
353 | + * @param string $localeName |
|
354 | + * @param string $namespace |
|
355 | + * @return Localization_Locale |
|
356 | + * @throws Localization_Exception |
|
357 | + * |
|
358 | + * @see Localization_Event_LocaleChanged |
|
359 | + */ |
|
360 | 360 | public static function selectLocaleByNS(string $localeName, string $namespace) : Localization_Locale |
361 | 361 | { |
362 | 362 | self::requireNamespace($namespace); |
@@ -487,15 +487,15 @@ discard block |
||
487 | 487 | return self::selectLocaleByNS($localeName, self::NAMESPACE_APPLICATION); |
488 | 488 | } |
489 | 489 | |
490 | - /** |
|
491 | - * Retrieves an application locale by its name. |
|
492 | - * Note that the locale must have been added first. |
|
493 | - * |
|
494 | - * @param string $localeName |
|
495 | - * @throws Localization_Exception |
|
496 | - * @return Localization_Locale |
|
497 | - * @see Localization::appLocaleExists() |
|
498 | - */ |
|
490 | + /** |
|
491 | + * Retrieves an application locale by its name. |
|
492 | + * Note that the locale must have been added first. |
|
493 | + * |
|
494 | + * @param string $localeName |
|
495 | + * @throws Localization_Exception |
|
496 | + * @return Localization_Locale |
|
497 | + * @see Localization::appLocaleExists() |
|
498 | + */ |
|
499 | 499 | public static function getAppLocaleByName(string $localeName) : Localization_Locale |
500 | 500 | { |
501 | 501 | return self::getLocaleByNameNS($localeName, self::NAMESPACE_APPLICATION); |
@@ -530,10 +530,10 @@ discard block |
||
530 | 530 | return self::getLocalesByNS(self::NAMESPACE_CONTENT); |
531 | 531 | } |
532 | 532 | |
533 | - /** |
|
534 | - * Retrieves the names of all content locales that have been added. |
|
535 | - * @return string[] |
|
536 | - */ |
|
533 | + /** |
|
534 | + * Retrieves the names of all content locales that have been added. |
|
535 | + * @return string[] |
|
536 | + */ |
|
537 | 537 | public static function getContentLocaleNames() |
538 | 538 | { |
539 | 539 | return self::getLocaleNamesByNS(self::NAMESPACE_CONTENT); |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | sort($names); |
557 | 557 | |
558 | 558 | return $names; |
559 | - } |
|
559 | + } |
|
560 | 560 | |
561 | 561 | /** |
562 | 562 | * Checks by the locale name if the specified locale is |
@@ -585,14 +585,14 @@ discard block |
||
585 | 585 | return self::getLocaleByNameNS($localeName, self::NAMESPACE_CONTENT); |
586 | 586 | } |
587 | 587 | |
588 | - /** |
|
589 | - * Retrieves a locale by its name in the specified namespace. |
|
590 | - * |
|
591 | - * @param string $localeName |
|
592 | - * @param string $namespace |
|
593 | - * @throws Localization_Exception |
|
594 | - * @return Localization_Locale |
|
595 | - */ |
|
588 | + /** |
|
589 | + * Retrieves a locale by its name in the specified namespace. |
|
590 | + * |
|
591 | + * @param string $localeName |
|
592 | + * @param string $namespace |
|
593 | + * @throws Localization_Exception |
|
594 | + * @return Localization_Locale |
|
595 | + */ |
|
596 | 596 | public static function getLocaleByNameNS(string $localeName, string $namespace) : Localization_Locale |
597 | 597 | { |
598 | 598 | self::requireNamespace($namespace); |
@@ -663,10 +663,10 @@ discard block |
||
663 | 663 | return self::selectLocaleByNS($localeName, self::NAMESPACE_CONTENT); |
664 | 664 | } |
665 | 665 | |
666 | - /** |
|
667 | - * Checks whether the localization has been configured entirely. |
|
668 | - * @return bool |
|
669 | - */ |
|
666 | + /** |
|
667 | + * Checks whether the localization has been configured entirely. |
|
668 | + * @return bool |
|
669 | + */ |
|
670 | 670 | public static function isConfigured() : bool |
671 | 671 | { |
672 | 672 | return self::$configured; |
@@ -738,29 +738,29 @@ discard block |
||
738 | 738 | ); |
739 | 739 | } |
740 | 740 | |
741 | - /** |
|
742 | - * Injects a content locales selector element into the specified |
|
743 | - * HTML QuickForm2 container. |
|
744 | - * |
|
745 | - * @param string $elementName |
|
746 | - * @param HTML_QuickForm2_Container $container |
|
747 | - * @param string $label |
|
748 | - * @return HTML_QuickForm2_Element_Select |
|
749 | - */ |
|
741 | + /** |
|
742 | + * Injects a content locales selector element into the specified |
|
743 | + * HTML QuickForm2 container. |
|
744 | + * |
|
745 | + * @param string $elementName |
|
746 | + * @param HTML_QuickForm2_Container $container |
|
747 | + * @param string $label |
|
748 | + * @return HTML_QuickForm2_Element_Select |
|
749 | + */ |
|
750 | 750 | public static function injectContentLocalesSelector(string $elementName, HTML_QuickForm2_Container $container, string $label='') : HTML_QuickForm2_Element_Select |
751 | 751 | { |
752 | 752 | return self::injectLocalesSelectorNS($elementName, self::NAMESPACE_CONTENT, $container, $label); |
753 | 753 | } |
754 | 754 | |
755 | - /** |
|
756 | - * Injects an app locales selector element into the specified |
|
755 | + /** |
|
756 | + * Injects an app locales selector element into the specified |
|
757 | 757 | * HTML QuickForm2 container. |
758 | 758 | * |
759 | - * @param string $elementName |
|
760 | - * @param HTML_QuickForm2_Container $container |
|
761 | - * @param string $label |
|
762 | - * @return HTML_QuickForm2_Element_Select |
|
763 | - */ |
|
759 | + * @param string $elementName |
|
760 | + * @param HTML_QuickForm2_Container $container |
|
761 | + * @param string $label |
|
762 | + * @return HTML_QuickForm2_Element_Select |
|
763 | + */ |
|
764 | 764 | public static function injectAppLocalesSelector(string $elementName, HTML_QuickForm2_Container $container, string $label='') : HTML_QuickForm2_Element_Select |
765 | 765 | { |
766 | 766 | return self::injectLocalesSelectorNS($elementName, self::NAMESPACE_APPLICATION, $container, $label); |
@@ -796,26 +796,26 @@ discard block |
||
796 | 796 | return $select; |
797 | 797 | } |
798 | 798 | |
799 | - /** |
|
800 | - * @var Localization_Source[] |
|
801 | - */ |
|
799 | + /** |
|
800 | + * @var Localization_Source[] |
|
801 | + */ |
|
802 | 802 | protected static $sources = array(); |
803 | 803 | |
804 | - /** |
|
805 | - * @var string[] |
|
806 | - */ |
|
804 | + /** |
|
805 | + * @var string[] |
|
806 | + */ |
|
807 | 807 | protected static $excludeFolders = array(); |
808 | 808 | |
809 | - /** |
|
810 | - * @var string[] |
|
811 | - */ |
|
809 | + /** |
|
810 | + * @var string[] |
|
811 | + */ |
|
812 | 812 | protected static $excludeFiles = array(); |
813 | 813 | |
814 | - /** |
|
815 | - * Retrieves all currently available sources. |
|
816 | - * |
|
817 | - * @return Localization_Source[] |
|
818 | - */ |
|
814 | + /** |
|
815 | + * Retrieves all currently available sources. |
|
816 | + * |
|
817 | + * @return Localization_Source[] |
|
818 | + */ |
|
819 | 819 | public static function getSources() : array |
820 | 820 | { |
821 | 821 | return self::$sources; |
@@ -847,10 +847,10 @@ discard block |
||
847 | 847 | return $source; |
848 | 848 | } |
849 | 849 | |
850 | - /** |
|
851 | - * Retrieves all sources grouped by their group name. |
|
852 | - * @return array |
|
853 | - */ |
|
850 | + /** |
|
851 | + * Retrieves all sources grouped by their group name. |
|
852 | + * @return array |
|
853 | + */ |
|
854 | 854 | public static function getSourcesGrouped() |
855 | 855 | { |
856 | 856 | $sources = self::getSources(); |
@@ -871,11 +871,11 @@ discard block |
||
871 | 871 | return $grouped; |
872 | 872 | } |
873 | 873 | |
874 | - /** |
|
875 | - * Checks whether a specific source exists by its ID. |
|
876 | - * @param string $sourceID |
|
877 | - * @return boolean |
|
878 | - */ |
|
874 | + /** |
|
875 | + * Checks whether a specific source exists by its ID. |
|
876 | + * @param string $sourceID |
|
877 | + * @return boolean |
|
878 | + */ |
|
879 | 879 | public static function sourceExists(string $sourceID) : bool |
880 | 880 | { |
881 | 881 | $sources = self::getSources(); |
@@ -888,11 +888,11 @@ discard block |
||
888 | 888 | return false; |
889 | 889 | } |
890 | 890 | |
891 | - /** |
|
892 | - * Checks whether a specific source exists by its alias. |
|
893 | - * @param string $sourceAlias |
|
894 | - * @return boolean |
|
895 | - */ |
|
891 | + /** |
|
892 | + * Checks whether a specific source exists by its alias. |
|
893 | + * @param string $sourceAlias |
|
894 | + * @return boolean |
|
895 | + */ |
|
896 | 896 | public static function sourceAliasExists(string $sourceAlias) : bool |
897 | 897 | { |
898 | 898 | $sources = self::getSources(); |
@@ -905,13 +905,13 @@ discard block |
||
905 | 905 | return false; |
906 | 906 | } |
907 | 907 | |
908 | - /** |
|
909 | - * Retrieves a localization source by its ID. |
|
910 | - * |
|
911 | - * @param string $sourceID |
|
912 | - * @throws Localization_Exception |
|
913 | - * @return Localization_Source |
|
914 | - */ |
|
908 | + /** |
|
909 | + * Retrieves a localization source by its ID. |
|
910 | + * |
|
911 | + * @param string $sourceID |
|
912 | + * @throws Localization_Exception |
|
913 | + * @return Localization_Source |
|
914 | + */ |
|
915 | 915 | public static function getSourceByID(string $sourceID) : Localization_Source |
916 | 916 | { |
917 | 917 | $sources = self::getSources(); |
@@ -976,14 +976,14 @@ discard block |
||
976 | 976 | // FIXME: TODO: Add this |
977 | 977 | } |
978 | 978 | |
979 | - /** |
|
980 | - * Configures the localization for the application: |
|
981 | - * sets the location of the required files and folders. |
|
982 | - * Also updated the client library files as needed. |
|
983 | - * |
|
984 | - * @param string $storageFile Where to store the file analysis storage file. |
|
985 | - * @param string $clientLibrariesFolder Where to put the client libraries and translation files. Will be created if it does not exist. Optional: if not set, client libraries will not be created. |
|
986 | - */ |
|
979 | + /** |
|
980 | + * Configures the localization for the application: |
|
981 | + * sets the location of the required files and folders. |
|
982 | + * Also updated the client library files as needed. |
|
983 | + * |
|
984 | + * @param string $storageFile Where to store the file analysis storage file. |
|
985 | + * @param string $clientLibrariesFolder Where to put the client libraries and translation files. Will be created if it does not exist. Optional: if not set, client libraries will not be created. |
|
986 | + */ |
|
987 | 987 | public static function configure(string $storageFile, string $clientLibrariesFolder='') : void |
988 | 988 | { |
989 | 989 | self::$configured = true; |
@@ -999,17 +999,17 @@ discard block |
||
999 | 999 | } |
1000 | 1000 | } |
1001 | 1001 | |
1002 | - /** |
|
1003 | - * Sets a key that is used to verify whether the client |
|
1004 | - * libraries have to be refreshed. A common use is to set |
|
1005 | - * this to the application's version number to guarantee |
|
1006 | - * new texts are automatically used with each release. |
|
1007 | - * |
|
1008 | - * NOTE: Otherwise files are refreshed only when saving |
|
1009 | - * them in the editor UI. |
|
1010 | - * |
|
1011 | - * @param string $key |
|
1012 | - */ |
|
1002 | + /** |
|
1003 | + * Sets a key that is used to verify whether the client |
|
1004 | + * libraries have to be refreshed. A common use is to set |
|
1005 | + * this to the application's version number to guarantee |
|
1006 | + * new texts are automatically used with each release. |
|
1007 | + * |
|
1008 | + * NOTE: Otherwise files are refreshed only when saving |
|
1009 | + * them in the editor UI. |
|
1010 | + * |
|
1011 | + * @param string $key |
|
1012 | + */ |
|
1013 | 1013 | public static function setClientLibrariesCacheKey(string $key) : void |
1014 | 1014 | { |
1015 | 1015 | self::$clientCacheKey = $key; |
@@ -1020,23 +1020,23 @@ discard block |
||
1020 | 1020 | return self::$clientCacheKey; |
1021 | 1021 | } |
1022 | 1022 | |
1023 | - /** |
|
1024 | - * Sets the folder where client libraries are to be stored. |
|
1025 | - * @param string $folder |
|
1026 | - */ |
|
1023 | + /** |
|
1024 | + * Sets the folder where client libraries are to be stored. |
|
1025 | + * @param string $folder |
|
1026 | + */ |
|
1027 | 1027 | public static function setClientLibrariesFolder(string $folder) : void |
1028 | 1028 | { |
1029 | 1029 | self::$clientFolder = $folder; |
1030 | 1030 | } |
1031 | 1031 | |
1032 | - /** |
|
1033 | - * Retrieves the path to the folder in which the client |
|
1034 | - * libraries should be stored. |
|
1035 | - * |
|
1036 | - * NOTE: Can return an empty string, when this is disabled. |
|
1037 | - * |
|
1038 | - * @return string |
|
1039 | - */ |
|
1032 | + /** |
|
1033 | + * Retrieves the path to the folder in which the client |
|
1034 | + * libraries should be stored. |
|
1035 | + * |
|
1036 | + * NOTE: Can return an empty string, when this is disabled. |
|
1037 | + * |
|
1038 | + * @return string |
|
1039 | + */ |
|
1040 | 1040 | public static function getClientLibrariesFolder() : string |
1041 | 1041 | { |
1042 | 1042 | return self::$clientFolder; |
@@ -1056,13 +1056,13 @@ discard block |
||
1056 | 1056 | self::createGenerator()->writeFiles($force); |
1057 | 1057 | } |
1058 | 1058 | |
1059 | - /** |
|
1060 | - * Creates a new instance of the client generator class |
|
1061 | - * that is used to write the localization files into the |
|
1062 | - * target folder on disk. |
|
1063 | - * |
|
1064 | - * @return Localization_ClientGenerator |
|
1065 | - */ |
|
1059 | + /** |
|
1060 | + * Creates a new instance of the client generator class |
|
1061 | + * that is used to write the localization files into the |
|
1062 | + * target folder on disk. |
|
1063 | + * |
|
1064 | + * @return Localization_ClientGenerator |
|
1065 | + */ |
|
1066 | 1066 | public static function createGenerator() : Localization_ClientGenerator |
1067 | 1067 | { |
1068 | 1068 | return new Localization_ClientGenerator(); |
@@ -1127,10 +1127,10 @@ discard block |
||
1127 | 1127 | return new Localization_Editor(); |
1128 | 1128 | } |
1129 | 1129 | |
1130 | - /** |
|
1131 | - * Retrieves a list of all available source IDs. |
|
1132 | - * @return string[] |
|
1133 | - */ |
|
1130 | + /** |
|
1131 | + * Retrieves a list of all available source IDs. |
|
1132 | + * @return string[] |
|
1133 | + */ |
|
1134 | 1134 | public static function getSourceIDs() : array |
1135 | 1135 | { |
1136 | 1136 | $ids = array(); |
@@ -1157,9 +1157,9 @@ discard block |
||
1157 | 1157 | return $aliases; |
1158 | 1158 | } |
1159 | 1159 | |
1160 | - /** |
|
1161 | - * Resets all locales to the built-in locale. |
|
1162 | - */ |
|
1160 | + /** |
|
1161 | + * Resets all locales to the built-in locale. |
|
1162 | + */ |
|
1163 | 1163 | public static function reset() : void |
1164 | 1164 | { |
1165 | 1165 | self::$locales = array(); |
@@ -1191,22 +1191,22 @@ discard block |
||
1191 | 1191 | 'de_CH' |
1192 | 1192 | ); |
1193 | 1193 | |
1194 | - /** |
|
1195 | - * Retrieves a list of all supported locales. |
|
1196 | - * |
|
1197 | - * @return string[] |
|
1198 | - */ |
|
1194 | + /** |
|
1195 | + * Retrieves a list of all supported locales. |
|
1196 | + * |
|
1197 | + * @return string[] |
|
1198 | + */ |
|
1199 | 1199 | public static function getSupportedLocaleNames() : array |
1200 | 1200 | { |
1201 | 1201 | return self::$supportedLocales; |
1202 | 1202 | } |
1203 | 1203 | |
1204 | - /** |
|
1205 | - * Checks whether the specified locale is supported. |
|
1206 | - * |
|
1207 | - * @param string $localeName |
|
1208 | - * @return bool |
|
1209 | - */ |
|
1204 | + /** |
|
1205 | + * Checks whether the specified locale is supported. |
|
1206 | + * |
|
1207 | + * @param string $localeName |
|
1208 | + * @return bool |
|
1209 | + */ |
|
1210 | 1210 | public static function isLocaleSupported(string $localeName) : bool |
1211 | 1211 | { |
1212 | 1212 | return in_array($localeName, self::$supportedLocales); |
@@ -9,24 +9,24 @@ |
||
9 | 9 | |
10 | 10 | class Localization_Source_Folder extends Localization_Source |
11 | 11 | { |
12 | - /** |
|
13 | - * The folder under which all translatable files are kept. |
|
14 | - * @var string |
|
15 | - */ |
|
12 | + /** |
|
13 | + * The folder under which all translatable files are kept. |
|
14 | + * @var string |
|
15 | + */ |
|
16 | 16 | protected $sourcesFolder; |
17 | 17 | |
18 | - /** |
|
19 | - * @var string |
|
20 | - */ |
|
18 | + /** |
|
19 | + * @var string |
|
20 | + */ |
|
21 | 21 | protected $id; |
22 | 22 | |
23 | - /** |
|
24 | - * @param string $alias An alias for this source, to recognize it by. |
|
25 | - * @param string $label The human-readable label, used in the editor. |
|
26 | - * @param string $group A human-readable group label to group several sources by. Used in the editor. |
|
27 | - * @param string $storageFolder The folder in which to store the localization files. |
|
28 | - * @param string $sourcesFolder The folder in which to analyze files to find translatable strings. |
|
29 | - */ |
|
23 | + /** |
|
24 | + * @param string $alias An alias for this source, to recognize it by. |
|
25 | + * @param string $label The human-readable label, used in the editor. |
|
26 | + * @param string $group A human-readable group label to group several sources by. Used in the editor. |
|
27 | + * @param string $storageFolder The folder in which to store the localization files. |
|
28 | + * @param string $sourcesFolder The folder in which to analyze files to find translatable strings. |
|
29 | + */ |
|
30 | 30 | public function __construct(string $alias, string $label, string $group, string $storageFolder, string $sourcesFolder) |
31 | 31 | { |
32 | 32 | parent::__construct($alias, $label, $group, $storageFolder); |
@@ -6,39 +6,39 @@ |
||
6 | 6 | |
7 | 7 | abstract class Localization_Source |
8 | 8 | { |
9 | - /** |
|
10 | - * Human-readable label for the source. |
|
11 | - * @var string |
|
12 | - */ |
|
9 | + /** |
|
10 | + * Human-readable label for the source. |
|
11 | + * @var string |
|
12 | + */ |
|
13 | 13 | protected $label; |
14 | 14 | |
15 | - /** |
|
16 | - * Human-readable group name to categorize the source. |
|
17 | - * @var string |
|
18 | - */ |
|
15 | + /** |
|
16 | + * Human-readable group name to categorize the source. |
|
17 | + * @var string |
|
18 | + */ |
|
19 | 19 | protected $group; |
20 | 20 | |
21 | - /** |
|
22 | - * The folder in which the localization files are stored |
|
23 | - * @var string |
|
24 | - */ |
|
21 | + /** |
|
22 | + * The folder in which the localization files are stored |
|
23 | + * @var string |
|
24 | + */ |
|
25 | 25 | protected $storageFolder; |
26 | 26 | |
27 | - /** |
|
28 | - * @var string |
|
29 | - */ |
|
27 | + /** |
|
28 | + * @var string |
|
29 | + */ |
|
30 | 30 | protected $alias; |
31 | 31 | |
32 | - /** |
|
33 | - * Available during scanning. |
|
34 | - * @var Localization_Scanner_StringsCollection|NULL |
|
35 | - */ |
|
32 | + /** |
|
33 | + * Available during scanning. |
|
34 | + * @var Localization_Scanner_StringsCollection|NULL |
|
35 | + */ |
|
36 | 36 | protected $collection; |
37 | 37 | |
38 | - /** |
|
39 | - * Available during scanning. |
|
40 | - * @var Localization_Parser|NULL |
|
41 | - */ |
|
38 | + /** |
|
39 | + * Available during scanning. |
|
40 | + * @var Localization_Parser|NULL |
|
41 | + */ |
|
42 | 42 | protected $parser; |
43 | 43 | |
44 | 44 | public function __construct(string $alias, string $label, string $group, string $storageFolder) |
@@ -30,14 +30,14 @@ discard block |
||
30 | 30 | const ERROR_UNSUPPORTED_FILE_EXTENSION = 40602; |
31 | 31 | const ERROR_INVALID_LANGUAGE_CLASS = 40603; |
32 | 32 | |
33 | - /** |
|
34 | - * @var Localization_Scanner |
|
35 | - */ |
|
33 | + /** |
|
34 | + * @var Localization_Scanner |
|
35 | + */ |
|
36 | 36 | protected $scanner; |
37 | 37 | |
38 | - /** |
|
39 | - * @var Localization_Scanner_StringsCollection |
|
40 | - */ |
|
38 | + /** |
|
39 | + * @var Localization_Scanner_StringsCollection |
|
40 | + */ |
|
41 | 41 | protected $collection; |
42 | 42 | |
43 | 43 | /** |
@@ -54,15 +54,15 @@ discard block |
||
54 | 54 | $this->collection = $scanner->getCollection(); |
55 | 55 | } |
56 | 56 | |
57 | - /** |
|
58 | - * Parses a source file. Must have a valid supported file extension. |
|
59 | - * |
|
60 | - * @param string $path |
|
61 | - * @return Localization_Parser_Language |
|
62 | - * @throws Localization_Exception |
|
63 | - * |
|
64 | - * @see Localization_Parser::ERROR_UNSUPPORTED_FILE_EXTENSION |
|
65 | - */ |
|
57 | + /** |
|
58 | + * Parses a source file. Must have a valid supported file extension. |
|
59 | + * |
|
60 | + * @param string $path |
|
61 | + * @return Localization_Parser_Language |
|
62 | + * @throws Localization_Exception |
|
63 | + * |
|
64 | + * @see Localization_Parser::ERROR_UNSUPPORTED_FILE_EXTENSION |
|
65 | + */ |
|
66 | 66 | public function parseFile(string $path) : Localization_Parser_Language |
67 | 67 | { |
68 | 68 | $this->requireValidFile($path); |
@@ -76,16 +76,16 @@ discard block |
||
76 | 76 | return $language; |
77 | 77 | } |
78 | 78 | |
79 | - /** |
|
80 | - * Parses the string for the specified language. |
|
81 | - * |
|
82 | - * @param string $languageID |
|
83 | - * @param string $code |
|
84 | - * @return Localization_Parser_Language |
|
85 | - * @throws Localization_Exception |
|
86 | - * |
|
87 | - * @see Localization_Parser::ERROR_INVALID_LANGUAGE_ID |
|
88 | - */ |
|
79 | + /** |
|
80 | + * Parses the string for the specified language. |
|
81 | + * |
|
82 | + * @param string $languageID |
|
83 | + * @param string $code |
|
84 | + * @return Localization_Parser_Language |
|
85 | + * @throws Localization_Exception |
|
86 | + * |
|
87 | + * @see Localization_Parser::ERROR_INVALID_LANGUAGE_ID |
|
88 | + */ |
|
89 | 89 | public function parseString(string $languageID, string $code) : Localization_Parser_Language |
90 | 90 | { |
91 | 91 | $this->requireValidLanguageID($languageID); |
@@ -144,18 +144,18 @@ discard block |
||
144 | 144 | ); |
145 | 145 | } |
146 | 146 | |
147 | - /** |
|
148 | - * Retrieves a list of all language IDs that are supported. |
|
149 | - * @return string[] IDs list like "PHP", "Javascript" |
|
150 | - */ |
|
147 | + /** |
|
148 | + * Retrieves a list of all language IDs that are supported. |
|
149 | + * @return string[] IDs list like "PHP", "Javascript" |
|
150 | + */ |
|
151 | 151 | public function getLanguageIDs() : array |
152 | 152 | { |
153 | 153 | return array_values($this->languageMappings); |
154 | 154 | } |
155 | 155 | |
156 | - /** |
|
157 | - * @var array<string,Localization_Parser_Language> |
|
158 | - */ |
|
156 | + /** |
|
157 | + * @var array<string,Localization_Parser_Language> |
|
158 | + */ |
|
159 | 159 | protected $languageParsers = array(); |
160 | 160 | |
161 | 161 | /** |
@@ -209,12 +209,12 @@ discard block |
||
209 | 209 | ); |
210 | 210 | } |
211 | 211 | |
212 | - /** |
|
213 | - * Whether the specified file extension is supported. |
|
214 | - * |
|
215 | - * @param string $ext |
|
216 | - * @return bool |
|
217 | - */ |
|
212 | + /** |
|
213 | + * Whether the specified file extension is supported. |
|
214 | + * |
|
215 | + * @param string $ext |
|
216 | + * @return bool |
|
217 | + */ |
|
218 | 218 | public function isExtensionSupported(string $ext) : bool |
219 | 219 | { |
220 | 220 | $ext = strtolower($ext); |