Using the translate macro witout Nette

7 months ago

Wintermute
Member | 4
+
+1
-

Hello,

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

{_}hello_world{/_}

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 !