Simple translator.
- PHP 8.1 or higher
- composer
composer require drago-ex/translator
extensions:
- Drago\Localization\DI\TranslatorExtension(translateDir: %appDir%/locale)
use Drago\Localization\TranslatorAdapter
$this->lang;
$this->getTranslator();
"Hello, world!": "Hello, world!"
{_"Hello, world!"}
{* filter for translate *}
{$var|translate}
$form->setTranslator($this->getTranslator());
$router->addRoute('[<lang=en cs|en>/]<presenter>/<action>', 'Presenter:action');
<a n:href="this, 'lang' => 'cs'">Czech</a>
<a n:href="this, 'lang' => 'en'">English</a>