@@ -24,24 +24,24 @@ discard block |
||
24 | 24 | */ |
25 | 25 | class Localization_Scanner |
26 | 26 | { |
27 | - /** |
|
28 | - * @var float |
|
29 | - */ |
|
27 | + /** |
|
28 | + * @var float |
|
29 | + */ |
|
30 | 30 | protected $timeStart; |
31 | 31 | |
32 | - /** |
|
33 | - * @var float |
|
34 | - */ |
|
32 | + /** |
|
33 | + * @var float |
|
34 | + */ |
|
35 | 35 | protected $timeEnd; |
36 | 36 | |
37 | - /** |
|
38 | - * @var array |
|
39 | - */ |
|
37 | + /** |
|
38 | + * @var array |
|
39 | + */ |
|
40 | 40 | protected $stringInfos = array(); |
41 | 41 | |
42 | - /** |
|
43 | - * @var string |
|
44 | - */ |
|
42 | + /** |
|
43 | + * @var string |
|
44 | + */ |
|
45 | 45 | protected $storageFile; |
46 | 46 | |
47 | 47 | /** |
@@ -172,12 +172,12 @@ discard block |
||
172 | 172 | return $this->getCollection()->countWarnings(); |
173 | 173 | } |
174 | 174 | |
175 | - /** |
|
176 | - * Retrieves all warnings that have been registered |
|
177 | - * during the last search for translatable texts. |
|
178 | - * |
|
179 | - * @return Localization_Scanner_StringsCollection_Warning[] |
|
180 | - */ |
|
175 | + /** |
|
176 | + * Retrieves all warnings that have been registered |
|
177 | + * during the last search for translatable texts. |
|
178 | + * |
|
179 | + * @return Localization_Scanner_StringsCollection_Warning[] |
|
180 | + */ |
|
181 | 181 | public function getWarnings() : array |
182 | 182 | { |
183 | 183 | return $this->getCollection()->getWarnings(); |
@@ -20,29 +20,29 @@ discard block |
||
20 | 20 | */ |
21 | 21 | class Localization_Writer |
22 | 22 | { |
23 | - /** |
|
24 | - * @var boolean |
|
25 | - */ |
|
23 | + /** |
|
24 | + * @var boolean |
|
25 | + */ |
|
26 | 26 | private $editable = false; |
27 | 27 | |
28 | - /** |
|
29 | - * @var array<string,string> |
|
30 | - */ |
|
28 | + /** |
|
29 | + * @var array<string,string> |
|
30 | + */ |
|
31 | 31 | private $hashes = array(); |
32 | 32 | |
33 | - /** |
|
34 | - * @var Localization_Locale |
|
35 | - */ |
|
33 | + /** |
|
34 | + * @var Localization_Locale |
|
35 | + */ |
|
36 | 36 | private $locale; |
37 | 37 | |
38 | - /** |
|
39 | - * @var string |
|
40 | - */ |
|
38 | + /** |
|
39 | + * @var string |
|
40 | + */ |
|
41 | 41 | private $fileType; |
42 | 42 | |
43 | - /** |
|
44 | - * @var string |
|
45 | - */ |
|
43 | + /** |
|
44 | + * @var string |
|
45 | + */ |
|
46 | 46 | private $filePath; |
47 | 47 | |
48 | 48 | public function __construct(Localization_Locale $locale, string $fileType, string $filePath) |
@@ -150,16 +150,16 @@ discard block |
||
150 | 150 | return $hashes; |
151 | 151 | } |
152 | 152 | |
153 | - /** |
|
154 | - * Sort the strings to ensure they always appear in the same order: |
|
155 | - * first by text, and same strings by their hashes. This is important |
|
156 | - * for strings that have the same translation to avoid them changing |
|
157 | - * order between sorts. |
|
158 | - * |
|
159 | - * @param array $a |
|
160 | - * @param array $b |
|
161 | - * @return int |
|
162 | - */ |
|
153 | + /** |
|
154 | + * Sort the strings to ensure they always appear in the same order: |
|
155 | + * first by text, and same strings by their hashes. This is important |
|
156 | + * for strings that have the same translation to avoid them changing |
|
157 | + * order between sorts. |
|
158 | + * |
|
159 | + * @param array $a |
|
160 | + * @param array $b |
|
161 | + * @return int |
|
162 | + */ |
|
163 | 163 | public function callback_sortStrings(array $a, array $b) : int |
164 | 164 | { |
165 | 165 | $result = strnatcasecmp($a['text'], $b['text']); |
@@ -12,19 +12,19 @@ discard block |
||
12 | 12 | |
13 | 13 | const STORAGE_FORMAT_VERSION = 2; |
14 | 14 | |
15 | - /** |
|
16 | - * @var Localization_Scanner |
|
17 | - */ |
|
15 | + /** |
|
16 | + * @var Localization_Scanner |
|
17 | + */ |
|
18 | 18 | protected $scanner; |
19 | 19 | |
20 | - /** |
|
21 | - * @var Localization_Scanner_StringHash[] |
|
22 | - */ |
|
20 | + /** |
|
21 | + * @var Localization_Scanner_StringHash[] |
|
22 | + */ |
|
23 | 23 | protected $hashes = array(); |
24 | 24 | |
25 | - /** |
|
26 | - * @var array |
|
27 | - */ |
|
25 | + /** |
|
26 | + * @var array |
|
27 | + */ |
|
28 | 28 | protected $warnings = array(); |
29 | 29 | |
30 | 30 | public function __construct(Localization_Scanner $scanner) |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | return new Localization_Scanner_StringInfo($this, $sourceID, $sourceType, $text); |
53 | 53 | } |
54 | 54 | |
55 | - /** |
|
56 | - * Adds a single translatable string. |
|
57 | - * |
|
58 | - * @param Localization_Scanner_StringInfo $string |
|
59 | - * @return Localization_Scanner_StringsCollection |
|
60 | - */ |
|
55 | + /** |
|
56 | + * Adds a single translatable string. |
|
57 | + * |
|
58 | + * @param Localization_Scanner_StringInfo $string |
|
59 | + * @return Localization_Scanner_StringsCollection |
|
60 | + */ |
|
61 | 61 | protected function add(Localization_Scanner_StringInfo $string) : Localization_Scanner_StringsCollection |
62 | 62 | { |
63 | 63 | $hash = $string->getHash(); |
@@ -70,12 +70,12 @@ discard block |
||
70 | 70 | return $this; |
71 | 71 | } |
72 | 72 | |
73 | - /** |
|
74 | - * Retrieves all available translatable strings, |
|
75 | - * grouped by their hash to identify unique strings. |
|
76 | - * |
|
77 | - * @return Localization_Scanner_StringHash[] |
|
78 | - */ |
|
73 | + /** |
|
74 | + * Retrieves all available translatable strings, |
|
75 | + * grouped by their hash to identify unique strings. |
|
76 | + * |
|
77 | + * @return Localization_Scanner_StringHash[] |
|
78 | + */ |
|
79 | 79 | public function getHashes() : array |
80 | 80 | { |
81 | 81 | return array_values($this->hashes); |
@@ -146,32 +146,32 @@ discard block |
||
146 | 146 | return true; |
147 | 147 | } |
148 | 148 | |
149 | - /** |
|
150 | - * Whether the parser reported warnings during the |
|
151 | - * search for translatable texts. |
|
152 | - * |
|
153 | - * @return bool |
|
154 | - */ |
|
149 | + /** |
|
150 | + * Whether the parser reported warnings during the |
|
151 | + * search for translatable texts. |
|
152 | + * |
|
153 | + * @return bool |
|
154 | + */ |
|
155 | 155 | public function hasWarnings() : bool |
156 | 156 | { |
157 | 157 | return !empty($this->warnings); |
158 | 158 | } |
159 | 159 | |
160 | - /** |
|
161 | - * Retrieves the amount of warnings. |
|
162 | - * @return int |
|
163 | - */ |
|
160 | + /** |
|
161 | + * Retrieves the amount of warnings. |
|
162 | + * @return int |
|
163 | + */ |
|
164 | 164 | public function countWarnings() : int |
165 | 165 | { |
166 | 166 | return count($this->warnings); |
167 | 167 | } |
168 | 168 | |
169 | - /** |
|
170 | - * Retrieves all warning messages that were added |
|
171 | - * during the search for translatable texts, if any. |
|
172 | - * |
|
173 | - * @return Localization_Scanner_StringsCollection_Warning[] |
|
174 | - */ |
|
169 | + /** |
|
170 | + * Retrieves all warning messages that were added |
|
171 | + * during the search for translatable texts, if any. |
|
172 | + * |
|
173 | + * @return Localization_Scanner_StringsCollection_Warning[] |
|
174 | + */ |
|
175 | 175 | public function getWarnings() : array |
176 | 176 | { |
177 | 177 | $result = array(); |
@@ -198,12 +198,12 @@ discard block |
||
198 | 198 | return $amount; |
199 | 199 | } |
200 | 200 | |
201 | - /** |
|
202 | - * Retrieves all string hashed for the specified source. |
|
203 | - * |
|
204 | - * @param string $id |
|
205 | - * @return Localization_Scanner_StringHash[] |
|
206 | - */ |
|
201 | + /** |
|
202 | + * Retrieves all string hashed for the specified source. |
|
203 | + * |
|
204 | + * @param string $id |
|
205 | + * @return Localization_Scanner_StringHash[] |
|
206 | + */ |
|
207 | 207 | public function getHashesBySourceID(string $id) : array |
208 | 208 | { |
209 | 209 | $hashes = array(); |
@@ -217,12 +217,12 @@ discard block |
||
217 | 217 | return $hashes; |
218 | 218 | } |
219 | 219 | |
220 | - /** |
|
221 | - * Retrieves all hashes for the specified language ID. |
|
222 | - * |
|
223 | - * @param string $languageID The language ID, e.g. "PHP" |
|
224 | - * @return Localization_Scanner_StringHash[] |
|
225 | - */ |
|
220 | + /** |
|
221 | + * Retrieves all hashes for the specified language ID. |
|
222 | + * |
|
223 | + * @param string $languageID The language ID, e.g. "PHP" |
|
224 | + * @return Localization_Scanner_StringHash[] |
|
225 | + */ |
|
226 | 226 | public function getHashesByLanguageID(string $languageID) : array |
227 | 227 | { |
228 | 228 | $hashes = array(); |
@@ -17,24 +17,24 @@ discard block |
||
17 | 17 | const FILES_LOCALES = 'locales'; |
18 | 18 | const FILES_CACHE_KEY = 'cachekey'; |
19 | 19 | |
20 | - /** |
|
21 | - * @var bool |
|
22 | - */ |
|
20 | + /** |
|
21 | + * @var bool |
|
22 | + */ |
|
23 | 23 | protected $force = false; |
24 | 24 | |
25 | - /** |
|
26 | - * @var Localization_Translator |
|
27 | - */ |
|
25 | + /** |
|
26 | + * @var Localization_Translator |
|
27 | + */ |
|
28 | 28 | protected $translator; |
29 | 29 | |
30 | - /** |
|
31 | - * @var string |
|
32 | - */ |
|
30 | + /** |
|
31 | + * @var string |
|
32 | + */ |
|
33 | 33 | protected $targetFolder; |
34 | 34 | |
35 | - /** |
|
36 | - * @var string |
|
37 | - */ |
|
35 | + /** |
|
36 | + * @var string |
|
37 | + */ |
|
38 | 38 | protected $cacheKeyFile; |
39 | 39 | |
40 | 40 | /** |
@@ -119,14 +119,14 @@ discard block |
||
119 | 119 | $this->writeCacheKey(); |
120 | 120 | } |
121 | 121 | |
122 | - /** |
|
123 | - * Retrieves a list of all localization client |
|
124 | - * files that are written to disk. This includes |
|
125 | - * the locale files and the libraries required |
|
126 | - * to make it work clientside. |
|
127 | - * |
|
128 | - * @return string[] |
|
129 | - */ |
|
122 | + /** |
|
123 | + * Retrieves a list of all localization client |
|
124 | + * files that are written to disk. This includes |
|
125 | + * the locale files and the libraries required |
|
126 | + * to make it work clientside. |
|
127 | + * |
|
128 | + * @return string[] |
|
129 | + */ |
|
130 | 130 | public function getFilesList() : array |
131 | 131 | { |
132 | 132 | $files = array(); |
@@ -279,11 +279,11 @@ discard block |
||
279 | 279 | $this->written[self::FILES_LOCALES] = true; |
280 | 280 | } |
281 | 281 | |
282 | - /** |
|
283 | - * Generates the cache key file, which is used to determine |
|
284 | - * automatically whether the client libraries need to be |
|
285 | - * refreshed. |
|
286 | - */ |
|
282 | + /** |
|
283 | + * Generates the cache key file, which is used to determine |
|
284 | + * automatically whether the client libraries need to be |
|
285 | + * refreshed. |
|
286 | + */ |
|
287 | 287 | protected function writeCacheKey() : void |
288 | 288 | { |
289 | 289 | if(file_exists($this->cacheKeyFile) && !$this->force) { |
@@ -23,25 +23,25 @@ discard block |
||
23 | 23 | */ |
24 | 24 | class Localization_Editor_Filters |
25 | 25 | { |
26 | - /** |
|
27 | - * @var Localization_Editor |
|
28 | - */ |
|
26 | + /** |
|
27 | + * @var Localization_Editor |
|
28 | + */ |
|
29 | 29 | protected $editor; |
30 | 30 | |
31 | - /** |
|
32 | - * @var Request |
|
33 | - */ |
|
31 | + /** |
|
32 | + * @var Request |
|
33 | + */ |
|
34 | 34 | |
35 | 35 | protected $request; |
36 | 36 | |
37 | - /** |
|
38 | - * @var string |
|
39 | - */ |
|
37 | + /** |
|
38 | + * @var string |
|
39 | + */ |
|
40 | 40 | protected $sessionName = 'localize_filters'; |
41 | 41 | |
42 | - /** |
|
43 | - * @var string[] |
|
44 | - */ |
|
42 | + /** |
|
43 | + * @var string[] |
|
44 | + */ |
|
45 | 45 | protected $vars = array( |
46 | 46 | 'resetfilter' => '', |
47 | 47 | 'filter' => '', |
@@ -204,13 +204,13 @@ discard block |
||
204 | 204 | <form class="form-inline"> |
205 | 205 | <div class="form-hiddens"> |
206 | 206 | <?php |
207 | - $params = $this->editor->getRequestParams(); |
|
208 | - foreach($params as $name => $value) { |
|
209 | - ?> |
|
207 | + $params = $this->editor->getRequestParams(); |
|
208 | + foreach($params as $name => $value) { |
|
209 | + ?> |
|
210 | 210 | <input type="hidden" name="<?php echo $name ?>" value="<?php echo $value ?>"> |
211 | 211 | <?php |
212 | - } |
|
213 | - ?> |
|
212 | + } |
|
213 | + ?> |
|
214 | 214 | </div> |
215 | 215 | <div class="form-row"> |
216 | 216 | <div class="col-auto"> |
@@ -218,42 +218,42 @@ discard block |
||
218 | 218 | </div> |
219 | 219 | <div class="col-auto"> |
220 | 220 | <?php |
221 | - echo $this->renderSelect( |
|
222 | - $this->vars['status'], |
|
223 | - array( |
|
224 | - array( |
|
225 | - 'value' => '', |
|
226 | - 'label' => t('Status...') |
|
227 | - ), |
|
228 | - array( |
|
229 | - 'value' => 'untranslated', |
|
230 | - 'label' => t('Not translated') |
|
231 | - ), |
|
232 | - array( |
|
233 | - 'value' => 'translated', |
|
234 | - 'label' => t('Translated') |
|
235 | - ) |
|
236 | - ) |
|
237 | - ); |
|
221 | + echo $this->renderSelect( |
|
222 | + $this->vars['status'], |
|
223 | + array( |
|
224 | + array( |
|
225 | + 'value' => '', |
|
226 | + 'label' => t('Status...') |
|
227 | + ), |
|
228 | + array( |
|
229 | + 'value' => 'untranslated', |
|
230 | + 'label' => t('Not translated') |
|
231 | + ), |
|
232 | + array( |
|
233 | + 'value' => 'translated', |
|
234 | + 'label' => t('Translated') |
|
235 | + ) |
|
236 | + ) |
|
237 | + ); |
|
238 | 238 | |
239 | - echo $this->renderSelect( |
|
240 | - $this->vars['location'], |
|
241 | - array( |
|
242 | - array( |
|
243 | - 'value' => '', |
|
244 | - 'label' => t('Location...') |
|
245 | - ), |
|
246 | - array( |
|
247 | - 'value' => 'client', |
|
248 | - 'label' => t('Clientside') |
|
249 | - ), |
|
250 | - array( |
|
251 | - 'value' => 'server', |
|
252 | - 'label' => t('Serverside') |
|
253 | - ) |
|
254 | - ) |
|
255 | - ); |
|
256 | - ?> |
|
239 | + echo $this->renderSelect( |
|
240 | + $this->vars['location'], |
|
241 | + array( |
|
242 | + array( |
|
243 | + 'value' => '', |
|
244 | + 'label' => t('Location...') |
|
245 | + ), |
|
246 | + array( |
|
247 | + 'value' => 'client', |
|
248 | + 'label' => t('Clientside') |
|
249 | + ), |
|
250 | + array( |
|
251 | + 'value' => 'server', |
|
252 | + 'label' => t('Serverside') |
|
253 | + ) |
|
254 | + ) |
|
255 | + ); |
|
256 | + ?> |
|
257 | 257 | </div> |
258 | 258 | <div class="col-auto"> |
259 | 259 | <button type="submit" name="<?php echo $this->vars['filter'] ?>" value="yes" class="btn btn-primary mb-2" title="<?php pt('Filter the list with the selected criteria.') ?>" data-toggle="tooltip"> |
@@ -268,9 +268,9 @@ discard block |
||
268 | 268 | </form> |
269 | 269 | <p> |
270 | 270 | <small class="text-muted"><?php |
271 | - pts('Hint:'); |
|
272 | - pt('Search works in translated and untranslated text, as well as the file name.') |
|
273 | - ?></small> |
|
271 | + pts('Hint:'); |
|
272 | + pt('Search works in translated and untranslated text, as well as the file name.') |
|
273 | + ?></small> |
|
274 | 274 | </p> |
275 | 275 | <br> |
276 | 276 | <?php |
@@ -37,54 +37,54 @@ discard block |
||
37 | 37 | const ERROR_NO_SOURCES_AVAILABLE = 40001; |
38 | 38 | const ERROR_LOCAL_PATH_NOT_FOUND = 40002; |
39 | 39 | |
40 | - /** |
|
41 | - * @var string |
|
42 | - */ |
|
40 | + /** |
|
41 | + * @var string |
|
42 | + */ |
|
43 | 43 | protected $installPath; |
44 | 44 | |
45 | - /** |
|
46 | - * @var Localization_Source[] |
|
47 | - */ |
|
45 | + /** |
|
46 | + * @var Localization_Source[] |
|
47 | + */ |
|
48 | 48 | protected $sources; |
49 | 49 | |
50 | - /** |
|
51 | - * @var Request |
|
52 | - */ |
|
50 | + /** |
|
51 | + * @var Request |
|
52 | + */ |
|
53 | 53 | protected $request; |
54 | 54 | |
55 | - /** |
|
56 | - * @var Localization_Source |
|
57 | - */ |
|
55 | + /** |
|
56 | + * @var Localization_Source |
|
57 | + */ |
|
58 | 58 | protected $activeSource; |
59 | 59 | |
60 | - /** |
|
61 | - * @var Localization_Scanner |
|
62 | - */ |
|
60 | + /** |
|
61 | + * @var Localization_Scanner |
|
62 | + */ |
|
63 | 63 | protected $scanner; |
64 | 64 | |
65 | - /** |
|
66 | - * @var Localization_Locale[] |
|
67 | - */ |
|
65 | + /** |
|
66 | + * @var Localization_Locale[] |
|
67 | + */ |
|
68 | 68 | protected $appLocales = array(); |
69 | 69 | |
70 | - /** |
|
71 | - * @var Localization_Locale |
|
72 | - */ |
|
70 | + /** |
|
71 | + * @var Localization_Locale |
|
72 | + */ |
|
73 | 73 | protected $activeAppLocale; |
74 | 74 | |
75 | - /** |
|
76 | - * @var Localization_Editor_Filters |
|
77 | - */ |
|
75 | + /** |
|
76 | + * @var Localization_Editor_Filters |
|
77 | + */ |
|
78 | 78 | protected $filters; |
79 | 79 | |
80 | - /** |
|
81 | - * @var array<string,string> |
|
82 | - */ |
|
80 | + /** |
|
81 | + * @var array<string,string> |
|
82 | + */ |
|
83 | 83 | protected $requestParams = array(); |
84 | 84 | |
85 | - /** |
|
86 | - * @var string |
|
87 | - */ |
|
85 | + /** |
|
86 | + * @var string |
|
87 | + */ |
|
88 | 88 | protected $varPrefix = 'applocalize_'; |
89 | 89 | |
90 | 90 | /** |
@@ -125,15 +125,15 @@ discard block |
||
125 | 125 | return $this->request; |
126 | 126 | } |
127 | 127 | |
128 | - /** |
|
129 | - * Adds a request parameter that will be persisted in all URLs |
|
130 | - * within the editor. This can be used when integrating the |
|
131 | - * editor in an existing page that needs specific request params. |
|
132 | - * |
|
133 | - * @param string $name |
|
134 | - * @param string $value |
|
135 | - * @return Localization_Editor |
|
136 | - */ |
|
128 | + /** |
|
129 | + * Adds a request parameter that will be persisted in all URLs |
|
130 | + * within the editor. This can be used when integrating the |
|
131 | + * editor in an existing page that needs specific request params. |
|
132 | + * |
|
133 | + * @param string $name |
|
134 | + * @param string $value |
|
135 | + * @return Localization_Editor |
|
136 | + */ |
|
137 | 137 | public function addRequestParam(string $name, string $value) : Localization_Editor |
138 | 138 | { |
139 | 139 | $this->requestParams[$name] = $value; |
@@ -295,34 +295,34 @@ discard block |
||
295 | 295 | </a> |
296 | 296 | <div class="dropdown-menu" aria-labelledby="dropdown01"> |
297 | 297 | <?php |
298 | - foreach($this->sources as $source) |
|
299 | - { |
|
300 | - ?> |
|
298 | + foreach($this->sources as $source) |
|
299 | + { |
|
300 | + ?> |
|
301 | 301 | <a class="dropdown-item" href="<?php echo $this->getSourceURL($source) ?>"> |
302 | 302 | <?php |
303 | - if($source->getID() === $this->activeSource->getID()) |
|
304 | - { |
|
305 | - ?> |
|
303 | + if($source->getID() === $this->activeSource->getID()) |
|
304 | + { |
|
305 | + ?> |
|
306 | 306 | <b><?php echo $source->getLabel() ?></b> |
307 | 307 | <?php |
308 | - } |
|
309 | - else |
|
310 | - { |
|
311 | - echo $source->getLabel(); |
|
312 | - } |
|
313 | - ?> |
|
308 | + } |
|
309 | + else |
|
310 | + { |
|
311 | + echo $source->getLabel(); |
|
312 | + } |
|
313 | + ?> |
|
314 | 314 | <?php |
315 | - $untranslated = $source->countUntranslated($this->scanner); |
|
316 | - if($untranslated > 0) { |
|
317 | - ?> |
|
315 | + $untranslated = $source->countUntranslated($this->scanner); |
|
316 | + if($untranslated > 0) { |
|
317 | + ?> |
|
318 | 318 | (<span class="text-danger" title="<?php ptex('%1$s texts have not been translated in this text source.', 'Amount of texts', $untranslated) ?>"><?php echo $untranslated ?></span>) |
319 | 319 | <?php |
320 | - } |
|
321 | - ?> |
|
320 | + } |
|
321 | + ?> |
|
322 | 322 | </a> |
323 | 323 | <?php |
324 | - } |
|
325 | - ?> |
|
324 | + } |
|
325 | + ?> |
|
326 | 326 | </div> |
327 | 327 | </li> |
328 | 328 | <li class="nav-item dropdown"> |
@@ -331,15 +331,15 @@ discard block |
||
331 | 331 | </a> |
332 | 332 | <div class="dropdown-menu" aria-labelledby="dropdown01"> |
333 | 333 | <?php |
334 | - foreach($this->appLocales as $locale) |
|
335 | - { |
|
336 | - ?> |
|
334 | + foreach($this->appLocales as $locale) |
|
335 | + { |
|
336 | + ?> |
|
337 | 337 | <a class="dropdown-item" href="<?php echo $this->getLocaleURL($locale) ?>"> |
338 | 338 | <?php echo $locale->getLabel() ?> |
339 | 339 | </a> |
340 | 340 | <?php |
341 | - } |
|
342 | - ?> |
|
341 | + } |
|
342 | + ?> |
|
343 | 343 | </div> |
344 | 344 | </li> |
345 | 345 | <li class="nav-item"> |
@@ -349,8 +349,8 @@ discard block |
||
349 | 349 | </a> |
350 | 350 | </li> |
351 | 351 | <?php |
352 | - if($this->scanner->hasWarnings()) { |
|
353 | - ?> |
|
352 | + if($this->scanner->hasWarnings()) { |
|
353 | + ?> |
|
354 | 354 | <li class="nav-item"> |
355 | 355 | <a href="<?php echo $this->getWarningsURL() ?>"> |
356 | 356 | <span class="badge badge-warning" title="<?php pts('The last scan for translatable texts reported warnings.'); pts('Click for details.'); ?>" data-toggle="tooltip"> |
@@ -360,8 +360,8 @@ discard block |
||
360 | 360 | </a> |
361 | 361 | </li> |
362 | 362 | <?php |
363 | - } |
|
364 | - ?> |
|
363 | + } |
|
364 | + ?> |
|
365 | 365 | </ul> |
366 | 366 | <?php |
367 | 367 | } |
@@ -377,36 +377,36 @@ discard block |
||
377 | 377 | </a> |
378 | 378 | <?php |
379 | 379 | } |
380 | - ?> |
|
380 | + ?> |
|
381 | 381 | </div> |
382 | 382 | </nav> |
383 | 383 | <main role="main" class="container"> |
384 | 384 | <div> |
385 | 385 | <?php |
386 | - if(empty($this->appLocales)) |
|
387 | - { |
|
388 | - ?> |
|
386 | + if(empty($this->appLocales)) |
|
387 | + { |
|
388 | + ?> |
|
389 | 389 | <div class="alert alert-danger"> |
390 | 390 | <i class="fa fa-exclamation-triangle"></i> |
391 | 391 | <b><?php pt('Nothing to translate:') ?></b> |
392 | 392 | <?php pt('No application locales were added to translate to.') ?> |
393 | 393 | </div> |
394 | 394 | <?php |
395 | - } |
|
396 | - else if($this->request->getBool($this->getVarName('warnings'))) |
|
397 | - { |
|
398 | - echo $this->renderWarnings(); |
|
399 | - } |
|
400 | - else |
|
401 | - { |
|
402 | - ?> |
|
395 | + } |
|
396 | + else if($this->request->getBool($this->getVarName('warnings'))) |
|
397 | + { |
|
398 | + echo $this->renderWarnings(); |
|
399 | + } |
|
400 | + else |
|
401 | + { |
|
402 | + ?> |
|
403 | 403 | <h1><?php echo $this->activeSource->getLabel() ?></h1> |
404 | 404 | <?php |
405 | - if(!empty($_SESSION['localization_messages'])) |
|
406 | - { |
|
407 | - foreach($_SESSION['localization_messages'] as $def) |
|
408 | - { |
|
409 | - ?> |
|
405 | + if(!empty($_SESSION['localization_messages'])) |
|
406 | + { |
|
407 | + foreach($_SESSION['localization_messages'] as $def) |
|
408 | + { |
|
409 | + ?> |
|
410 | 410 | <div class="alert alert-<?php echo $def['type'] ?>" role="alert"> |
411 | 411 | <?php echo $def['text'] ?> |
412 | 412 | <button type="button" class="close" data-dismiss="alert" aria-label="<?php pt('Close') ?>" title="<?php pt('Dismiss this message.') ?>" data-toggle="tooltip"> |
@@ -414,28 +414,28 @@ discard block |
||
414 | 414 | </button> |
415 | 415 | </div> |
416 | 416 | <?php |
417 | - } |
|
417 | + } |
|
418 | 418 | |
419 | - // reset the messages after having displayed them |
|
420 | - $_SESSION['localization_messages'] = array(); |
|
421 | - } |
|
422 | - ?> |
|
419 | + // reset the messages after having displayed them |
|
420 | + $_SESSION['localization_messages'] = array(); |
|
421 | + } |
|
422 | + ?> |
|
423 | 423 | <p> |
424 | 424 | <?php |
425 | - pt( |
|
426 | - 'You are translating to %1$s', |
|
427 | - '<span class="badge badge-info">'. |
|
428 | - $this->activeAppLocale->getLabel(). |
|
429 | - '</span>' |
|
425 | + pt( |
|
426 | + 'You are translating to %1$s', |
|
427 | + '<span class="badge badge-info">'. |
|
428 | + $this->activeAppLocale->getLabel(). |
|
429 | + '</span>' |
|
430 | 430 | ); |
431 | - ?><br> |
|
431 | + ?><br> |
|
432 | 432 | <?php pt('Found %1$s texts to translate.', $this->activeSource->countUntranslated($this->scanner)) ?> |
433 | 433 | </p> |
434 | 434 | <br> |
435 | 435 | <?php |
436 | - if(!$this->scanner->isScanAvailable()) |
|
437 | - { |
|
438 | - ?> |
|
436 | + if(!$this->scanner->isScanAvailable()) |
|
437 | + { |
|
438 | + ?> |
|
439 | 439 | <div class="alert alert-primary" role="alert"> |
440 | 440 | <b><?php pt('No texts found:') ?></b> |
441 | 441 | <?php pt('The source folders have not been scanned yet.') ?> |
@@ -447,15 +447,15 @@ discard block |
||
447 | 447 | </a> |
448 | 448 | </p> |
449 | 449 | <?php |
450 | - } |
|
451 | - else |
|
452 | - { |
|
453 | - echo $this->filters->renderForm(); |
|
450 | + } |
|
451 | + else |
|
452 | + { |
|
453 | + echo $this->filters->renderForm(); |
|
454 | 454 | |
455 | - $this->displayList(); |
|
456 | - } |
|
457 | - } |
|
458 | - ?> |
|
455 | + $this->displayList(); |
|
456 | + } |
|
457 | + } |
|
458 | + ?> |
|
459 | 459 | </div> |
460 | 460 | </main> |
461 | 461 | </body> |
@@ -473,22 +473,22 @@ discard block |
||
473 | 473 | <h1><?php pt('Warnings') ?></h1> |
474 | 474 | <p class="abstract"> |
475 | 475 | <?php |
476 | - pts('The following shows all texts where the system decided that they cannot be translated.'); |
|
477 | - ?> |
|
476 | + pts('The following shows all texts where the system decided that they cannot be translated.'); |
|
477 | + ?> |
|
478 | 478 | </p> |
479 | 479 | <dl> |
480 | 480 | <?php |
481 | - $warnings = $this->scanner->getWarnings(); |
|
481 | + $warnings = $this->scanner->getWarnings(); |
|
482 | 482 | |
483 | - foreach($warnings as $warning) |
|
484 | - { |
|
485 | - ?> |
|
483 | + foreach($warnings as $warning) |
|
484 | + { |
|
485 | + ?> |
|
486 | 486 | <dt><?php echo FileHelper::relativizePathByDepth($warning->getFile(), 3) ?>:<?php echo $warning->getLine() ?></dt> |
487 | 487 | <dd><?php echo $warning->getMessage() ?></dd> |
488 | 488 | <?php |
489 | - } |
|
489 | + } |
|
490 | 490 | |
491 | - ?> |
|
491 | + ?> |
|
492 | 492 | </dl> |
493 | 493 | <?php |
494 | 494 | |
@@ -558,13 +558,13 @@ discard block |
||
558 | 558 | <form method="post"> |
559 | 559 | <div class="form-hiddens"> |
560 | 560 | <?php |
561 | - $params = $this->getRequestParams(); |
|
562 | - foreach($params as $name => $value) { |
|
563 | - ?> |
|
561 | + $params = $this->getRequestParams(); |
|
562 | + foreach($params as $name => $value) { |
|
563 | + ?> |
|
564 | 564 | <input type="hidden" name="<?php echo $name ?>" value="<?php echo $value ?>"> |
565 | 565 | <?php |
566 | - } |
|
567 | - ?> |
|
566 | + } |
|
567 | + ?> |
|
568 | 568 | </div> |
569 | 569 | <table class="table table-hover"> |
570 | 570 | <thead> |
@@ -577,20 +577,20 @@ discard block |
||
577 | 577 | </thead> |
578 | 578 | <tbody> |
579 | 579 | <?php |
580 | - foreach($keep as $string) |
|
581 | - { |
|
582 | - $this->renderListEntry($string); |
|
583 | - } |
|
584 | - ?> |
|
580 | + foreach($keep as $string) |
|
581 | + { |
|
582 | + $this->renderListEntry($string); |
|
583 | + } |
|
584 | + ?> |
|
585 | 585 | </tbody> |
586 | 586 | </table> |
587 | 587 | <?php |
588 | - if($pager->hasPages()) |
|
589 | - { |
|
590 | - $prevUrl = $this->getPaginationURL($pager->getPreviousPage()); |
|
591 | - $nextUrl = $this->getPaginationURL($pager->getNextPage()); |
|
588 | + if($pager->hasPages()) |
|
589 | + { |
|
590 | + $prevUrl = $this->getPaginationURL($pager->getPreviousPage()); |
|
591 | + $nextUrl = $this->getPaginationURL($pager->getNextPage()); |
|
592 | 592 | |
593 | - ?> |
|
593 | + ?> |
|
594 | 594 | <nav aria-label="<?php pt('Navigate available pages of texts.') ?>"> |
595 | 595 | <ul class="pagination"> |
596 | 596 | <li class="page-item"> |
@@ -599,20 +599,20 @@ discard block |
||
599 | 599 | </a> |
600 | 600 | </li> |
601 | 601 | <?php |
602 | - $numbers = $pager->getPageNumbers(); |
|
603 | - foreach($numbers as $number) |
|
604 | - { |
|
605 | - $url = $this->getPaginationURL($number); |
|
602 | + $numbers = $pager->getPageNumbers(); |
|
603 | + foreach($numbers as $number) |
|
604 | + { |
|
605 | + $url = $this->getPaginationURL($number); |
|
606 | 606 | |
607 | - ?> |
|
607 | + ?> |
|
608 | 608 | <li class="page-item <?php if($pager->isCurrentPage($number)) { echo 'active'; } ?>"> |
609 | 609 | <a class="page-link" href="<?php echo $url ?>"> |
610 | 610 | <?php echo $number ?> |
611 | 611 | </a> |
612 | 612 | </li> |
613 | 613 | <?php |
614 | - } |
|
615 | - ?> |
|
614 | + } |
|
615 | + ?> |
|
616 | 616 | <li class="page-item"> |
617 | 617 | <a class="page-link" href="<?php echo $nextUrl ?>"> |
618 | 618 | <i class="fa fa-arrow-right"></i> |
@@ -621,8 +621,8 @@ discard block |
||
621 | 621 | </ul> |
622 | 622 | </nav> |
623 | 623 | <?php |
624 | - } |
|
625 | - ?> |
|
624 | + } |
|
625 | + ?> |
|
626 | 626 | <br> |
627 | 627 | <p> |
628 | 628 | <button type="submit" name="<?php echo $this->getVarName('save') ?>" value="yes" class="btn btn-primary"> |
@@ -693,46 +693,46 @@ discard block |
||
693 | 693 | <div class="files-list"> |
694 | 694 | <p> |
695 | 695 | <?php |
696 | - $totalFiles = count($files); |
|
696 | + $totalFiles = count($files); |
|
697 | 697 | |
698 | - if($totalFiles == 1) |
|
699 | - { |
|
700 | - pt('Found in a single file:'); |
|
701 | - } |
|
702 | - else |
|
703 | - { |
|
704 | - pt('Found in %1$s files:', $totalFiles); |
|
705 | - } |
|
706 | - ?> |
|
698 | + if($totalFiles == 1) |
|
699 | + { |
|
700 | + pt('Found in a single file:'); |
|
701 | + } |
|
702 | + else |
|
703 | + { |
|
704 | + pt('Found in %1$s files:', $totalFiles); |
|
705 | + } |
|
706 | + ?> |
|
707 | 707 | </p> |
708 | 708 | <div class="files-scroller"> |
709 | 709 | <ul> |
710 | 710 | <?php |
711 | - $locations = $string->getStrings(); |
|
711 | + $locations = $string->getStrings(); |
|
712 | 712 | |
713 | - foreach($locations as $location) |
|
714 | - { |
|
715 | - $file = $location->getSourceFile(); |
|
716 | - $line = $location->getLine(); |
|
713 | + foreach($locations as $location) |
|
714 | + { |
|
715 | + $file = $location->getSourceFile(); |
|
716 | + $line = $location->getLine(); |
|
717 | 717 | |
718 | - $ext = FileHelper::getExtension($file); |
|
718 | + $ext = FileHelper::getExtension($file); |
|
719 | 719 | |
720 | - if($ext == 'php') { |
|
721 | - $icon = 'fab fa-php'; |
|
722 | - } else if($ext == 'js') { |
|
723 | - $icon = 'fab fa-js-square'; |
|
724 | - } else { |
|
725 | - $icon = 'fas fa-file-code'; |
|
726 | - } |
|
720 | + if($ext == 'php') { |
|
721 | + $icon = 'fab fa-php'; |
|
722 | + } else if($ext == 'js') { |
|
723 | + $icon = 'fab fa-js-square'; |
|
724 | + } else { |
|
725 | + $icon = 'fas fa-file-code'; |
|
726 | + } |
|
727 | 727 | |
728 | - ?> |
|
728 | + ?> |
|
729 | 729 | <li> |
730 | 730 | <i class="<?php echo $icon ?>"></i> |
731 | 731 | <?php echo $file ?><span class="line-number">:<?php echo $line ?></span> |
732 | 732 | </li> |
733 | 733 | <?php |
734 | - } |
|
735 | - ?> |
|
734 | + } |
|
735 | + ?> |
|
736 | 736 | </ul> |
737 | 737 | </div> |
738 | 738 | </div> |
@@ -949,13 +949,13 @@ discard block |
||
949 | 949 | ); |
950 | 950 | } |
951 | 951 | |
952 | - /** |
|
953 | - * Sets the application name shown in the main navigation |
|
954 | - * in the user interface. |
|
955 | - * |
|
956 | - * @param string $name |
|
957 | - * @return Localization_Editor |
|
958 | - */ |
|
952 | + /** |
|
953 | + * Sets the application name shown in the main navigation |
|
954 | + * in the user interface. |
|
955 | + * |
|
956 | + * @param string $name |
|
957 | + * @return Localization_Editor |
|
958 | + */ |
|
959 | 959 | public function setAppName(string $name) : Localization_Editor |
960 | 960 | { |
961 | 961 | $this->setOption('appname', $name); |
@@ -985,15 +985,15 @@ discard block |
||
985 | 985 | return $this; |
986 | 986 | } |
987 | 987 | |
988 | - /** |
|
989 | - * Sets an URL that the translators can use to go back to |
|
990 | - * the main application, for example if it is integrated into |
|
991 | - * an existing application. |
|
992 | - * |
|
993 | - * @param string $url The URL to use for the link |
|
994 | - * @param string $label Label of the link |
|
995 | - * @return Localization_Editor |
|
996 | - */ |
|
988 | + /** |
|
989 | + * Sets an URL that the translators can use to go back to |
|
990 | + * the main application, for example if it is integrated into |
|
991 | + * an existing application. |
|
992 | + * |
|
993 | + * @param string $url The URL to use for the link |
|
994 | + * @param string $label Label of the link |
|
995 | + * @return Localization_Editor |
|
996 | + */ |
|
997 | 997 | public function setBackURL(string $url, string $label) : Localization_Editor |
998 | 998 | { |
999 | 999 | $this->setOption('back-url', $url); |
@@ -53,11 +53,11 @@ discard block |
||
53 | 53 | const EVENT_LOCALE_CHANGED = 'LocaleChanged'; |
54 | 54 | |
55 | 55 | /** |
56 | - * Collection of all locales by namespace (application, content, custom...). |
|
57 | - * |
|
58 | - * @var array<string,array<string,Localization_Locale>> |
|
59 | - * @see Localization::addLocale() |
|
60 | - */ |
|
56 | + * Collection of all locales by namespace (application, content, custom...). |
|
57 | + * |
|
58 | + * @var array<string,array<string,Localization_Locale>> |
|
59 | + * @see Localization::addLocale() |
|
60 | + */ |
|
61 | 61 | protected static $locales = array(); |
62 | 62 | |
63 | 63 | /** |
@@ -66,57 +66,57 @@ discard block |
||
66 | 66 | */ |
67 | 67 | private static $initDone = false; |
68 | 68 | |
69 | - /** |
|
70 | - * Path to the file in which the scanner results are stored. |
|
71 | - * @var string |
|
72 | - * @see Localization::configure() |
|
73 | - */ |
|
69 | + /** |
|
70 | + * Path to the file in which the scanner results are stored. |
|
71 | + * @var string |
|
72 | + * @see Localization::configure() |
|
73 | + */ |
|
74 | 74 | protected static $storageFile = ''; |
75 | 75 | |
76 | - /** |
|
77 | - * Path to the folder into which the client libraries are written. |
|
78 | - * @var string |
|
79 | - * @see Localization::setClientLibrariesFolder() |
|
80 | - */ |
|
76 | + /** |
|
77 | + * Path to the folder into which the client libraries are written. |
|
78 | + * @var string |
|
79 | + * @see Localization::setClientLibrariesFolder() |
|
80 | + */ |
|
81 | 81 | protected static $clientFolder = ''; |
82 | 82 | |
83 | - /** |
|
84 | - * If this key changes, client libraries are refreshed. |
|
85 | - * @var string |
|
86 | - * @see Localization::setClientLibrariesCacheKey() |
|
87 | - */ |
|
83 | + /** |
|
84 | + * If this key changes, client libraries are refreshed. |
|
85 | + * @var string |
|
86 | + * @see Localization::setClientLibrariesCacheKey() |
|
87 | + */ |
|
88 | 88 | protected static $clientCacheKey = ''; |
89 | 89 | |
90 | - /** |
|
91 | - * Whether the configuration has been made. |
|
92 | - * @var bool |
|
93 | - * @see Localization::configure() |
|
94 | - */ |
|
90 | + /** |
|
91 | + * Whether the configuration has been made. |
|
92 | + * @var bool |
|
93 | + * @see Localization::configure() |
|
94 | + */ |
|
95 | 95 | protected static $configured = false; |
96 | 96 | |
97 | - /** |
|
98 | - * Stores event listener instances. |
|
99 | - * @var array |
|
100 | - */ |
|
97 | + /** |
|
98 | + * Stores event listener instances. |
|
99 | + * @var array |
|
100 | + */ |
|
101 | 101 | protected static $listeners = array(); |
102 | 102 | |
103 | - /** |
|
104 | - * @var integer |
|
105 | - * @see Localization::addEventListener() |
|
106 | - */ |
|
103 | + /** |
|
104 | + * @var integer |
|
105 | + * @see Localization::addEventListener() |
|
106 | + */ |
|
107 | 107 | protected static $listenersCounter = 0; |
108 | 108 | |
109 | - /** |
|
110 | - * @var Localization_Translator|NULL |
|
111 | - */ |
|
109 | + /** |
|
110 | + * @var Localization_Translator|NULL |
|
111 | + */ |
|
112 | 112 | protected static $translator; |
113 | 113 | |
114 | - /** |
|
115 | - * Initializes the localization layer. This is done |
|
116 | - * automatically, and only once per request. |
|
117 | - * |
|
118 | - * (Called at the end of this file) |
|
119 | - */ |
|
114 | + /** |
|
115 | + * Initializes the localization layer. This is done |
|
116 | + * automatically, and only once per request. |
|
117 | + * |
|
118 | + * (Called at the end of this file) |
|
119 | + */ |
|
120 | 120 | public static function init() : void |
121 | 121 | { |
122 | 122 | if(self::$initDone) { |
@@ -155,12 +155,12 @@ discard block |
||
155 | 155 | return self::getLocalesByNS(self::NAMESPACE_APPLICATION); |
156 | 156 | } |
157 | 157 | |
158 | - /** |
|
159 | - * Retrieves all locales in the specified namespace. |
|
160 | - * |
|
161 | - * @param string $namespace |
|
162 | - * @return Localization_Locale[] |
|
163 | - */ |
|
158 | + /** |
|
159 | + * Retrieves all locales in the specified namespace. |
|
160 | + * |
|
161 | + * @param string $namespace |
|
162 | + * @return Localization_Locale[] |
|
163 | + */ |
|
164 | 164 | public static function getLocalesByNS(string $namespace) |
165 | 165 | { |
166 | 166 | if(isset(self::$locales[$namespace])) { |
@@ -177,35 +177,35 @@ discard block |
||
177 | 177 | ); |
178 | 178 | } |
179 | 179 | |
180 | - /** |
|
181 | - * Adds an application locale to use in the application. |
|
182 | - * |
|
183 | - * @param string $localeName |
|
184 | - * @return Localization_Locale |
|
185 | - */ |
|
180 | + /** |
|
181 | + * Adds an application locale to use in the application. |
|
182 | + * |
|
183 | + * @param string $localeName |
|
184 | + * @return Localization_Locale |
|
185 | + */ |
|
186 | 186 | public static function addAppLocale(string $localeName) : Localization_Locale |
187 | 187 | { |
188 | 188 | return self::addLocaleByNS($localeName, self::NAMESPACE_APPLICATION); |
189 | 189 | } |
190 | 190 | |
191 | - /** |
|
192 | - * Adds a content locale to use for content in the application. |
|
193 | - * |
|
194 | - * @param string $localeName |
|
195 | - * @return Localization_Locale |
|
196 | - */ |
|
191 | + /** |
|
192 | + * Adds a content locale to use for content in the application. |
|
193 | + * |
|
194 | + * @param string $localeName |
|
195 | + * @return Localization_Locale |
|
196 | + */ |
|
197 | 197 | public static function addContentLocale(string $localeName) : Localization_Locale |
198 | 198 | { |
199 | 199 | return self::addLocaleByNS($localeName, self::NAMESPACE_CONTENT); |
200 | 200 | } |
201 | 201 | |
202 | - /** |
|
203 | - * Adds a locale to the specified namespace. |
|
204 | - * |
|
205 | - * @param string $localeName |
|
206 | - * @param string $namespace |
|
207 | - * @return Localization_Locale |
|
208 | - */ |
|
202 | + /** |
|
203 | + * Adds a locale to the specified namespace. |
|
204 | + * |
|
205 | + * @param string $localeName |
|
206 | + * @param string $namespace |
|
207 | + * @return Localization_Locale |
|
208 | + */ |
|
209 | 209 | public static function addLocaleByNS(string $localeName, string $namespace) : Localization_Locale |
210 | 210 | { |
211 | 211 | if(!isset(self::$locales[$namespace])) { |
@@ -343,45 +343,45 @@ discard block |
||
343 | 343 | return self::getSelectedLocaleByNS(self::NAMESPACE_APPLICATION); |
344 | 344 | } |
345 | 345 | |
346 | - /** |
|
347 | - * Retrieves the name of the selected application locale. |
|
348 | - * |
|
349 | - * @return string |
|
350 | - */ |
|
346 | + /** |
|
347 | + * Retrieves the name of the selected application locale. |
|
348 | + * |
|
349 | + * @return string |
|
350 | + */ |
|
351 | 351 | public static function getAppLocaleName() : string |
352 | 352 | { |
353 | 353 | return self::getLocaleNameByNS(self::NAMESPACE_APPLICATION); |
354 | 354 | } |
355 | 355 | |
356 | - /** |
|
357 | - * Retrieves the names of the available application locales. |
|
358 | - * @return string[] |
|
359 | - */ |
|
356 | + /** |
|
357 | + * Retrieves the names of the available application locales. |
|
358 | + * @return string[] |
|
359 | + */ |
|
360 | 360 | public static function getAppLocaleNames() : array |
361 | 361 | { |
362 | 362 | return self::getLocaleNamesByNS(self::NAMESPACE_APPLICATION); |
363 | 363 | } |
364 | 364 | |
365 | - /** |
|
366 | - * Retrieves the selected locale name in the specified namespace. |
|
367 | - * |
|
368 | - * @param string $namespace |
|
369 | - * @throws Localization_Exception |
|
370 | - * @return string |
|
371 | - */ |
|
365 | + /** |
|
366 | + * Retrieves the selected locale name in the specified namespace. |
|
367 | + * |
|
368 | + * @param string $namespace |
|
369 | + * @throws Localization_Exception |
|
370 | + * @return string |
|
371 | + */ |
|
372 | 372 | public static function getLocaleNameByNS(string $namespace) : string |
373 | 373 | { |
374 | 374 | return self::getSelectedLocaleByNS($namespace)->getName(); |
375 | 375 | } |
376 | 376 | |
377 | - /** |
|
378 | - * Retrieves the selected locale instance for the specified namespace. |
|
379 | - * |
|
380 | - * @param string $namespace |
|
381 | - * @return Localization_Locale |
|
382 | - * @throws Localization_Exception |
|
383 | - * @see Localization::ERROR_NO_LOCALE_SELECTED_IN_NS |
|
384 | - */ |
|
377 | + /** |
|
378 | + * Retrieves the selected locale instance for the specified namespace. |
|
379 | + * |
|
380 | + * @param string $namespace |
|
381 | + * @return Localization_Locale |
|
382 | + * @throws Localization_Exception |
|
383 | + * @see Localization::ERROR_NO_LOCALE_SELECTED_IN_NS |
|
384 | + */ |
|
385 | 385 | public static function getSelectedLocaleByNS(string $namespace) : Localization_Locale |
386 | 386 | { |
387 | 387 | self::requireNamespace($namespace); |
@@ -400,24 +400,24 @@ discard block |
||
400 | 400 | ); |
401 | 401 | } |
402 | 402 | |
403 | - /** |
|
404 | - * Stores the selected locale names by namespace. |
|
405 | - * @var array<string,Localization_Locale> |
|
406 | - */ |
|
403 | + /** |
|
404 | + * Stores the selected locale names by namespace. |
|
405 | + * @var array<string,Localization_Locale> |
|
406 | + */ |
|
407 | 407 | protected static $selected = array(); |
408 | 408 | |
409 | - /** |
|
410 | - * Selects the active locale for the specified namespace. |
|
411 | - * |
|
412 | - * NOTE: Triggers the "LocaleChanged" event. |
|
413 | - * |
|
414 | - * @param string $localeName |
|
415 | - * @param string $namespace |
|
416 | - * @return Localization_Locale |
|
417 | - * @throws Localization_Exception |
|
418 | - * |
|
419 | - * @see Localization_Event_LocaleChanged |
|
420 | - */ |
|
409 | + /** |
|
410 | + * Selects the active locale for the specified namespace. |
|
411 | + * |
|
412 | + * NOTE: Triggers the "LocaleChanged" event. |
|
413 | + * |
|
414 | + * @param string $localeName |
|
415 | + * @param string $namespace |
|
416 | + * @return Localization_Locale |
|
417 | + * @throws Localization_Exception |
|
418 | + * |
|
419 | + * @see Localization_Event_LocaleChanged |
|
420 | + */ |
|
421 | 421 | public static function selectLocaleByNS(string $localeName, string $namespace) : Localization_Locale |
422 | 422 | { |
423 | 423 | self::requireNamespace($namespace); |
@@ -548,15 +548,15 @@ discard block |
||
548 | 548 | return self::selectLocaleByNS($localeName, self::NAMESPACE_APPLICATION); |
549 | 549 | } |
550 | 550 | |
551 | - /** |
|
552 | - * Retrieves an application locale by its name. |
|
553 | - * Note that the locale must have been added first. |
|
554 | - * |
|
555 | - * @param string $localeName |
|
556 | - * @throws Localization_Exception |
|
557 | - * @return Localization_Locale |
|
558 | - * @see Localization::appLocaleExists() |
|
559 | - */ |
|
551 | + /** |
|
552 | + * Retrieves an application locale by its name. |
|
553 | + * Note that the locale must have been added first. |
|
554 | + * |
|
555 | + * @param string $localeName |
|
556 | + * @throws Localization_Exception |
|
557 | + * @return Localization_Locale |
|
558 | + * @see Localization::appLocaleExists() |
|
559 | + */ |
|
560 | 560 | public static function getAppLocaleByName(string $localeName) : Localization_Locale |
561 | 561 | { |
562 | 562 | return self::getLocaleByNameNS($localeName, self::NAMESPACE_APPLICATION); |
@@ -591,10 +591,10 @@ discard block |
||
591 | 591 | return self::getLocalesByNS(self::NAMESPACE_CONTENT); |
592 | 592 | } |
593 | 593 | |
594 | - /** |
|
595 | - * Retrieves the names of all content locales that have been added. |
|
596 | - * @return string[] |
|
597 | - */ |
|
594 | + /** |
|
595 | + * Retrieves the names of all content locales that have been added. |
|
596 | + * @return string[] |
|
597 | + */ |
|
598 | 598 | public static function getContentLocaleNames() |
599 | 599 | { |
600 | 600 | return self::getLocaleNamesByNS(self::NAMESPACE_CONTENT); |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | sort($names); |
618 | 618 | |
619 | 619 | return $names; |
620 | - } |
|
620 | + } |
|
621 | 621 | |
622 | 622 | /** |
623 | 623 | * Checks by the locale name if the specified locale is |
@@ -646,14 +646,14 @@ discard block |
||
646 | 646 | return self::getLocaleByNameNS($localeName, self::NAMESPACE_CONTENT); |
647 | 647 | } |
648 | 648 | |
649 | - /** |
|
650 | - * Retrieves a locale by its name in the specified namespace. |
|
651 | - * |
|
652 | - * @param string $localeName |
|
653 | - * @param string $namespace |
|
654 | - * @throws Localization_Exception |
|
655 | - * @return Localization_Locale |
|
656 | - */ |
|
649 | + /** |
|
650 | + * Retrieves a locale by its name in the specified namespace. |
|
651 | + * |
|
652 | + * @param string $localeName |
|
653 | + * @param string $namespace |
|
654 | + * @throws Localization_Exception |
|
655 | + * @return Localization_Locale |
|
656 | + */ |
|
657 | 657 | public static function getLocaleByNameNS(string $localeName, string $namespace) : Localization_Locale |
658 | 658 | { |
659 | 659 | self::requireNamespace($namespace); |
@@ -724,10 +724,10 @@ discard block |
||
724 | 724 | return self::selectLocaleByNS($localeName, self::NAMESPACE_CONTENT); |
725 | 725 | } |
726 | 726 | |
727 | - /** |
|
728 | - * Checks whether the localization has been configured entirely. |
|
729 | - * @return bool |
|
730 | - */ |
|
727 | + /** |
|
728 | + * Checks whether the localization has been configured entirely. |
|
729 | + * @return bool |
|
730 | + */ |
|
731 | 731 | public static function isConfigured() : bool |
732 | 732 | { |
733 | 733 | return self::$configured; |
@@ -799,29 +799,29 @@ discard block |
||
799 | 799 | ); |
800 | 800 | } |
801 | 801 | |
802 | - /** |
|
803 | - * Injects a content locales selector element into the specified |
|
804 | - * HTML QuickForm2 container. |
|
805 | - * |
|
806 | - * @param string $elementName |
|
807 | - * @param HTML_QuickForm2_Container $container |
|
808 | - * @param string $label |
|
809 | - * @return HTML_QuickForm2_Element_Select |
|
810 | - */ |
|
802 | + /** |
|
803 | + * Injects a content locales selector element into the specified |
|
804 | + * HTML QuickForm2 container. |
|
805 | + * |
|
806 | + * @param string $elementName |
|
807 | + * @param HTML_QuickForm2_Container $container |
|
808 | + * @param string $label |
|
809 | + * @return HTML_QuickForm2_Element_Select |
|
810 | + */ |
|
811 | 811 | public static function injectContentLocalesSelector(string $elementName, HTML_QuickForm2_Container $container, string $label='') : HTML_QuickForm2_Element_Select |
812 | 812 | { |
813 | 813 | return self::injectLocalesSelectorNS($elementName, self::NAMESPACE_CONTENT, $container, $label); |
814 | 814 | } |
815 | 815 | |
816 | - /** |
|
817 | - * Injects an app locales selector element into the specified |
|
816 | + /** |
|
817 | + * Injects an app locales selector element into the specified |
|
818 | 818 | * HTML QuickForm2 container. |
819 | 819 | * |
820 | - * @param string $elementName |
|
821 | - * @param HTML_QuickForm2_Container $container |
|
822 | - * @param string $label |
|
823 | - * @return HTML_QuickForm2_Element_Select |
|
824 | - */ |
|
820 | + * @param string $elementName |
|
821 | + * @param HTML_QuickForm2_Container $container |
|
822 | + * @param string $label |
|
823 | + * @return HTML_QuickForm2_Element_Select |
|
824 | + */ |
|
825 | 825 | public static function injectAppLocalesSelector(string $elementName, HTML_QuickForm2_Container $container, string $label='') : HTML_QuickForm2_Element_Select |
826 | 826 | { |
827 | 827 | return self::injectLocalesSelectorNS($elementName, self::NAMESPACE_APPLICATION, $container, $label); |
@@ -857,26 +857,26 @@ discard block |
||
857 | 857 | return $select; |
858 | 858 | } |
859 | 859 | |
860 | - /** |
|
861 | - * @var Localization_Source[] |
|
862 | - */ |
|
860 | + /** |
|
861 | + * @var Localization_Source[] |
|
862 | + */ |
|
863 | 863 | protected static $sources = array(); |
864 | 864 | |
865 | - /** |
|
866 | - * @var string[] |
|
867 | - */ |
|
865 | + /** |
|
866 | + * @var string[] |
|
867 | + */ |
|
868 | 868 | protected static $excludeFolders = array(); |
869 | 869 | |
870 | - /** |
|
871 | - * @var string[] |
|
872 | - */ |
|
870 | + /** |
|
871 | + * @var string[] |
|
872 | + */ |
|
873 | 873 | protected static $excludeFiles = array(); |
874 | 874 | |
875 | - /** |
|
876 | - * Retrieves all currently available sources. |
|
877 | - * |
|
878 | - * @return Localization_Source[] |
|
879 | - */ |
|
875 | + /** |
|
876 | + * Retrieves all currently available sources. |
|
877 | + * |
|
878 | + * @return Localization_Source[] |
|
879 | + */ |
|
880 | 880 | public static function getSources() : array |
881 | 881 | { |
882 | 882 | return self::$sources; |
@@ -908,10 +908,10 @@ discard block |
||
908 | 908 | return $source; |
909 | 909 | } |
910 | 910 | |
911 | - /** |
|
912 | - * Retrieves all sources grouped by their group name. |
|
913 | - * @return array |
|
914 | - */ |
|
911 | + /** |
|
912 | + * Retrieves all sources grouped by their group name. |
|
913 | + * @return array |
|
914 | + */ |
|
915 | 915 | public static function getSourcesGrouped() |
916 | 916 | { |
917 | 917 | $sources = self::getSources(); |
@@ -932,11 +932,11 @@ discard block |
||
932 | 932 | return $grouped; |
933 | 933 | } |
934 | 934 | |
935 | - /** |
|
936 | - * Checks whether a specific source exists by its ID. |
|
937 | - * @param string $sourceID |
|
938 | - * @return boolean |
|
939 | - */ |
|
935 | + /** |
|
936 | + * Checks whether a specific source exists by its ID. |
|
937 | + * @param string $sourceID |
|
938 | + * @return boolean |
|
939 | + */ |
|
940 | 940 | public static function sourceExists(string $sourceID) : bool |
941 | 941 | { |
942 | 942 | $sources = self::getSources(); |
@@ -949,11 +949,11 @@ discard block |
||
949 | 949 | return false; |
950 | 950 | } |
951 | 951 | |
952 | - /** |
|
953 | - * Checks whether a specific source exists by its alias. |
|
954 | - * @param string $sourceAlias |
|
955 | - * @return boolean |
|
956 | - */ |
|
952 | + /** |
|
953 | + * Checks whether a specific source exists by its alias. |
|
954 | + * @param string $sourceAlias |
|
955 | + * @return boolean |
|
956 | + */ |
|
957 | 957 | public static function sourceAliasExists(string $sourceAlias) : bool |
958 | 958 | { |
959 | 959 | $sources = self::getSources(); |
@@ -966,13 +966,13 @@ discard block |
||
966 | 966 | return false; |
967 | 967 | } |
968 | 968 | |
969 | - /** |
|
970 | - * Retrieves a localization source by its ID. |
|
971 | - * |
|
972 | - * @param string $sourceID |
|
973 | - * @throws Localization_Exception |
|
974 | - * @return Localization_Source |
|
975 | - */ |
|
969 | + /** |
|
970 | + * Retrieves a localization source by its ID. |
|
971 | + * |
|
972 | + * @param string $sourceID |
|
973 | + * @throws Localization_Exception |
|
974 | + * @return Localization_Source |
|
975 | + */ |
|
976 | 976 | public static function getSourceByID(string $sourceID) : Localization_Source |
977 | 977 | { |
978 | 978 | $sources = self::getSources(); |
@@ -1062,17 +1062,17 @@ discard block |
||
1062 | 1062 | } |
1063 | 1063 | } |
1064 | 1064 | |
1065 | - /** |
|
1066 | - * Sets a key that is used to verify whether the client |
|
1067 | - * libraries have to be refreshed. A common use is to set |
|
1068 | - * this to the application's version number to guarantee |
|
1069 | - * new texts are automatically used with each release. |
|
1070 | - * |
|
1071 | - * NOTE: Otherwise files are refreshed only when saving |
|
1072 | - * them in the editor UI. |
|
1073 | - * |
|
1074 | - * @param string $key |
|
1075 | - */ |
|
1065 | + /** |
|
1066 | + * Sets a key that is used to verify whether the client |
|
1067 | + * libraries have to be refreshed. A common use is to set |
|
1068 | + * this to the application's version number to guarantee |
|
1069 | + * new texts are automatically used with each release. |
|
1070 | + * |
|
1071 | + * NOTE: Otherwise files are refreshed only when saving |
|
1072 | + * them in the editor UI. |
|
1073 | + * |
|
1074 | + * @param string $key |
|
1075 | + */ |
|
1076 | 1076 | public static function setClientLibrariesCacheKey(string $key) : void |
1077 | 1077 | { |
1078 | 1078 | self::$clientCacheKey = $key; |
@@ -1083,23 +1083,23 @@ discard block |
||
1083 | 1083 | return self::$clientCacheKey; |
1084 | 1084 | } |
1085 | 1085 | |
1086 | - /** |
|
1087 | - * Sets the folder where client libraries are to be stored. |
|
1088 | - * @param string $folder |
|
1089 | - */ |
|
1086 | + /** |
|
1087 | + * Sets the folder where client libraries are to be stored. |
|
1088 | + * @param string $folder |
|
1089 | + */ |
|
1090 | 1090 | public static function setClientLibrariesFolder(string $folder) : void |
1091 | 1091 | { |
1092 | 1092 | self::$clientFolder = $folder; |
1093 | 1093 | } |
1094 | 1094 | |
1095 | - /** |
|
1096 | - * Retrieves the path to the folder in which the client |
|
1097 | - * libraries should be stored. |
|
1098 | - * |
|
1099 | - * NOTE: Can return an empty string, when this is disabled. |
|
1100 | - * |
|
1101 | - * @return string |
|
1102 | - */ |
|
1095 | + /** |
|
1096 | + * Retrieves the path to the folder in which the client |
|
1097 | + * libraries should be stored. |
|
1098 | + * |
|
1099 | + * NOTE: Can return an empty string, when this is disabled. |
|
1100 | + * |
|
1101 | + * @return string |
|
1102 | + */ |
|
1103 | 1103 | public static function getClientLibrariesFolder() : string |
1104 | 1104 | { |
1105 | 1105 | return self::$clientFolder; |
@@ -1119,13 +1119,13 @@ discard block |
||
1119 | 1119 | self::createGenerator()->writeFiles($force); |
1120 | 1120 | } |
1121 | 1121 | |
1122 | - /** |
|
1123 | - * Creates a new instance of the client generator class |
|
1124 | - * that is used to write the localization files into the |
|
1125 | - * target folder on disk. |
|
1126 | - * |
|
1127 | - * @return Localization_ClientGenerator |
|
1128 | - */ |
|
1122 | + /** |
|
1123 | + * Creates a new instance of the client generator class |
|
1124 | + * that is used to write the localization files into the |
|
1125 | + * target folder on disk. |
|
1126 | + * |
|
1127 | + * @return Localization_ClientGenerator |
|
1128 | + */ |
|
1129 | 1129 | public static function createGenerator() : Localization_ClientGenerator |
1130 | 1130 | { |
1131 | 1131 | return new Localization_ClientGenerator(); |
@@ -1190,10 +1190,10 @@ discard block |
||
1190 | 1190 | return new Localization_Editor(); |
1191 | 1191 | } |
1192 | 1192 | |
1193 | - /** |
|
1194 | - * Retrieves a list of all available source IDs. |
|
1195 | - * @return string[] |
|
1196 | - */ |
|
1193 | + /** |
|
1194 | + * Retrieves a list of all available source IDs. |
|
1195 | + * @return string[] |
|
1196 | + */ |
|
1197 | 1197 | public static function getSourceIDs() : array |
1198 | 1198 | { |
1199 | 1199 | $ids = array(); |
@@ -1220,9 +1220,9 @@ discard block |
||
1220 | 1220 | return $aliases; |
1221 | 1221 | } |
1222 | 1222 | |
1223 | - /** |
|
1224 | - * Resets all locales to the built-in locale. |
|
1225 | - */ |
|
1223 | + /** |
|
1224 | + * Resets all locales to the built-in locale. |
|
1225 | + */ |
|
1226 | 1226 | public static function reset() : void |
1227 | 1227 | { |
1228 | 1228 | self::$locales = array(); |
@@ -1260,12 +1260,12 @@ discard block |
||
1260 | 1260 | return self::$supportedLocales; |
1261 | 1261 | } |
1262 | 1262 | |
1263 | - /** |
|
1264 | - * Checks whether the specified locale is supported. |
|
1265 | - * |
|
1266 | - * @param string $localeName |
|
1267 | - * @return bool |
|
1268 | - */ |
|
1263 | + /** |
|
1264 | + * Checks whether the specified locale is supported. |
|
1265 | + * |
|
1266 | + * @param string $localeName |
|
1267 | + * @return bool |
|
1268 | + */ |
|
1269 | 1269 | public static function isLocaleSupported(string $localeName) : bool |
1270 | 1270 | { |
1271 | 1271 | return file_exists(__DIR__.'/Localization/Locale/'.$localeName.'.php'); |
@@ -32,14 +32,14 @@ discard block |
||
32 | 32 | */ |
33 | 33 | protected $country; |
34 | 34 | |
35 | - /** |
|
36 | - * @var string |
|
37 | - */ |
|
35 | + /** |
|
36 | + * @var string |
|
37 | + */ |
|
38 | 38 | protected $countryCode; |
39 | 39 | |
40 | - /** |
|
41 | - * @var string |
|
42 | - */ |
|
40 | + /** |
|
41 | + * @var string |
|
42 | + */ |
|
43 | 43 | protected $languageCode; |
44 | 44 | |
45 | 45 | public function __construct() |
@@ -53,11 +53,11 @@ discard block |
||
53 | 53 | $this->languageCode = strtolower($tokens[0]); |
54 | 54 | } |
55 | 55 | |
56 | - /** |
|
57 | - * Retrieves the two-letter language code of the locale. |
|
58 | - * |
|
59 | - * @return string Language code, e.g. "en", "de" |
|
60 | - */ |
|
56 | + /** |
|
57 | + * Retrieves the two-letter language code of the locale. |
|
58 | + * |
|
59 | + * @return string Language code, e.g. "en", "de" |
|
60 | + */ |
|
61 | 61 | public function getLanguageCode() : string |
62 | 62 | { |
63 | 63 | return $this->languageCode; |
@@ -84,25 +84,25 @@ discard block |
||
84 | 84 | return $this->localeName; |
85 | 85 | } |
86 | 86 | |
87 | - /** |
|
88 | - * Retrieves the shortened version of the locale name, |
|
89 | - * e.g. "en" or "de". |
|
90 | - * |
|
91 | - * @return string |
|
92 | - * @deprecated |
|
93 | - * @see Localization_Locale::getLanguageCode() |
|
94 | - */ |
|
87 | + /** |
|
88 | + * Retrieves the shortened version of the locale name, |
|
89 | + * e.g. "en" or "de". |
|
90 | + * |
|
91 | + * @return string |
|
92 | + * @deprecated |
|
93 | + * @see Localization_Locale::getLanguageCode() |
|
94 | + */ |
|
95 | 95 | public function getShortName() : string |
96 | 96 | { |
97 | 97 | return $this->getLanguageCode(); |
98 | 98 | } |
99 | 99 | |
100 | - /** |
|
101 | - * Retrieves the two-letter country code of |
|
102 | - * the locale. |
|
103 | - * |
|
104 | - * @return string Lowercase code, e.g. "uk" |
|
105 | - */ |
|
100 | + /** |
|
101 | + * Retrieves the two-letter country code of |
|
102 | + * the locale. |
|
103 | + * |
|
104 | + * @return string Lowercase code, e.g. "uk" |
|
105 | + */ |
|
106 | 106 | public function getCountryCode() : string |
107 | 107 | { |
108 | 108 | return $this->countryCode; |
@@ -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->getText()->getText()); |