/**
  * @param Latte\Template|\Nette\Bridges\ApplicationLatte\Template|\Nette\Templating\Template $template
  * @param string $prefix
  * @return ITranslator
  * @throws InvalidArgumentException
  */
 public static function register($template, $prefix)
 {
     try {
         $translator = $template->getTranslator();
     } catch (\LogicException $e) {
         throw new InvalidArgumentException('Please register helpers from \\Kdyby\\Translation\\TemplateHelpers before using translator prefixes.', 0, $e);
     }
     /** @var ITranslator $translator */
     $translator = new static($prefix, $translator);
     return self::overrideTemplateTranslator($template, $translator);
 }