Confusion for translations in Latte 3
- SPu
- Member | 2
Either I am misunderstanding the documentation or there is a bug in the new release.
Code in the Latte template is as follows:
<li><a href="#Home">{_'Home'}</a></li>
And the translators have been registered in the PHP code with following:
$this->latte->addFilter('translate', function($string) {
// Calls the translator here
});
This setup works fine with Latte 2.11.3, but throws and error for the translation with Latte 3.0.
Updating the template code to either “{translate}Home{/translate}” or “{=‘Home’|translate}” will make it work. Documentation says the single underscore method should be fine (https://doc.nette.org/…on/templates#…).
To my understanding the underscore template call should be still available in v.3.0, with the addition of the new {translate}xx{/translate} tag, to which I do not like to migrate since that is a hell of a job.
Something I am missing?
Last edited by SPu (2022-05-26 18:03)
- Rick Strafy
- Nette Blogger | 81
Hi, https://latte.nette.org/…-from-latte2#… it looks like addFilter method is now addFilterLoader