Translate VisualPaginator control

6 years ago

Member | 57

I am translating my Nette project (2.0.12) with addon GettextTranslator (…t-translator) and I am currently trying to translate VisualPaginator (…ualpaginator).

VisualPaginator extends Control so I tried to create BaseControl as mentioned in GettextTranslator page:

public function createTemplate($class = NULL)
    $template = parent::createTemplate($class);
    $template->setTranslator($this->parent->translator); // $translator in presenter has to be public
    // or $this->translator via construct/inject

    return $template;

I also tried to Autowire GettextTranslator and set translator directly to VisualPaginator but the $template in VisualPaginator is instance of ITemplate and does not contain method setTranslator().

$this->template->steps = $steps;
$this->template->paginator = $paginator;
$this->template->setFile(dirname(__FILE__) . '/template.phtml');

$this->template->setTranslator(...); //obviously not working


Could someone help? I want to translate text in template (Next/Prev).

Thanks in advance

PS: I used “Inline code” function but it seems to not working properly (or maybe the style is missing).