Using the translate macro witout Nette

about a month ago

Member | 4


According to the Latte documentation, the translation macros are available only in Nette Framework.


Actually, you can make it work without Nette. You just have to provide a translate filter.

In my framework, I do the following :

$latte->addFilter( 'translate', [Registry::get( 'i18n' ), '__'] );
$latte->addFilter( '__', [Registry::get( 'i18n' ), '__'] );

It works perfectely !