@@ -136,7 +136,7 @@ |
||
| 136 | 136 | * Translates the given string. |
| 137 | 137 | * |
| 138 | 138 | * @param string|\Kdyby\Translation\Phrase|mixed $message The message id |
| 139 | - * @param int|array|NULL $count The number to use to find the indice of the message |
|
| 139 | + * @param integer|null $count The number to use to find the indice of the message |
|
| 140 | 140 | * @param string|array|NULL $parameters An array of parameters for the message |
| 141 | 141 | * @param string|NULL $domain The domain for the message |
| 142 | 142 | * @param string|NULL $locale The locale |
@@ -338,6 +338,8 @@ |
||
| 338 | 338 | /** |
| 339 | 339 | * Returns link to editor. |
| 340 | 340 | * |
| 341 | + * @param integer $line |
|
| 342 | + * @param string $text |
|
| 341 | 343 | * @return \Nette\Utils\Html|string |
| 342 | 344 | */ |
| 343 | 345 | private static function editorLink($file, $line, $text = NULL) |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | 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" />' |
| 90 | - . $this->translator->getLocale() . ($this->untranslated ? ' <b>(' . count(array_unique($this->untranslated, SORT_REGULAR)) . ' errors)</b>' : '') |
|
| 90 | + . $this->translator->getLocale().($this->untranslated ? ' <b>('.count(array_unique($this->untranslated, SORT_REGULAR)).' errors)</b>' : '') |
|
| 91 | 91 | . '</span>'; |
| 92 | 92 | } |
| 93 | 93 | |
@@ -118,17 +118,17 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | /** @var \Nette\Application\Request[] $snapshot */ |
| 120 | 120 | $params = $snapshot['request']->getParameters(); |
| 121 | - $s .= '<tr><th width="10px"> </th>' . |
|
| 122 | - '<th>' . $h($snapshot['request']->getPresenterName() . (isset($params['action']) ? ':' . $params['action'] : '')) . '</th>' . |
|
| 123 | - '<th>' . $h($snapshot['locale']) . '</th></tr>'; |
|
| 121 | + $s .= '<tr><th width="10px"> </th>'. |
|
| 122 | + '<th>'.$h($snapshot['request']->getPresenterName().(isset($params['action']) ? ':'.$params['action'] : '')).'</th>'. |
|
| 123 | + '<th>'.$h($snapshot['locale']).'</th></tr>'; |
|
| 124 | 124 | |
| 125 | 125 | $l = 1; |
| 126 | 126 | /** @var mixed[][] $snapshot */ |
| 127 | 127 | foreach ($snapshot['resolvers'] as $name => $resolvedLocale) { |
| 128 | - $s .= '<tr><td>' . ($l++) . '.</td><td>' . $h($name) . '</td><td>' . $h($resolvedLocale) . '</td></tr>'; |
|
| 128 | + $s .= '<tr><td>'.($l++).'.</td><td>'.$h($name).'</td><td>'.$h($resolvedLocale).'</td></tr>'; |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - $panel[] = '<table style="width:100%">' . $s . '</table>'; |
|
| 131 | + $panel[] = '<table style="width:100%">'.$s.'</table>'; |
|
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | |
@@ -146,14 +146,13 @@ discard block |
||
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | $panel[] = '<h2>Ignored resources</h2>'; |
| 149 | - $panel[] = '<p>Whitelist config: ' . implode(', ', array_map($h, $this->localeWhitelist)) . '</p>'; |
|
| 149 | + $panel[] = '<p>Whitelist config: '.implode(', ', array_map($h, $this->localeWhitelist)).'</p>'; |
|
| 150 | 150 | $panel[] = $this->renderResources($this->ignoredResources); |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - return empty($panel) ? '' : |
|
| 154 | - '<h1>Missing translations: ' . count(array_unique($this->untranslated, SORT_REGULAR)) . |
|
| 155 | - ', Resources: ' . count(Arrays::flatten($this->resources)) . '</h1>' . |
|
| 156 | - '<div class="nette-inner tracy-inner kdyby-TranslationPanel" style="min-width:500px">' . implode($panel) . '</div>' . |
|
| 153 | + return empty($panel) ? '' : '<h1>Missing translations: '.count(array_unique($this->untranslated, SORT_REGULAR)). |
|
| 154 | + ', Resources: '.count(Arrays::flatten($this->resources)).'</h1>'. |
|
| 155 | + '<div class="nette-inner tracy-inner kdyby-TranslationPanel" style="min-width:500px">'.implode($panel).'</div>'. |
|
| 157 | 156 | '<style> |
| 158 | 157 | #nette-debug .kdyby-TranslationPanel h2, |
| 159 | 158 | #tracy-debug .kdyby-TranslationPanel h2 {font-size: 23px;} |
@@ -171,19 +170,19 @@ discard block |
||
| 171 | 170 | $s .= '<tr><td>'; |
| 172 | 171 | |
| 173 | 172 | if ($message instanceof \Exception || $message instanceof \Throwable) { |
| 174 | - $s .= '<span style="color:red">' . $h($message->getMessage()) . '</span>'; |
|
| 173 | + $s .= '<span style="color:red">'.$h($message->getMessage()).'</span>'; |
|
| 175 | 174 | |
| 176 | 175 | } elseif ($message instanceof Html) { |
| 177 | - $s .= '<span style="color:red">Nette\Utils\Html(' . $h((string) $message) . ')</span>'; |
|
| 176 | + $s .= '<span style="color:red">Nette\Utils\Html('.$h((string) $message).')</span>'; |
|
| 178 | 177 | |
| 179 | 178 | } else { |
| 180 | 179 | $s .= $h($message); |
| 181 | 180 | } |
| 182 | 181 | |
| 183 | - $s .= '</td><td>' . $h($untranslated['domain']) . '</td></tr>'; |
|
| 182 | + $s .= '</td><td>'.$h($untranslated['domain']).'</td></tr>'; |
|
| 184 | 183 | } |
| 185 | 184 | |
| 186 | - return '<table style="width:100%"><tr><th>Untranslated message</th><th>Translation domain</th></tr>' . $s . '</table>'; |
|
| 185 | + return '<table style="width:100%"><tr><th>Untranslated message</th><th>Translation domain</th></tr>'.$s.'</table>'; |
|
| 187 | 186 | } |
| 188 | 187 | |
| 189 | 188 | private function renderResources($resourcesMap) |
@@ -195,29 +194,29 @@ discard block |
||
| 195 | 194 | foreach ($resourcesMap as $locale => $resources) { |
| 196 | 195 | foreach ($resources as $resourcePath => $domain) { |
| 197 | 196 | $s .= '<tr>'; |
| 198 | - $s .= '<td>' . $h($locale) . '</td>'; |
|
| 199 | - $s .= '<td>' . $h($domain) . '</td>'; |
|
| 197 | + $s .= '<td>'.$h($locale).'</td>'; |
|
| 198 | + $s .= '<td>'.$h($domain).'</td>'; |
|
| 200 | 199 | |
| 201 | 200 | /** @var string $relativePath */ |
| 202 | - $relativePath = str_replace(rtrim($this->rootDir, '/') . '/', '', $resourcePath); |
|
| 201 | + $relativePath = str_replace(rtrim($this->rootDir, '/').'/', '', $resourcePath); |
|
| 203 | 202 | if (Strings::startsWith($relativePath, 'vendor/')) { |
| 204 | 203 | $parts = explode('/', $relativePath, 4); |
| 205 | 204 | /** @var string $left */ |
| 206 | 205 | $left = array_pop($parts); |
| 207 | 206 | /** @var string $relativePath */ |
| 208 | - $relativePath = $h(implode('/', $parts) . '/.../') . '<b>' . $h(basename($left)) . '</b>'; |
|
| 207 | + $relativePath = $h(implode('/', $parts).'/.../').'<b>'.$h(basename($left)).'</b>'; |
|
| 209 | 208 | |
| 210 | 209 | } else { |
| 211 | 210 | /** @var string $relativePath */ |
| 212 | - $relativePath = $h(dirname($relativePath)) . '/<b>' . $h(basename($relativePath)) . '</b>'; |
|
| 211 | + $relativePath = $h(dirname($relativePath)).'/<b>'.$h(basename($relativePath)).'</b>'; |
|
| 213 | 212 | } |
| 214 | 213 | |
| 215 | - $s .= '<td>' . self::editorLink($resourcePath, 1, $relativePath) . '</td>'; |
|
| 214 | + $s .= '<td>'.self::editorLink($resourcePath, 1, $relativePath).'</td>'; |
|
| 216 | 215 | $s .= '</tr>'; |
| 217 | 216 | } |
| 218 | 217 | } |
| 219 | 218 | |
| 220 | - return '<table style="width:100%"><tr><th>Locale</th><th>Domain</th><th>Resource filename</th></tr>' . $s . '</table>'; |
|
| 219 | + return '<table style="width:100%"><tr><th>Locale</th><th>Domain</th><th>Resource filename</th></tr>'.$s.'</table>'; |
|
| 221 | 220 | } |
| 222 | 221 | |
| 223 | 222 | /** |
@@ -253,7 +252,7 @@ discard block |
||
| 253 | 252 | public function addResource($format, $resource, $locale, $domain) |
| 254 | 253 | { |
| 255 | 254 | if (is_array($resource)) { |
| 256 | - $resource = 'array ' . md5(serialize($resource)); |
|
| 255 | + $resource = 'array '.md5(serialize($resource)); |
|
| 257 | 256 | } |
| 258 | 257 | |
| 259 | 258 | $this->resources[$locale][$resource] = $domain; |
@@ -273,7 +272,7 @@ discard block |
||
| 273 | 272 | public function addIgnoredResource($format, $resource, $locale, $domain) |
| 274 | 273 | { |
| 275 | 274 | if (is_array($resource)) { |
| 276 | - $resource = 'array ' . md5(serialize($resource)); |
|
| 275 | + $resource = 'array '.md5(serialize($resource)); |
|
| 277 | 276 | } |
| 278 | 277 | |
| 279 | 278 | $this->ignoredResources[$locale][$resource] = $domain; |
@@ -331,7 +330,7 @@ discard block |
||
| 331 | 330 | return NULL; |
| 332 | 331 | } |
| 333 | 332 | |
| 334 | - $method = YamlFileLoader::class . '::load'; |
|
| 333 | + $method = YamlFileLoader::class.'::load'; |
|
| 335 | 334 | /** @var \Exception $exception */ |
| 336 | 335 | $exception = $e->getPrevious(); |
| 337 | 336 | |
@@ -339,9 +338,9 @@ discard block |
||
| 339 | 338 | if ($call !== NULL) { |
| 340 | 339 | return [ |
| 341 | 340 | 'tab' => 'YAML dictionary', |
| 342 | - 'panel' => '<p><b>File:</b> ' . self::editorLink($call['args'][0], $previous->getParsedLine()) . '</p>' |
|
| 341 | + 'panel' => '<p><b>File:</b> '.self::editorLink($call['args'][0], $previous->getParsedLine()).'</p>' |
|
| 343 | 342 | . ($previous->getParsedLine() ? BlueScreen::highlightFile($call['args'][0], $previous->getParsedLine()) : '') |
| 344 | - . '<p>' . $previous->getMessage() . ' </p>', |
|
| 343 | + . '<p>'.$previous->getMessage().' </p>', |
|
| 345 | 344 | ]; |
| 346 | 345 | } |
| 347 | 346 | } |