@@ -364,6 +364,9 @@ |
||
| 364 | 364 | |
| 365 | 365 | |
| 366 | 366 | |
| 367 | + /** |
|
| 368 | + * @param string $file |
|
| 369 | + */ |
|
| 367 | 370 | protected function validateResource($format, $file, $locale, $domain) |
| 368 | 371 | { |
| 369 | 372 | $builder = $this->getContainerBuilder(); |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | |
| 259 | 259 | $this->beforeCompileLogging($config); |
| 260 | 260 | |
| 261 | - $registerToLatte = function (Nette\DI\ServiceDefinition $def) { |
|
| 261 | + $registerToLatte = function(Nette\DI\ServiceDefinition $def) { |
|
| 262 | 262 | $def |
| 263 | 263 | ->addSetup('?->onCompile[] = function($engine) { Kdyby\Translation\Latte\TranslateMacros::install($engine->getCompiler()); }', array('@self')) |
| 264 | 264 | ->addSetup('addFilter', array('translate', array($this->prefix('@helpers'), 'translate'))) |
@@ -472,7 +472,7 @@ discard block |
||
| 472 | 472 | */ |
| 473 | 473 | public static function register(Nette\Configurator $configurator) |
| 474 | 474 | { |
| 475 | - $configurator->onCompile[] = function ($config, Nette\DI\Compiler $compiler) { |
|
| 475 | + $configurator->onCompile[] = function($config, Nette\DI\Compiler $compiler) { |
|
| 476 | 476 | $compiler->addExtension('translation', new TranslationExtension()); |
| 477 | 477 | }; |
| 478 | 478 | } |
@@ -225,6 +225,9 @@ discard block |
||
| 225 | 225 | |
| 226 | 226 | |
| 227 | 227 | |
| 228 | + /** |
|
| 229 | + * @param string $id |
|
| 230 | + */ |
|
| 228 | 231 | public function markUntranslated($id) |
| 229 | 232 | { |
| 230 | 233 | $this->untranslated[] = $id; |
@@ -233,7 +236,7 @@ discard block |
||
| 233 | 236 | |
| 234 | 237 | |
| 235 | 238 | /** |
| 236 | - * @param \Exception|\Throwable $e |
|
| 239 | + * @param \Exception $e |
|
| 237 | 240 | */ |
| 238 | 241 | public function choiceError($e) |
| 239 | 242 | { |
@@ -335,6 +338,7 @@ discard block |
||
| 335 | 338 | /** |
| 336 | 339 | * Returns link to editor. |
| 337 | 340 | * @author David Grudl |
| 341 | + * @param string $text |
|
| 338 | 342 | * @return Nette\Utils\Html|string |
| 339 | 343 | */ |
| 340 | 344 | private static function editorLink($file, $line, $text = NULL) |
@@ -155,8 +155,7 @@ |
||
| 155 | 155 | $panel[] = $this->renderResources($this->ignoredResources); |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - return empty($panel) ? '' : |
|
| 159 | - '<h1>Missing translations: ' . count(array_unique($this->untranslated)) . |
|
| 158 | + return empty($panel) ? '' : '<h1>Missing translations: ' . count(array_unique($this->untranslated)) . |
|
| 160 | 159 | ', Resources: ' . count(Nette\Utils\Arrays::flatten($this->resources)) . '</h1>' . |
| 161 | 160 | '<div class="nette-inner tracy-inner kdyby-TranslationPanel" style="min-width:500px">' . implode($panel) . '</div>' . |
| 162 | 161 | '<style> |
@@ -28,6 +28,7 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | * @param string $format The format of the loader |
| 30 | 30 | * @param LoaderInterface $loader |
| 31 | + * @return void |
|
| 31 | 32 | */ |
| 32 | 33 | function addLoader($format, LoaderInterface $loader); |
| 33 | 34 | |
@@ -46,6 +47,7 @@ discard block |
||
| 46 | 47 | * @param string $domain |
| 47 | 48 | * @param MessageCatalogue $catalogue |
| 48 | 49 | * @throws LoaderNotFoundException |
| 50 | + * @return void |
|
| 49 | 51 | */ |
| 50 | 52 | function loadResource($format, $resource, $domain, MessageCatalogue $catalogue); |
| 51 | 53 | |
@@ -11,7 +11,6 @@ |
||
| 11 | 11 | namespace Kdyby\Translation\Latte; |
| 12 | 12 | |
| 13 | 13 | use Kdyby; |
| 14 | -use Nette; |
|
| 15 | 14 | use Latte; |
| 16 | 15 | use Latte\Compiler; |
| 17 | 16 | use Latte\MacroNode; |
@@ -35,6 +35,9 @@ |
||
| 35 | 35 | |
| 36 | 36 | |
| 37 | 37 | |
| 38 | + /** |
|
| 39 | + * @param string $prefix |
|
| 40 | + */ |
|
| 38 | 41 | public function __construct($prefix, ITranslator $translator) |
| 39 | 42 | { |
| 40 | 43 | if ($translator instanceof PrefixedTranslator) { // todo: this is just an experiment |
@@ -62,9 +62,9 @@ |
||
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | if (is_array($count)) { |
| 65 | - $locale = $domain ? : NULL; |
|
| 66 | - $domain = $parameters ? : NULL; |
|
| 67 | - $parameters = $count ? : array(); |
|
| 65 | + $locale = $domain ?: NULL; |
|
| 66 | + $domain = $parameters ?: NULL; |
|
| 67 | + $parameters = $count ?: array(); |
|
| 68 | 68 | $count = NULL; |
| 69 | 69 | } |
| 70 | 70 | |
@@ -401,7 +401,7 @@ |
||
| 401 | 401 | |
| 402 | 402 | |
| 403 | 403 | /** |
| 404 | - * @param $message |
|
| 404 | + * @param string $message |
|
| 405 | 405 | * @return array |
| 406 | 406 | */ |
| 407 | 407 | private function extractMessageDomain($message) |
@@ -65,9 +65,9 @@ |
||
| 65 | 65 | return NULL; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - $s = strtolower($header); // case insensitive |
|
| 69 | - $s = strtr($s, '_', '-'); // cs_CZ means cs-CZ |
|
| 70 | - rsort($langs); // first more specific |
|
| 68 | + $s = strtolower($header); // case insensitive |
|
| 69 | + $s = strtr($s, '_', '-'); // cs_CZ means cs-CZ |
|
| 70 | + rsort($langs); // first more specific |
|
| 71 | 71 | preg_match_all('#(' . implode('|', $langs) . ')(?:-[^\s,;=]+)?\s*(?:;\s*q=([0-9.]+))?#', $s, $matches); |
| 72 | 72 | |
| 73 | 73 | if (!$matches[0]) { |
@@ -87,7 +87,7 @@ |
||
| 87 | 87 | return NULL; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - $short = array_map(function ($locale) { |
|
| 90 | + $short = array_map(function($locale) { |
|
| 91 | 91 | return substr($locale, 0, 2); |
| 92 | 92 | }, $translator->getAvailableLocales()); |
| 93 | 93 | |