@@ -23,49 +23,49 @@ discard block |
||
23 | 23 | */ |
24 | 24 | protected $parser; |
25 | 25 | |
26 | - /** |
|
27 | - * The function names that are included in the search. |
|
28 | - * @var array |
|
29 | - */ |
|
26 | + /** |
|
27 | + * The function names that are included in the search. |
|
28 | + * @var array |
|
29 | + */ |
|
30 | 30 | protected $functionNames = array(); |
31 | 31 | |
32 | - /** |
|
33 | - * The tokens definitions. |
|
34 | - * @var array |
|
35 | - */ |
|
32 | + /** |
|
33 | + * The tokens definitions. |
|
34 | + * @var array |
|
35 | + */ |
|
36 | 36 | protected $tokens = array(); |
37 | 37 | |
38 | - /** |
|
39 | - * The total amount of tokens found in the content. |
|
40 | - * @var integer |
|
41 | - */ |
|
38 | + /** |
|
39 | + * The total amount of tokens found in the content. |
|
40 | + * @var integer |
|
41 | + */ |
|
42 | 42 | protected $totalTokens = 0; |
43 | 43 | |
44 | - /** |
|
45 | - * All texts that have been collected. |
|
46 | - * @var Text[] |
|
47 | - */ |
|
44 | + /** |
|
45 | + * All texts that have been collected. |
|
46 | + * @var Text[] |
|
47 | + */ |
|
48 | 48 | protected $texts = array(); |
49 | 49 | |
50 | - /** |
|
51 | - * @var string |
|
52 | - */ |
|
50 | + /** |
|
51 | + * @var string |
|
52 | + */ |
|
53 | 53 | protected $content = ''; |
54 | 54 | |
55 | - /** |
|
56 | - * @var string|NULL |
|
57 | - */ |
|
55 | + /** |
|
56 | + * @var string|NULL |
|
57 | + */ |
|
58 | 58 | protected $id; |
59 | 59 | |
60 | - /** |
|
61 | - * @var Localization_Parser_Warning[] |
|
62 | - */ |
|
60 | + /** |
|
61 | + * @var Localization_Parser_Warning[] |
|
62 | + */ |
|
63 | 63 | protected $warnings = array(); |
64 | 64 | |
65 | - /** |
|
66 | - * The source file that was parsed (if any) |
|
67 | - * @var string |
|
68 | - */ |
|
65 | + /** |
|
66 | + * The source file that was parsed (if any) |
|
67 | + * @var string |
|
68 | + */ |
|
69 | 69 | protected $sourceFile = ''; |
70 | 70 | |
71 | 71 | /** |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | |
92 | 92 | abstract protected function getTokens() : array; |
93 | 93 | |
94 | - /** |
|
95 | - * Retrieves the ID of the language. |
|
96 | - * @return string E.g. "PHP", "Javascript" |
|
97 | - */ |
|
94 | + /** |
|
95 | + * Retrieves the ID of the language. |
|
96 | + * @return string E.g. "PHP", "Javascript" |
|
97 | + */ |
|
98 | 98 | public function getID() : string |
99 | 99 | { |
100 | 100 | if(!isset($this->id)) { |
@@ -114,12 +114,12 @@ discard block |
||
114 | 114 | return $this->sourceFile; |
115 | 115 | } |
116 | 116 | |
117 | - /** |
|
118 | - * Parses the code from a file. |
|
119 | - * |
|
120 | - * @param string $path |
|
121 | - * @throws Localization_Exception |
|
122 | - */ |
|
117 | + /** |
|
118 | + * Parses the code from a file. |
|
119 | + * |
|
120 | + * @param string $path |
|
121 | + * @throws Localization_Exception |
|
122 | + */ |
|
123 | 123 | public function parseFile(string $path) : void |
124 | 124 | { |
125 | 125 | if(!file_exists($path)) |
@@ -156,10 +156,10 @@ discard block |
||
156 | 156 | $this->parse(); |
157 | 157 | } |
158 | 158 | |
159 | - /** |
|
160 | - * Parses a source code string. |
|
161 | - * @param string $content |
|
162 | - */ |
|
159 | + /** |
|
160 | + * Parses a source code string. |
|
161 | + * @param string $content |
|
162 | + */ |
|
163 | 163 | public function parseString(string $content) : void |
164 | 164 | { |
165 | 165 | $this->content = $content; |
@@ -214,11 +214,11 @@ discard block |
||
214 | 214 | $this->texts[] = new Text($text, $line, $explanation); |
215 | 215 | } |
216 | 216 | |
217 | - /** |
|
218 | - * Retrieves a list of all the function names that are |
|
219 | - * used as translation functions in the language. |
|
220 | - * @return array |
|
221 | - */ |
|
217 | + /** |
|
218 | + * Retrieves a list of all the function names that are |
|
219 | + * used as translation functions in the language. |
|
220 | + * @return array |
|
221 | + */ |
|
222 | 222 | public function getFunctionNames() : array |
223 | 223 | { |
224 | 224 | return $this->createToken('dummy')->getFunctionNames(); |
@@ -229,13 +229,13 @@ discard block |
||
229 | 229 | Localization::log(sprintf('%1$s parser | %2$s', $this->getID(), $message)); |
230 | 230 | } |
231 | 231 | |
232 | - /** |
|
233 | - * Adds a warning message when a text cannot be parsed correctly for some reason. |
|
234 | - * |
|
235 | - * @param Localization_Parser_Token $token |
|
236 | - * @param string $message |
|
237 | - * @return Localization_Parser_Warning |
|
238 | - */ |
|
232 | + /** |
|
233 | + * Adds a warning message when a text cannot be parsed correctly for some reason. |
|
234 | + * |
|
235 | + * @param Localization_Parser_Token $token |
|
236 | + * @param string $message |
|
237 | + * @return Localization_Parser_Warning |
|
238 | + */ |
|
239 | 239 | protected function addWarning(Localization_Parser_Token $token, string $message) : Localization_Parser_Warning |
240 | 240 | { |
241 | 241 | $warning = new Localization_Parser_Warning($this, $token, $message); |
@@ -245,34 +245,34 @@ discard block |
||
245 | 245 | return $warning; |
246 | 246 | } |
247 | 247 | |
248 | - /** |
|
249 | - * Whether any warnings were generated during parsing. |
|
250 | - * @return bool |
|
251 | - */ |
|
248 | + /** |
|
249 | + * Whether any warnings were generated during parsing. |
|
250 | + * @return bool |
|
251 | + */ |
|
252 | 252 | public function hasWarnings() : bool |
253 | 253 | { |
254 | 254 | return !empty($this->warnings); |
255 | 255 | } |
256 | 256 | |
257 | - /** |
|
258 | - * Retrieves all warnings that were generated during parsing, |
|
259 | - * if any. |
|
260 | - * |
|
261 | - * @return Localization_Parser_Warning[] |
|
262 | - */ |
|
257 | + /** |
|
258 | + * Retrieves all warnings that were generated during parsing, |
|
259 | + * if any. |
|
260 | + * |
|
261 | + * @return Localization_Parser_Warning[] |
|
262 | + */ |
|
263 | 263 | public function getWarnings() : array |
264 | 264 | { |
265 | 265 | return $this->warnings; |
266 | 266 | } |
267 | 267 | |
268 | - /** |
|
269 | - * Creates a token instance: this retrieves information on |
|
270 | - * the language token being parsed. |
|
271 | - * |
|
272 | - * @param array|string $definition The token definition. |
|
273 | - * @param Localization_Parser_Token|NULL $parentToken |
|
274 | - * @return Localization_Parser_Token |
|
275 | - */ |
|
268 | + /** |
|
269 | + * Creates a token instance: this retrieves information on |
|
270 | + * the language token being parsed. |
|
271 | + * |
|
272 | + * @param array|string $definition The token definition. |
|
273 | + * @param Localization_Parser_Token|NULL $parentToken |
|
274 | + * @return Localization_Parser_Token |
|
275 | + */ |
|
276 | 276 | protected function createToken($definition, Localization_Parser_Token $parentToken=null) : Localization_Parser_Token |
277 | 277 | { |
278 | 278 | $class = Localization_Parser_Token::class.'_'.$this->getID(); |
@@ -280,12 +280,12 @@ discard block |
||
280 | 280 | return new $class($definition, $parentToken); |
281 | 281 | } |
282 | 282 | |
283 | - /** |
|
284 | - * Parses a translation function token. |
|
285 | - * |
|
286 | - * @param int $number |
|
287 | - * @param Localization_Parser_Token $token |
|
288 | - */ |
|
283 | + /** |
|
284 | + * Parses a translation function token. |
|
285 | + * |
|
286 | + * @param int $number |
|
287 | + * @param Localization_Parser_Token $token |
|
288 | + */ |
|
289 | 289 | protected function parseToken(int $number, Localization_Parser_Token $token) : void |
290 | 290 | { |
291 | 291 | $textParts = array(); |
@@ -15,19 +15,19 @@ discard block |
||
15 | 15 | */ |
16 | 16 | class Localization_Scanner_StringHash |
17 | 17 | { |
18 | - /** |
|
19 | - * @var Localization_Scanner_StringsCollection |
|
20 | - */ |
|
18 | + /** |
|
19 | + * @var Localization_Scanner_StringsCollection |
|
20 | + */ |
|
21 | 21 | protected $collection; |
22 | 22 | |
23 | - /** |
|
24 | - * @var string |
|
25 | - */ |
|
23 | + /** |
|
24 | + * @var string |
|
25 | + */ |
|
26 | 26 | protected $hash; |
27 | 27 | |
28 | - /** |
|
29 | - * @var Localization_Scanner_StringInfo[] |
|
30 | - */ |
|
28 | + /** |
|
29 | + * @var Localization_Scanner_StringInfo[] |
|
30 | + */ |
|
31 | 31 | protected $strings = array(); |
32 | 32 | |
33 | 33 | /** |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | return $entries; |
61 | 61 | } |
62 | 62 | |
63 | - /** |
|
64 | - * Retrieves all individual string locations where this text was found. |
|
65 | - * @return Localization_Scanner_StringInfo[] |
|
66 | - */ |
|
63 | + /** |
|
64 | + * Retrieves all individual string locations where this text was found. |
|
65 | + * @return Localization_Scanner_StringInfo[] |
|
66 | + */ |
|
67 | 67 | public function getStrings() : array |
68 | 68 | { |
69 | 69 | return $this->strings; |
@@ -123,10 +123,10 @@ discard block |
||
123 | 123 | return count($this->strings); |
124 | 124 | } |
125 | 125 | |
126 | - /** |
|
127 | - * Retrieves the translated text, if any. |
|
128 | - * @return string |
|
129 | - */ |
|
126 | + /** |
|
127 | + * Retrieves the translated text, if any. |
|
128 | + * @return string |
|
129 | + */ |
|
130 | 130 | public function getTranslatedText() : string |
131 | 131 | { |
132 | 132 | $translator = Localization::getTranslator(); |
@@ -139,10 +139,10 @@ discard block |
||
139 | 139 | return ''; |
140 | 140 | } |
141 | 141 | |
142 | - /** |
|
143 | - * Retrieves a list of all file names, with relative paths. |
|
144 | - * @return string[] |
|
145 | - */ |
|
142 | + /** |
|
143 | + * Retrieves a list of all file names, with relative paths. |
|
144 | + * @return string[] |
|
145 | + */ |
|
146 | 146 | public function getFiles() : array |
147 | 147 | { |
148 | 148 | $files = array(); |
@@ -164,10 +164,10 @@ discard block |
||
164 | 164 | return $files; |
165 | 165 | } |
166 | 166 | |
167 | - /** |
|
168 | - * Retrieves a list of all file names this string is used in. |
|
169 | - * @return string[] |
|
170 | - */ |
|
167 | + /** |
|
168 | + * Retrieves a list of all file names this string is used in. |
|
169 | + * @return string[] |
|
170 | + */ |
|
171 | 171 | public function getFileNames() : array |
172 | 172 | { |
173 | 173 | $files = $this->getFiles(); |
@@ -182,13 +182,13 @@ discard block |
||
182 | 182 | return array_unique($result); |
183 | 183 | } |
184 | 184 | |
185 | - /** |
|
186 | - * Retrieves a text comprised of all strings that are relevant |
|
187 | - * for a full text search, imploded together. Used in the search |
|
188 | - * function to find matching strings. |
|
189 | - * |
|
190 | - * @return string |
|
191 | - */ |
|
185 | + /** |
|
186 | + * Retrieves a text comprised of all strings that are relevant |
|
187 | + * for a full text search, imploded together. Used in the search |
|
188 | + * function to find matching strings. |
|
189 | + * |
|
190 | + * @return string |
|
191 | + */ |
|
192 | 192 | public function getSearchString() : string |
193 | 193 | { |
194 | 194 | $parts = array($this->getTranslatedText(), $this->getTextAsString()); |
@@ -8,14 +8,14 @@ discard block |
||
8 | 8 | |
9 | 9 | abstract class Localization_Parser_Token |
10 | 10 | { |
11 | - /** |
|
12 | - * @var array|string |
|
13 | - */ |
|
11 | + /** |
|
12 | + * @var array|string |
|
13 | + */ |
|
14 | 14 | protected $definition; |
15 | 15 | |
16 | - /** |
|
17 | - * @var Localization_Parser_Token|NULL |
|
18 | - */ |
|
16 | + /** |
|
17 | + * @var Localization_Parser_Token|NULL |
|
18 | + */ |
|
19 | 19 | protected $parentToken; |
20 | 20 | |
21 | 21 | /** |
@@ -98,6 +98,6 @@ discard block |
||
98 | 98 | 'value' => $this->getValue(), |
99 | 99 | 'line' => $this->getLine(), |
100 | 100 | 'isEncapsedString' => ConvertHelper::bool2string($this->isEncapsedString()) |
101 | - ); |
|
101 | + ); |
|
102 | 102 | } |
103 | 103 | } |
@@ -23,24 +23,24 @@ |
||
23 | 23 | */ |
24 | 24 | class Localization_Source_Folder extends Localization_Source |
25 | 25 | { |
26 | - /** |
|
27 | - * The folder under which all translatable files are kept. |
|
28 | - * @var string |
|
29 | - */ |
|
26 | + /** |
|
27 | + * The folder under which all translatable files are kept. |
|
28 | + * @var string |
|
29 | + */ |
|
30 | 30 | protected $sourcesFolder; |
31 | 31 | |
32 | - /** |
|
33 | - * @var string |
|
34 | - */ |
|
32 | + /** |
|
33 | + * @var string |
|
34 | + */ |
|
35 | 35 | protected $id; |
36 | 36 | |
37 | - /** |
|
38 | - * @param string $alias An alias for this source, to recognize it by. |
|
39 | - * @param string $label The human-readable label, used in the editor. |
|
40 | - * @param string $group A human-readable group label to group several sources by. Used in the editor. |
|
41 | - * @param string $storageFolder The folder in which to store the localization files. |
|
42 | - * @param string $sourcesFolder The folder in which to analyze files to find translatable strings. |
|
43 | - */ |
|
37 | + /** |
|
38 | + * @param string $alias An alias for this source, to recognize it by. |
|
39 | + * @param string $label The human-readable label, used in the editor. |
|
40 | + * @param string $group A human-readable group label to group several sources by. Used in the editor. |
|
41 | + * @param string $storageFolder The folder in which to store the localization files. |
|
42 | + * @param string $sourcesFolder The folder in which to analyze files to find translatable strings. |
|
43 | + */ |
|
44 | 44 | public function __construct(string $alias, string $label, string $group, string $storageFolder, string $sourcesFolder) |
45 | 45 | { |
46 | 46 | parent::__construct($alias, $label, $group, $storageFolder); |
@@ -27,27 +27,27 @@ |
||
27 | 27 | */ |
28 | 28 | abstract class Localization_Source |
29 | 29 | { |
30 | - /** |
|
31 | - * Human-readable label for the source. |
|
32 | - * @var string |
|
33 | - */ |
|
30 | + /** |
|
31 | + * Human-readable label for the source. |
|
32 | + * @var string |
|
33 | + */ |
|
34 | 34 | protected $label; |
35 | 35 | |
36 | - /** |
|
37 | - * Human-readable group name to categorize the source. |
|
38 | - * @var string |
|
39 | - */ |
|
36 | + /** |
|
37 | + * Human-readable group name to categorize the source. |
|
38 | + * @var string |
|
39 | + */ |
|
40 | 40 | protected $group; |
41 | 41 | |
42 | - /** |
|
43 | - * The folder in which the localization files are stored |
|
44 | - * @var string |
|
45 | - */ |
|
42 | + /** |
|
43 | + * The folder in which the localization files are stored |
|
44 | + * @var string |
|
45 | + */ |
|
46 | 46 | protected $storageFolder; |
47 | 47 | |
48 | - /** |
|
49 | - * @var string |
|
50 | - */ |
|
48 | + /** |
|
49 | + * @var string |
|
50 | + */ |
|
51 | 51 | protected $alias; |
52 | 52 | |
53 | 53 | public function __construct(string $alias, string $label, string $group, string $storageFolder) |
@@ -41,53 +41,53 @@ discard block |
||
41 | 41 | const VARIABLE_WARNINGS = 'warnings'; |
42 | 42 | |
43 | 43 | /** |
44 | - * @var string |
|
45 | - */ |
|
44 | + * @var string |
|
45 | + */ |
|
46 | 46 | protected $installPath; |
47 | 47 | |
48 | - /** |
|
49 | - * @var Localization_Source[] |
|
50 | - */ |
|
48 | + /** |
|
49 | + * @var Localization_Source[] |
|
50 | + */ |
|
51 | 51 | protected $sources; |
52 | 52 | |
53 | - /** |
|
54 | - * @var Request |
|
55 | - */ |
|
53 | + /** |
|
54 | + * @var Request |
|
55 | + */ |
|
56 | 56 | protected $request; |
57 | 57 | |
58 | - /** |
|
59 | - * @var Localization_Source |
|
60 | - */ |
|
58 | + /** |
|
59 | + * @var Localization_Source |
|
60 | + */ |
|
61 | 61 | protected $activeSource; |
62 | 62 | |
63 | - /** |
|
64 | - * @var Localization_Scanner |
|
65 | - */ |
|
63 | + /** |
|
64 | + * @var Localization_Scanner |
|
65 | + */ |
|
66 | 66 | protected $scanner; |
67 | 67 | |
68 | - /** |
|
69 | - * @var Localization_Locale[] |
|
70 | - */ |
|
68 | + /** |
|
69 | + * @var Localization_Locale[] |
|
70 | + */ |
|
71 | 71 | protected $appLocales = array(); |
72 | 72 | |
73 | - /** |
|
74 | - * @var Localization_Locale |
|
75 | - */ |
|
73 | + /** |
|
74 | + * @var Localization_Locale |
|
75 | + */ |
|
76 | 76 | protected $activeAppLocale; |
77 | 77 | |
78 | - /** |
|
79 | - * @var Localization_Editor_Filters |
|
80 | - */ |
|
78 | + /** |
|
79 | + * @var Localization_Editor_Filters |
|
80 | + */ |
|
81 | 81 | protected $filters; |
82 | 82 | |
83 | - /** |
|
84 | - * @var array<string,string> |
|
85 | - */ |
|
83 | + /** |
|
84 | + * @var array<string,string> |
|
85 | + */ |
|
86 | 86 | protected $requestParams = array(); |
87 | 87 | |
88 | - /** |
|
89 | - * @var string |
|
90 | - */ |
|
88 | + /** |
|
89 | + * @var string |
|
90 | + */ |
|
91 | 91 | protected $varPrefix = 'applocalize_'; |
92 | 92 | |
93 | 93 | /** |
@@ -128,15 +128,15 @@ discard block |
||
128 | 128 | return $this->request; |
129 | 129 | } |
130 | 130 | |
131 | - /** |
|
132 | - * Adds a request parameter that will be persisted in all URLs |
|
133 | - * within the editor. This can be used when integrating the |
|
134 | - * editor in an existing page that needs specific request params. |
|
135 | - * |
|
136 | - * @param string $name |
|
137 | - * @param string $value |
|
138 | - * @return Localization_Editor |
|
139 | - */ |
|
131 | + /** |
|
132 | + * Adds a request parameter that will be persisted in all URLs |
|
133 | + * within the editor. This can be used when integrating the |
|
134 | + * editor in an existing page that needs specific request params. |
|
135 | + * |
|
136 | + * @param string $name |
|
137 | + * @param string $value |
|
138 | + * @return Localization_Editor |
|
139 | + */ |
|
140 | 140 | public function addRequestParam(string $name, string $value) : Localization_Editor |
141 | 141 | { |
142 | 142 | $this->requestParams[$name] = $value; |
@@ -500,13 +500,13 @@ discard block |
||
500 | 500 | ); |
501 | 501 | } |
502 | 502 | |
503 | - /** |
|
504 | - * Sets the application name shown in the main navigation |
|
505 | - * in the user interface. |
|
506 | - * |
|
507 | - * @param string $name |
|
508 | - * @return Localization_Editor |
|
509 | - */ |
|
503 | + /** |
|
504 | + * Sets the application name shown in the main navigation |
|
505 | + * in the user interface. |
|
506 | + * |
|
507 | + * @param string $name |
|
508 | + * @return Localization_Editor |
|
509 | + */ |
|
510 | 510 | public function setAppName(string $name) : Localization_Editor |
511 | 511 | { |
512 | 512 | $this->setOption('appname', $name); |
@@ -536,15 +536,15 @@ discard block |
||
536 | 536 | return $this; |
537 | 537 | } |
538 | 538 | |
539 | - /** |
|
540 | - * Sets an URL that the translators can use to go back to |
|
541 | - * the main application, for example if it is integrated into |
|
542 | - * an existing application. |
|
543 | - * |
|
544 | - * @param string $url The URL to use for the link |
|
545 | - * @param string $label Label of the link |
|
546 | - * @return Localization_Editor |
|
547 | - */ |
|
539 | + /** |
|
540 | + * Sets an URL that the translators can use to go back to |
|
541 | + * the main application, for example if it is integrated into |
|
542 | + * an existing application. |
|
543 | + * |
|
544 | + * @param string $url The URL to use for the link |
|
545 | + * @param string $label Label of the link |
|
546 | + * @return Localization_Editor |
|
547 | + */ |
|
548 | 548 | public function setBackURL(string $url, string $label) : Localization_Editor |
549 | 549 | { |
550 | 550 | $this->setOption('back-url', $url); |
@@ -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 | public function __construct() |
@@ -64,25 +64,25 @@ discard block |
||
64 | 64 | return Localization::isLocaleSupported($localeName); |
65 | 65 | } |
66 | 66 | |
67 | - /** |
|
68 | - * Retrieves the shortened version of the locale name, |
|
69 | - * e.g. "en" or "de". |
|
70 | - * |
|
71 | - * @return string |
|
72 | - * @deprecated |
|
73 | - * @see Localization_Locale::getLanguageCode() |
|
74 | - */ |
|
67 | + /** |
|
68 | + * Retrieves the shortened version of the locale name, |
|
69 | + * e.g. "en" or "de". |
|
70 | + * |
|
71 | + * @return string |
|
72 | + * @deprecated |
|
73 | + * @see Localization_Locale::getLanguageCode() |
|
74 | + */ |
|
75 | 75 | public function getShortName() : string |
76 | 76 | { |
77 | 77 | return $this->getLanguageCode(); |
78 | 78 | } |
79 | 79 | |
80 | - /** |
|
81 | - * Retrieves the two-letter country code of |
|
82 | - * the locale. |
|
83 | - * |
|
84 | - * @return string Lowercase code, e.g. "uk" |
|
85 | - */ |
|
80 | + /** |
|
81 | + * Retrieves the two-letter country code of |
|
82 | + * the locale. |
|
83 | + * |
|
84 | + * @return string Lowercase code, e.g. "uk" |
|
85 | + */ |
|
86 | 86 | public function getCountryCode() : string |
87 | 87 | { |
88 | 88 | return $this->countryCode; |
@@ -63,11 +63,11 @@ discard block |
||
63 | 63 | public const EVENT_CACHE_KEY_CHANGED = 'CacheKeyChanged'; |
64 | 64 | |
65 | 65 | /** |
66 | - * Collection of all locales by namespace (application, content, custom...). |
|
67 | - * |
|
68 | - * @var array<string,array<string,Localization_Locale>> |
|
69 | - * @see Localization::addLocale() |
|
70 | - */ |
|
66 | + * Collection of all locales by namespace (application, content, custom...). |
|
67 | + * |
|
68 | + * @var array<string,array<string,Localization_Locale>> |
|
69 | + * @see Localization::addLocale() |
|
70 | + */ |
|
71 | 71 | protected static $locales = array(); |
72 | 72 | |
73 | 73 | /** |
@@ -76,57 +76,57 @@ discard block |
||
76 | 76 | */ |
77 | 77 | private static $initDone = false; |
78 | 78 | |
79 | - /** |
|
80 | - * Path to the file in which the scanner results are stored. |
|
81 | - * @var string |
|
82 | - * @see Localization::configure() |
|
83 | - */ |
|
79 | + /** |
|
80 | + * Path to the file in which the scanner results are stored. |
|
81 | + * @var string |
|
82 | + * @see Localization::configure() |
|
83 | + */ |
|
84 | 84 | protected static $storageFile = ''; |
85 | 85 | |
86 | - /** |
|
87 | - * Path to the folder into which the client libraries are written. |
|
88 | - * @var string |
|
89 | - * @see Localization::setClientLibrariesFolder() |
|
90 | - */ |
|
86 | + /** |
|
87 | + * Path to the folder into which the client libraries are written. |
|
88 | + * @var string |
|
89 | + * @see Localization::setClientLibrariesFolder() |
|
90 | + */ |
|
91 | 91 | protected static $clientFolder = ''; |
92 | 92 | |
93 | - /** |
|
94 | - * If this key changes, client libraries are refreshed. |
|
95 | - * @var string |
|
96 | - * @see Localization::setClientLibrariesCacheKey() |
|
97 | - */ |
|
93 | + /** |
|
94 | + * If this key changes, client libraries are refreshed. |
|
95 | + * @var string |
|
96 | + * @see Localization::setClientLibrariesCacheKey() |
|
97 | + */ |
|
98 | 98 | protected static $clientCacheKey = ''; |
99 | 99 | |
100 | - /** |
|
101 | - * Whether the configuration has been made. |
|
102 | - * @var bool |
|
103 | - * @see Localization::configure() |
|
104 | - */ |
|
100 | + /** |
|
101 | + * Whether the configuration has been made. |
|
102 | + * @var bool |
|
103 | + * @see Localization::configure() |
|
104 | + */ |
|
105 | 105 | protected static $configured = false; |
106 | 106 | |
107 | - /** |
|
108 | - * Stores event listener instances. |
|
109 | - * @var array |
|
110 | - */ |
|
107 | + /** |
|
108 | + * Stores event listener instances. |
|
109 | + * @var array |
|
110 | + */ |
|
111 | 111 | protected static array $listeners = array(); |
112 | 112 | |
113 | - /** |
|
114 | - * @var integer |
|
115 | - * @see Localization::addEventListener() |
|
116 | - */ |
|
113 | + /** |
|
114 | + * @var integer |
|
115 | + * @see Localization::addEventListener() |
|
116 | + */ |
|
117 | 117 | protected static $listenersCounter = 0; |
118 | 118 | |
119 | - /** |
|
120 | - * @var Localization_Translator|NULL |
|
121 | - */ |
|
119 | + /** |
|
120 | + * @var Localization_Translator|NULL |
|
121 | + */ |
|
122 | 122 | protected static $translator; |
123 | 123 | |
124 | - /** |
|
125 | - * Initializes the localization layer. This is done |
|
126 | - * automatically, and only once per request. |
|
127 | - * |
|
128 | - * (Called at the end of this file) |
|
129 | - */ |
|
124 | + /** |
|
125 | + * Initializes the localization layer. This is done |
|
126 | + * automatically, and only once per request. |
|
127 | + * |
|
128 | + * (Called at the end of this file) |
|
129 | + */ |
|
130 | 130 | public static function init() : void |
131 | 131 | { |
132 | 132 | if(self::$initDone) { |
@@ -165,12 +165,12 @@ discard block |
||
165 | 165 | return self::getLocalesByNS(self::NAMESPACE_APPLICATION); |
166 | 166 | } |
167 | 167 | |
168 | - /** |
|
169 | - * Retrieves all locales in the specified namespace. |
|
170 | - * |
|
171 | - * @param string $namespace |
|
172 | - * @return Localization_Locale[] |
|
173 | - */ |
|
168 | + /** |
|
169 | + * Retrieves all locales in the specified namespace. |
|
170 | + * |
|
171 | + * @param string $namespace |
|
172 | + * @return Localization_Locale[] |
|
173 | + */ |
|
174 | 174 | public static function getLocalesByNS(string $namespace) |
175 | 175 | { |
176 | 176 | if(isset(self::$locales[$namespace])) { |
@@ -187,35 +187,35 @@ discard block |
||
187 | 187 | ); |
188 | 188 | } |
189 | 189 | |
190 | - /** |
|
191 | - * Adds an application locale to use in the application. |
|
192 | - * |
|
193 | - * @param string $localeName |
|
194 | - * @return Localization_Locale |
|
195 | - */ |
|
190 | + /** |
|
191 | + * Adds an application locale to use in the application. |
|
192 | + * |
|
193 | + * @param string $localeName |
|
194 | + * @return Localization_Locale |
|
195 | + */ |
|
196 | 196 | public static function addAppLocale(string $localeName) : Localization_Locale |
197 | 197 | { |
198 | 198 | return self::addLocaleByNS($localeName, self::NAMESPACE_APPLICATION); |
199 | 199 | } |
200 | 200 | |
201 | - /** |
|
202 | - * Adds a content locale to use for content in the application. |
|
203 | - * |
|
204 | - * @param string $localeName |
|
205 | - * @return Localization_Locale |
|
206 | - */ |
|
201 | + /** |
|
202 | + * Adds a content locale to use for content in the application. |
|
203 | + * |
|
204 | + * @param string $localeName |
|
205 | + * @return Localization_Locale |
|
206 | + */ |
|
207 | 207 | public static function addContentLocale(string $localeName) : Localization_Locale |
208 | 208 | { |
209 | 209 | return self::addLocaleByNS($localeName, self::NAMESPACE_CONTENT); |
210 | 210 | } |
211 | 211 | |
212 | - /** |
|
213 | - * Adds a locale to the specified namespace. |
|
214 | - * |
|
215 | - * @param string $localeName |
|
216 | - * @param string $namespace |
|
217 | - * @return Localization_Locale |
|
218 | - */ |
|
212 | + /** |
|
213 | + * Adds a locale to the specified namespace. |
|
214 | + * |
|
215 | + * @param string $localeName |
|
216 | + * @param string $namespace |
|
217 | + * @return Localization_Locale |
|
218 | + */ |
|
219 | 219 | public static function addLocaleByNS(string $localeName, string $namespace) : Localization_Locale |
220 | 220 | { |
221 | 221 | if(!isset(self::$locales[$namespace])) { |
@@ -368,45 +368,45 @@ discard block |
||
368 | 368 | return self::getSelectedLocaleByNS(self::NAMESPACE_APPLICATION); |
369 | 369 | } |
370 | 370 | |
371 | - /** |
|
372 | - * Retrieves the name of the selected application locale. |
|
373 | - * |
|
374 | - * @return string |
|
375 | - */ |
|
371 | + /** |
|
372 | + * Retrieves the name of the selected application locale. |
|
373 | + * |
|
374 | + * @return string |
|
375 | + */ |
|
376 | 376 | public static function getAppLocaleName() : string |
377 | 377 | { |
378 | 378 | return self::getLocaleNameByNS(self::NAMESPACE_APPLICATION); |
379 | 379 | } |
380 | 380 | |
381 | - /** |
|
382 | - * Retrieves the names of the available application locales. |
|
383 | - * @return string[] |
|
384 | - */ |
|
381 | + /** |
|
382 | + * Retrieves the names of the available application locales. |
|
383 | + * @return string[] |
|
384 | + */ |
|
385 | 385 | public static function getAppLocaleNames() : array |
386 | 386 | { |
387 | 387 | return self::getLocaleNamesByNS(self::NAMESPACE_APPLICATION); |
388 | 388 | } |
389 | 389 | |
390 | - /** |
|
391 | - * Retrieves the selected locale name in the specified namespace. |
|
392 | - * |
|
393 | - * @param string $namespace |
|
394 | - * @throws Localization_Exception |
|
395 | - * @return string |
|
396 | - */ |
|
390 | + /** |
|
391 | + * Retrieves the selected locale name in the specified namespace. |
|
392 | + * |
|
393 | + * @param string $namespace |
|
394 | + * @throws Localization_Exception |
|
395 | + * @return string |
|
396 | + */ |
|
397 | 397 | public static function getLocaleNameByNS(string $namespace) : string |
398 | 398 | { |
399 | 399 | return self::getSelectedLocaleByNS($namespace)->getName(); |
400 | 400 | } |
401 | 401 | |
402 | - /** |
|
403 | - * Retrieves the selected locale instance for the specified namespace. |
|
404 | - * |
|
405 | - * @param string $namespace |
|
406 | - * @return Localization_Locale |
|
407 | - * @throws Localization_Exception |
|
408 | - * @see Localization::ERROR_NO_LOCALE_SELECTED_IN_NS |
|
409 | - */ |
|
402 | + /** |
|
403 | + * Retrieves the selected locale instance for the specified namespace. |
|
404 | + * |
|
405 | + * @param string $namespace |
|
406 | + * @return Localization_Locale |
|
407 | + * @throws Localization_Exception |
|
408 | + * @see Localization::ERROR_NO_LOCALE_SELECTED_IN_NS |
|
409 | + */ |
|
410 | 410 | public static function getSelectedLocaleByNS(string $namespace) : Localization_Locale |
411 | 411 | { |
412 | 412 | self::requireNamespace($namespace); |
@@ -425,24 +425,24 @@ discard block |
||
425 | 425 | ); |
426 | 426 | } |
427 | 427 | |
428 | - /** |
|
429 | - * Stores the selected locale names by namespace. |
|
430 | - * @var array<string,Localization_Locale> |
|
431 | - */ |
|
428 | + /** |
|
429 | + * Stores the selected locale names by namespace. |
|
430 | + * @var array<string,Localization_Locale> |
|
431 | + */ |
|
432 | 432 | protected static $selected = array(); |
433 | 433 | |
434 | - /** |
|
435 | - * Selects the active locale for the specified namespace. |
|
436 | - * |
|
437 | - * NOTE: Triggers the "LocaleChanged" event. |
|
438 | - * |
|
439 | - * @param string $localeName |
|
440 | - * @param string $namespace |
|
441 | - * @return Localization_Locale |
|
442 | - * @throws Localization_Exception |
|
443 | - * |
|
444 | - * @see LocaleChanged |
|
445 | - */ |
|
434 | + /** |
|
435 | + * Selects the active locale for the specified namespace. |
|
436 | + * |
|
437 | + * NOTE: Triggers the "LocaleChanged" event. |
|
438 | + * |
|
439 | + * @param string $localeName |
|
440 | + * @param string $namespace |
|
441 | + * @return Localization_Locale |
|
442 | + * @throws Localization_Exception |
|
443 | + * |
|
444 | + * @see LocaleChanged |
|
445 | + */ |
|
446 | 446 | public static function selectLocaleByNS(string $localeName, string $namespace) : Localization_Locale |
447 | 447 | { |
448 | 448 | self::requireNamespace($namespace); |
@@ -594,15 +594,15 @@ discard block |
||
594 | 594 | return self::selectLocaleByNS($localeName, self::NAMESPACE_APPLICATION); |
595 | 595 | } |
596 | 596 | |
597 | - /** |
|
598 | - * Retrieves an application locale by its name. |
|
599 | - * Note that the locale must have been added first. |
|
600 | - * |
|
601 | - * @param string $localeName |
|
602 | - * @throws Localization_Exception |
|
603 | - * @return Localization_Locale |
|
604 | - * @see Localization::appLocaleExists() |
|
605 | - */ |
|
597 | + /** |
|
598 | + * Retrieves an application locale by its name. |
|
599 | + * Note that the locale must have been added first. |
|
600 | + * |
|
601 | + * @param string $localeName |
|
602 | + * @throws Localization_Exception |
|
603 | + * @return Localization_Locale |
|
604 | + * @see Localization::appLocaleExists() |
|
605 | + */ |
|
606 | 606 | public static function getAppLocaleByName(string $localeName) : Localization_Locale |
607 | 607 | { |
608 | 608 | return self::getLocaleByNameNS($localeName, self::NAMESPACE_APPLICATION); |
@@ -637,10 +637,10 @@ discard block |
||
637 | 637 | return self::getLocalesByNS(self::NAMESPACE_CONTENT); |
638 | 638 | } |
639 | 639 | |
640 | - /** |
|
641 | - * Retrieves the names of all content locales that have been added. |
|
642 | - * @return string[] |
|
643 | - */ |
|
640 | + /** |
|
641 | + * Retrieves the names of all content locales that have been added. |
|
642 | + * @return string[] |
|
643 | + */ |
|
644 | 644 | public static function getContentLocaleNames() |
645 | 645 | { |
646 | 646 | return self::getLocaleNamesByNS(self::NAMESPACE_CONTENT); |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | sort($names); |
664 | 664 | |
665 | 665 | return $names; |
666 | - } |
|
666 | + } |
|
667 | 667 | |
668 | 668 | /** |
669 | 669 | * Checks by the locale name if the specified locale is |
@@ -692,14 +692,14 @@ discard block |
||
692 | 692 | return self::getLocaleByNameNS($localeName, self::NAMESPACE_CONTENT); |
693 | 693 | } |
694 | 694 | |
695 | - /** |
|
696 | - * Retrieves a locale by its name in the specified namespace. |
|
697 | - * |
|
698 | - * @param string $localeName |
|
699 | - * @param string $namespace |
|
700 | - * @throws Localization_Exception |
|
701 | - * @return Localization_Locale |
|
702 | - */ |
|
695 | + /** |
|
696 | + * Retrieves a locale by its name in the specified namespace. |
|
697 | + * |
|
698 | + * @param string $localeName |
|
699 | + * @param string $namespace |
|
700 | + * @throws Localization_Exception |
|
701 | + * @return Localization_Locale |
|
702 | + */ |
|
703 | 703 | public static function getLocaleByNameNS(string $localeName, string $namespace) : Localization_Locale |
704 | 704 | { |
705 | 705 | self::requireNamespace($namespace); |
@@ -770,10 +770,10 @@ discard block |
||
770 | 770 | return self::selectLocaleByNS($localeName, self::NAMESPACE_CONTENT); |
771 | 771 | } |
772 | 772 | |
773 | - /** |
|
774 | - * Checks whether the localization has been configured entirely. |
|
775 | - * @return bool |
|
776 | - */ |
|
773 | + /** |
|
774 | + * Checks whether the localization has been configured entirely. |
|
775 | + * @return bool |
|
776 | + */ |
|
777 | 777 | public static function isConfigured() : bool |
778 | 778 | { |
779 | 779 | return self::$configured; |
@@ -845,29 +845,29 @@ discard block |
||
845 | 845 | ); |
846 | 846 | } |
847 | 847 | |
848 | - /** |
|
849 | - * Injects a content locales selector element into the specified |
|
850 | - * HTML QuickForm2 container. |
|
851 | - * |
|
852 | - * @param string $elementName |
|
853 | - * @param HTML_QuickForm2_Container $container |
|
854 | - * @param string $label |
|
855 | - * @return HTML_QuickForm2_Element_Select |
|
856 | - */ |
|
848 | + /** |
|
849 | + * Injects a content locales selector element into the specified |
|
850 | + * HTML QuickForm2 container. |
|
851 | + * |
|
852 | + * @param string $elementName |
|
853 | + * @param HTML_QuickForm2_Container $container |
|
854 | + * @param string $label |
|
855 | + * @return HTML_QuickForm2_Element_Select |
|
856 | + */ |
|
857 | 857 | public static function injectContentLocalesSelector(string $elementName, HTML_QuickForm2_Container $container, string $label='') : HTML_QuickForm2_Element_Select |
858 | 858 | { |
859 | 859 | return self::injectLocalesSelectorNS($elementName, self::NAMESPACE_CONTENT, $container, $label); |
860 | 860 | } |
861 | 861 | |
862 | - /** |
|
863 | - * Injects an app locales selector element into the specified |
|
862 | + /** |
|
863 | + * Injects an app locales selector element into the specified |
|
864 | 864 | * HTML QuickForm2 container. |
865 | 865 | * |
866 | - * @param string $elementName |
|
867 | - * @param HTML_QuickForm2_Container $container |
|
868 | - * @param string $label |
|
869 | - * @return HTML_QuickForm2_Element_Select |
|
870 | - */ |
|
866 | + * @param string $elementName |
|
867 | + * @param HTML_QuickForm2_Container $container |
|
868 | + * @param string $label |
|
869 | + * @return HTML_QuickForm2_Element_Select |
|
870 | + */ |
|
871 | 871 | public static function injectAppLocalesSelector(string $elementName, HTML_QuickForm2_Container $container, string $label='') : HTML_QuickForm2_Element_Select |
872 | 872 | { |
873 | 873 | return self::injectLocalesSelectorNS($elementName, self::NAMESPACE_APPLICATION, $container, $label); |
@@ -903,26 +903,26 @@ discard block |
||
903 | 903 | return $select; |
904 | 904 | } |
905 | 905 | |
906 | - /** |
|
907 | - * @var Localization_Source[] |
|
908 | - */ |
|
906 | + /** |
|
907 | + * @var Localization_Source[] |
|
908 | + */ |
|
909 | 909 | protected static $sources = array(); |
910 | 910 | |
911 | - /** |
|
912 | - * @var string[] |
|
913 | - */ |
|
911 | + /** |
|
912 | + * @var string[] |
|
913 | + */ |
|
914 | 914 | protected static $excludeFolders = array(); |
915 | 915 | |
916 | - /** |
|
917 | - * @var string[] |
|
918 | - */ |
|
916 | + /** |
|
917 | + * @var string[] |
|
918 | + */ |
|
919 | 919 | protected static $excludeFiles = array(); |
920 | 920 | |
921 | - /** |
|
922 | - * Retrieves all currently available sources. |
|
923 | - * |
|
924 | - * @return Localization_Source[] |
|
925 | - */ |
|
921 | + /** |
|
922 | + * Retrieves all currently available sources. |
|
923 | + * |
|
924 | + * @return Localization_Source[] |
|
925 | + */ |
|
926 | 926 | public static function getSources() : array |
927 | 927 | { |
928 | 928 | return self::$sources; |
@@ -954,10 +954,10 @@ discard block |
||
954 | 954 | return $source; |
955 | 955 | } |
956 | 956 | |
957 | - /** |
|
958 | - * Retrieves all sources grouped by their group name. |
|
959 | - * @return array |
|
960 | - */ |
|
957 | + /** |
|
958 | + * Retrieves all sources grouped by their group name. |
|
959 | + * @return array |
|
960 | + */ |
|
961 | 961 | public static function getSourcesGrouped() |
962 | 962 | { |
963 | 963 | $sources = self::getSources(); |
@@ -978,11 +978,11 @@ discard block |
||
978 | 978 | return $grouped; |
979 | 979 | } |
980 | 980 | |
981 | - /** |
|
982 | - * Checks whether a specific source exists by its ID. |
|
983 | - * @param string $sourceID |
|
984 | - * @return boolean |
|
985 | - */ |
|
981 | + /** |
|
982 | + * Checks whether a specific source exists by its ID. |
|
983 | + * @param string $sourceID |
|
984 | + * @return boolean |
|
985 | + */ |
|
986 | 986 | public static function sourceExists(string $sourceID) : bool |
987 | 987 | { |
988 | 988 | $sources = self::getSources(); |
@@ -995,11 +995,11 @@ discard block |
||
995 | 995 | return false; |
996 | 996 | } |
997 | 997 | |
998 | - /** |
|
999 | - * Checks whether a specific source exists by its alias. |
|
1000 | - * @param string $sourceAlias |
|
1001 | - * @return boolean |
|
1002 | - */ |
|
998 | + /** |
|
999 | + * Checks whether a specific source exists by its alias. |
|
1000 | + * @param string $sourceAlias |
|
1001 | + * @return boolean |
|
1002 | + */ |
|
1003 | 1003 | public static function sourceAliasExists(string $sourceAlias) : bool |
1004 | 1004 | { |
1005 | 1005 | $sources = self::getSources(); |
@@ -1012,13 +1012,13 @@ discard block |
||
1012 | 1012 | return false; |
1013 | 1013 | } |
1014 | 1014 | |
1015 | - /** |
|
1016 | - * Retrieves a localization source by its ID. |
|
1017 | - * |
|
1018 | - * @param string $sourceID |
|
1019 | - * @throws Localization_Exception |
|
1020 | - * @return Localization_Source |
|
1021 | - */ |
|
1015 | + /** |
|
1016 | + * Retrieves a localization source by its ID. |
|
1017 | + * |
|
1018 | + * @param string $sourceID |
|
1019 | + * @throws Localization_Exception |
|
1020 | + * @return Localization_Source |
|
1021 | + */ |
|
1022 | 1022 | public static function getSourceByID(string $sourceID) : Localization_Source |
1023 | 1023 | { |
1024 | 1024 | $sources = self::getSources(); |
@@ -1108,17 +1108,17 @@ discard block |
||
1108 | 1108 | } |
1109 | 1109 | } |
1110 | 1110 | |
1111 | - /** |
|
1112 | - * Sets a key that is used to verify whether the client |
|
1113 | - * libraries have to be refreshed. A common use is to set |
|
1114 | - * this to the application's version number to guarantee |
|
1115 | - * new texts are automatically used with each release. |
|
1116 | - * |
|
1117 | - * NOTE: Otherwise files are refreshed only when saving |
|
1118 | - * them in the editor UI. |
|
1119 | - * |
|
1120 | - * @param string $key |
|
1121 | - */ |
|
1111 | + /** |
|
1112 | + * Sets a key that is used to verify whether the client |
|
1113 | + * libraries have to be refreshed. A common use is to set |
|
1114 | + * this to the application's version number to guarantee |
|
1115 | + * new texts are automatically used with each release. |
|
1116 | + * |
|
1117 | + * NOTE: Otherwise files are refreshed only when saving |
|
1118 | + * them in the editor UI. |
|
1119 | + * |
|
1120 | + * @param string $key |
|
1121 | + */ |
|
1122 | 1122 | public static function setClientLibrariesCacheKey(string $key) : void |
1123 | 1123 | { |
1124 | 1124 | if($key !== self::$clientCacheKey) { |
@@ -1132,10 +1132,10 @@ discard block |
||
1132 | 1132 | return self::$clientCacheKey; |
1133 | 1133 | } |
1134 | 1134 | |
1135 | - /** |
|
1136 | - * Sets the folder where client libraries are to be stored. |
|
1137 | - * @param string $folder |
|
1138 | - */ |
|
1135 | + /** |
|
1136 | + * Sets the folder where client libraries are to be stored. |
|
1137 | + * @param string $folder |
|
1138 | + */ |
|
1139 | 1139 | public static function setClientLibrariesFolder(string $folder) : void |
1140 | 1140 | { |
1141 | 1141 | if($folder !== self::$clientFolder) { |
@@ -1144,14 +1144,14 @@ discard block |
||
1144 | 1144 | } |
1145 | 1145 | } |
1146 | 1146 | |
1147 | - /** |
|
1148 | - * Retrieves the path to the folder in which the client |
|
1149 | - * libraries should be stored. |
|
1150 | - * |
|
1151 | - * NOTE: Can return an empty string, when this is disabled. |
|
1152 | - * |
|
1153 | - * @return string |
|
1154 | - */ |
|
1147 | + /** |
|
1148 | + * Retrieves the path to the folder in which the client |
|
1149 | + * libraries should be stored. |
|
1150 | + * |
|
1151 | + * NOTE: Can return an empty string, when this is disabled. |
|
1152 | + * |
|
1153 | + * @return string |
|
1154 | + */ |
|
1155 | 1155 | public static function getClientLibrariesFolder() : string |
1156 | 1156 | { |
1157 | 1157 | return self::$clientFolder; |
@@ -1173,13 +1173,13 @@ discard block |
||
1173 | 1173 | |
1174 | 1174 | private static ?Localization_ClientGenerator $generator = null; |
1175 | 1175 | |
1176 | - /** |
|
1177 | - * Creates a new instance of the client generator class |
|
1178 | - * that is used to write the localization files into the |
|
1179 | - * target folder on disk. |
|
1180 | - * |
|
1181 | - * @return Localization_ClientGenerator |
|
1182 | - */ |
|
1176 | + /** |
|
1177 | + * Creates a new instance of the client generator class |
|
1178 | + * that is used to write the localization files into the |
|
1179 | + * target folder on disk. |
|
1180 | + * |
|
1181 | + * @return Localization_ClientGenerator |
|
1182 | + */ |
|
1183 | 1183 | public static function createGenerator() : Localization_ClientGenerator |
1184 | 1184 | { |
1185 | 1185 | if(!isset(self::$generator)) { |
@@ -1248,10 +1248,10 @@ discard block |
||
1248 | 1248 | return new Localization_Editor(); |
1249 | 1249 | } |
1250 | 1250 | |
1251 | - /** |
|
1252 | - * Retrieves a list of all available source IDs. |
|
1253 | - * @return string[] |
|
1254 | - */ |
|
1251 | + /** |
|
1252 | + * Retrieves a list of all available source IDs. |
|
1253 | + * @return string[] |
|
1254 | + */ |
|
1255 | 1255 | public static function getSourceIDs() : array |
1256 | 1256 | { |
1257 | 1257 | $ids = array(); |
@@ -1278,9 +1278,9 @@ discard block |
||
1278 | 1278 | return $aliases; |
1279 | 1279 | } |
1280 | 1280 | |
1281 | - /** |
|
1282 | - * Resets all locales to the built-in locale. |
|
1283 | - */ |
|
1281 | + /** |
|
1282 | + * Resets all locales to the built-in locale. |
|
1283 | + */ |
|
1284 | 1284 | public static function reset() : void |
1285 | 1285 | { |
1286 | 1286 | self::$locales = array(); |
@@ -1316,12 +1316,12 @@ discard block |
||
1316 | 1316 | return self::$supportedLocales; |
1317 | 1317 | } |
1318 | 1318 | |
1319 | - /** |
|
1320 | - * Checks whether the specified locale is supported. |
|
1321 | - * |
|
1322 | - * @param string $localeName |
|
1323 | - * @return bool |
|
1324 | - */ |
|
1319 | + /** |
|
1320 | + * Checks whether the specified locale is supported. |
|
1321 | + * |
|
1322 | + * @param string $localeName |
|
1323 | + * @return bool |
|
1324 | + */ |
|
1325 | 1325 | public static function isLocaleSupported(string $localeName) : bool |
1326 | 1326 | { |
1327 | 1327 | return file_exists(__DIR__.'/Localization/Locale/'.$localeName.'.php'); |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | public const ERROR_NO_CURRENT_LOCALE_SPECIFIED = 91401; |
31 | 31 | |
32 | 32 | /** |
33 | - * The locale that was used before the change, if any. |
|
34 | - * @return Localization_Locale|NULL |
|
35 | - */ |
|
33 | + * The locale that was used before the change, if any. |
|
34 | + * @return Localization_Locale|NULL |
|
35 | + */ |
|
36 | 36 | public function getPrevious() : ?Localization_Locale |
37 | 37 | { |
38 | 38 | $arg = $this->getArgument(1); |
@@ -64,28 +64,28 @@ discard block |
||
64 | 64 | ); |
65 | 65 | } |
66 | 66 | |
67 | - /** |
|
68 | - * The namespace in which the locale change occurred. |
|
69 | - * @return string |
|
70 | - */ |
|
67 | + /** |
|
68 | + * The namespace in which the locale change occurred. |
|
69 | + * @return string |
|
70 | + */ |
|
71 | 71 | public function getNamespace() : string |
72 | 72 | { |
73 | 73 | return strval($this->getArgument(0)); |
74 | 74 | } |
75 | 75 | |
76 | - /** |
|
77 | - * Whether the change occurred for an application locale. |
|
78 | - * @return bool |
|
79 | - */ |
|
76 | + /** |
|
77 | + * Whether the change occurred for an application locale. |
|
78 | + * @return bool |
|
79 | + */ |
|
80 | 80 | public function isAppLocale() : bool |
81 | 81 | { |
82 | 82 | return $this->getNamespace() === Localization::NAMESPACE_APPLICATION; |
83 | 83 | } |
84 | 84 | |
85 | - /** |
|
86 | - * Whether the change occurred for a content locale. |
|
87 | - * @return bool |
|
88 | - */ |
|
85 | + /** |
|
86 | + * Whether the change occurred for a content locale. |
|
87 | + * @return bool |
|
88 | + */ |
|
89 | 89 | public function isContentLocale() : bool |
90 | 90 | { |
91 | 91 | return $this->getNamespace() === Localization::NAMESPACE_CONTENT; |