|
@@ -83,7 +83,7 @@ discard block |
|
|
block discarded – undo |
|
83
|
83
|
public function getTab() |
|
84
|
84
|
{ |
|
85
|
85
|
return '<span title="Translation"><img width="16px" height="16px" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB90DExAuL9uIsPUAAAQ2SURBVFjD7Ze9bxxVFMV/583skjgOIXEaKCNFAgmQ+ExS8qEUCEHH30BBScG/QM1fEmgoAAkoAigSKKFASElHESEFbGcdez7uoXhvZteW7ewmQjRMsTs7s/Pufeece+4d+P/4jw8ddvHq1avv2b5mm02Lr9Y7/gpQBCFDD5YhgsAoRLhHMtHnRYNAAb3yt92//9y3v3x+MFY6LIGIuGYbKedngzAGsPK5Kb8BGRAu9xiuL+zQ6NphsQ5NYB7YhA1jQCObyOHG/3sMlpM0hmGNcmXh7w9PYL5wfsphbCMPaOR7BipEJahV0FHZvZ2D+1i2qY+gYERCZTGZzLdFkLNIht/v72AHGM5Pa85MqowUc4p81PaPo2CgIa9RxOZ8jowDZm0WXo2oBdttN8ihIABC5dPLI7BIQQA5prEGIeYdbnVtSSpD3WCaCCqpMB8jXSshEBFEROZ9TCTvepC/be63HWA2ppNRoJttP1flvkp5BArmNBQl5zSIMJtNRxJEwHqVOF1XGLHVdSQp+0CpAi1UytJVYHteBQ7cm7AgIKnAH7CWhBDrVRqfud91UERLFNPyihQMwaOUIAI5I9D0PU2Xz9frCjs4WVVUMhJstR2SwaUWgvx7VQqyG2b4IoIoO9xsWipllJ6sK1JB7Exd4whmbUcYlCVcRKrVq0DSqCIVRlPZ4SCqO7MHC0Ey1Epiu+k5XafMvbRaFXCgdBxBOIgw202/TyNBtmuHibJRYba6LjuAsgjjCA3UxwWPCEwanRCJ7bYd/eHspFootdwhdvqeJsyegyaCSVK271US2E9BNp8otbTd9STlB89NJvRFmJREJ4K7e0El2Op6NiY1x7GQlpoawihgq+lIZF2s1xWdu9GAcO6Yp6rcE4OcwGDGR7nhUglYRjL32pbOQdMH61VCzgiFc8eUs+2cTIkuoI2MmH20D9TLzEzuTafgwtp0dNXO5FlhsOvSh23zzBPTBfDm4ny0BBBWAInWpSmVmSDzqrEko0TpBwct9W+xGgKL41hWoMeJB/LQsa/JlOYkVDrmAHlpwnF0M6of2gdIC7vUvDUNk1HMbwVRbmo+jA3tOlaYByTYbRJdiG1E3UFFg2IvLxqm67qR1yg71kLflDXvwhHhsxtbSycw2xWffXiPP+/NmFTiGyX21t9m99RbWDCZ1Fy5dAlJeXyz6aOfz48Mzli6aPTp8rMXz/585UVeun7z4WW418Kll0/w9Pk1/t5JTHdh2otpElMl1PX8eP06fdus9ObhQ2g4VBrVxpvvdl/Ovmgacev2Dnf+2GXnxi6zGw/KMJrNJUXPS6fXmCaNw+d8GNV8KHXgp87xyg83tVQCALPvLlvCVUK/3tnh9t3mkw8+/u3Tx3kNu/H6C7z6063lnLBU4dd98NHzF9Z47eKpE4/7Hngw+LHHzveX3zmAyBv/xsvpP+li/lm3bxkuAAAAAElFTkSuQmCC" />' |
|
86
|
|
- . $this->translator->getLocale() . ($this->untranslated ? ' <b>(' . count(array_unique($this->untranslated, SORT_REGULAR)) . ' errors)</b>' : '') |
|
|
86
|
+ . $this->translator->getLocale().($this->untranslated ? ' <b>('.count(array_unique($this->untranslated, SORT_REGULAR)).' errors)</b>' : '') |
|
87
|
87
|
. '</span>'; |
|
88
|
88
|
} |
|
89
|
89
|
|
|
@@ -114,17 +114,17 @@ discard block |
|
|
block discarded – undo |
|
114
|
114
|
|
|
115
|
115
|
/** @var \Nette\Application\Request[] $snapshot */ |
|
116
|
116
|
$params = $snapshot['request']->getParameters(); |
|
117
|
|
- $s .= '<tr><th width="10px"> </th>' . |
|
118
|
|
- '<th>' . $h($snapshot['request']->getPresenterName() . (isset($params['action']) ? ':' . $params['action'] : '')) . '</th>' . |
|
119
|
|
- '<th>' . $h($snapshot['locale']) . '</th></tr>'; |
|
|
117
|
+ $s .= '<tr><th width="10px"> </th>'. |
|
|
118
|
+ '<th>'.$h($snapshot['request']->getPresenterName().(isset($params['action']) ? ':'.$params['action'] : '')).'</th>'. |
|
|
119
|
+ '<th>'.$h($snapshot['locale']).'</th></tr>'; |
|
120
|
120
|
|
|
121
|
121
|
$l = 1; |
|
122
|
122
|
/** @var mixed[][] $snapshot */ |
|
123
|
123
|
foreach ($snapshot['resolvers'] as $name => $resolvedLocale) { |
|
124
|
|
- $s .= '<tr><td>' . ($l++) . '.</td><td>' . $h($name) . '</td><td>' . $h($resolvedLocale) . '</td></tr>'; |
|
|
124
|
+ $s .= '<tr><td>'.($l++).'.</td><td>'.$h($name).'</td><td>'.$h($resolvedLocale).'</td></tr>'; |
|
125
|
125
|
} |
|
126
|
126
|
|
|
127
|
|
- $panel[] = '<table style="width:100%">' . $s . '</table>'; |
|
|
127
|
+ $panel[] = '<table style="width:100%">'.$s.'</table>'; |
|
128
|
128
|
} |
|
129
|
129
|
} |
|
130
|
130
|
|
|
@@ -142,14 +142,13 @@ discard block |
|
|
block discarded – undo |
|
142
|
142
|
} |
|
143
|
143
|
|
|
144
|
144
|
$panel[] = '<h2>Ignored resources</h2>'; |
|
145
|
|
- $panel[] = '<p>Whitelist config: ' . implode(', ', array_map($h, $this->localeWhitelist)) . '</p>'; |
|
|
145
|
+ $panel[] = '<p>Whitelist config: '.implode(', ', array_map($h, $this->localeWhitelist)).'</p>'; |
|
146
|
146
|
$panel[] = $this->renderResources($this->ignoredResources); |
|
147
|
147
|
} |
|
148
|
148
|
|
|
149
|
|
- return empty($panel) ? '' : |
|
150
|
|
- '<h1>Missing translations: ' . count(array_unique($this->untranslated, SORT_REGULAR)) . |
|
151
|
|
- ', Resources: ' . count(Arrays::flatten($this->resources)) . '</h1>' . |
|
152
|
|
- '<div class="nette-inner tracy-inner kdyby-TranslationPanel" style="min-width:500px">' . implode($panel) . '</div>' . |
|
|
149
|
+ return empty($panel) ? '' : '<h1>Missing translations: '.count(array_unique($this->untranslated, SORT_REGULAR)). |
|
|
150
|
+ ', Resources: '.count(Arrays::flatten($this->resources)).'</h1>'. |
|
|
151
|
+ '<div class="nette-inner tracy-inner kdyby-TranslationPanel" style="min-width:500px">'.implode($panel).'</div>'. |
|
153
|
152
|
'<style> |
|
154
|
153
|
#nette-debug .kdyby-TranslationPanel h2, |
|
155
|
154
|
#tracy-debug .kdyby-TranslationPanel h2 {font-size: 23px;} |
|
@@ -167,19 +166,19 @@ discard block |
|
|
block discarded – undo |
|
167
|
166
|
$s .= '<tr><td>'; |
|
168
|
167
|
|
|
169
|
168
|
if ($message instanceof \Exception || $message instanceof \Throwable) { |
|
170
|
|
- $s .= '<span style="color:red">' . $h($message->getMessage()) . '</span>'; |
|
|
169
|
+ $s .= '<span style="color:red">'.$h($message->getMessage()).'</span>'; |
|
171
|
170
|
|
|
172
|
171
|
} elseif ($message instanceof Html) { |
|
173
|
|
- $s .= '<span style="color:red">Nette\Utils\Html(' . $h((string) $message) . ')</span>'; |
|
|
172
|
+ $s .= '<span style="color:red">Nette\Utils\Html('.$h((string) $message).')</span>'; |
|
174
|
173
|
|
|
175
|
174
|
} else { |
|
176
|
175
|
$s .= $h($message); |
|
177
|
176
|
} |
|
178
|
177
|
|
|
179
|
|
- $s .= '</td><td>' . $h($untranslated['domain']) . '</td></tr>'; |
|
|
178
|
+ $s .= '</td><td>'.$h($untranslated['domain']).'</td></tr>'; |
|
180
|
179
|
} |
|
181
|
180
|
|
|
182
|
|
- return '<table style="width:100%"><tr><th>Untranslated message</th><th>Translation domain</th></tr>' . $s . '</table>'; |
|
|
181
|
+ return '<table style="width:100%"><tr><th>Untranslated message</th><th>Translation domain</th></tr>'.$s.'</table>'; |
|
183
|
182
|
} |
|
184
|
183
|
|
|
185
|
184
|
private function renderResources($resourcesMap) |
|
@@ -191,25 +190,25 @@ discard block |
|
|
block discarded – undo |
|
191
|
190
|
foreach ($resourcesMap as $locale => $resources) { |
|
192
|
191
|
foreach ($resources as $resourcePath => $domain) { |
|
193
|
192
|
$s .= '<tr>'; |
|
194
|
|
- $s .= '<td>' . $h($locale) . '</td>'; |
|
195
|
|
- $s .= '<td>' . $h($domain) . '</td>'; |
|
|
193
|
+ $s .= '<td>'.$h($locale).'</td>'; |
|
|
194
|
+ $s .= '<td>'.$h($domain).'</td>'; |
|
196
|
195
|
|
|
197
|
|
- $relativePath = str_replace(rtrim($this->rootDir, '/') . '/', '', $resourcePath); |
|
|
196
|
+ $relativePath = str_replace(rtrim($this->rootDir, '/').'/', '', $resourcePath); |
|
198
|
197
|
if (Strings::startsWith($relativePath, 'vendor/')) { |
|
199
|
198
|
$parts = explode('/', $relativePath, 4); |
|
200
|
199
|
$left = array_pop($parts); |
|
201
|
|
- $relativePath = $h(implode('/', $parts) . '/.../') . '<b>' . $h(basename($left)) . '</b>'; |
|
|
200
|
+ $relativePath = $h(implode('/', $parts).'/.../').'<b>'.$h(basename($left)).'</b>'; |
|
202
|
201
|
|
|
203
|
202
|
} else { |
|
204
|
|
- $relativePath = $h(dirname($relativePath)) . '/<b>' . $h(basename($relativePath)) . '</b>'; |
|
|
203
|
+ $relativePath = $h(dirname($relativePath)).'/<b>'.$h(basename($relativePath)).'</b>'; |
|
205
|
204
|
} |
|
206
|
205
|
|
|
207
|
|
- $s .= '<td>' . self::editorLink($resourcePath, 1, $relativePath) . '</td>'; |
|
|
206
|
+ $s .= '<td>'.self::editorLink($resourcePath, 1, $relativePath).'</td>'; |
|
208
|
207
|
$s .= '</tr>'; |
|
209
|
208
|
} |
|
210
|
209
|
} |
|
211
|
210
|
|
|
212
|
|
- return '<table style="width:100%"><tr><th>Locale</th><th>Domain</th><th>Resource filename</th></tr>' . $s . '</table>'; |
|
|
211
|
+ return '<table style="width:100%"><tr><th>Locale</th><th>Domain</th><th>Resource filename</th></tr>'.$s.'</table>'; |
|
213
|
212
|
} |
|
214
|
213
|
|
|
215
|
214
|
/** |
|
@@ -245,7 +244,7 @@ discard block |
|
|
block discarded – undo |
|
245
|
244
|
public function addResource($format, $resource, $locale, $domain) |
|
246
|
245
|
{ |
|
247
|
246
|
if (is_array($resource)) { |
|
248
|
|
- $resource = 'array ' . md5(serialize($resource)); |
|
|
247
|
+ $resource = 'array '.md5(serialize($resource)); |
|
249
|
248
|
} |
|
250
|
249
|
|
|
251
|
250
|
$this->resources[$locale][$resource] = $domain; |
|
@@ -265,7 +264,7 @@ discard block |
|
|
block discarded – undo |
|
265
|
264
|
public function addIgnoredResource($format, $resource, $locale, $domain) |
|
266
|
265
|
{ |
|
267
|
266
|
if (is_array($resource)) { |
|
268
|
|
- $resource = 'array ' . md5(serialize($resource)); |
|
|
267
|
+ $resource = 'array '.md5(serialize($resource)); |
|
269
|
268
|
} |
|
270
|
269
|
|
|
271
|
270
|
$this->ignoredResources[$locale][$resource] = $domain; |
|
@@ -323,14 +322,14 @@ discard block |
|
|
block discarded – undo |
|
323
|
322
|
return NULL; |
|
324
|
323
|
} |
|
325
|
324
|
|
|
326
|
|
- $method = YamlFileLoader::class . '::load'; |
|
|
325
|
+ $method = YamlFileLoader::class.'::load'; |
|
327
|
326
|
$call = Helpers::findTrace($e->getPrevious()->getTrace(), $method); |
|
328
|
327
|
if ($call !== NULL) { |
|
329
|
328
|
return [ |
|
330
|
329
|
'tab' => 'YAML dictionary', |
|
331
|
|
- 'panel' => '<p><b>File:</b> ' . self::editorLink($call['args'][0], $previous->getParsedLine()) . '</p>' |
|
|
330
|
+ 'panel' => '<p><b>File:</b> '.self::editorLink($call['args'][0], $previous->getParsedLine()).'</p>' |
|
332
|
331
|
. ($previous->getParsedLine() ? BlueScreen::highlightFile($call['args'][0], $previous->getParsedLine()) : '') |
|
333
|
|
- . '<p>' . $previous->getMessage() . ' </p>', |
|
|
332
|
+ . '<p>'.$previous->getMessage().' </p>', |
|
334
|
333
|
]; |
|
335
|
334
|
} |
|
336
|
335
|
} |