PHP code example of chomenko / translator

1. Go to this page and download the library: Download chomenko/translator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

chomenko / translator example snippets




namespace App\Presenters;

use Nette\Application\UI\Presenter;
use Chomenko\Translator\Translate;

class BasePresenter extends Presenter
{
 
    /**
     * Install Translator 
     */
    use Translate;
    
    public function startup() {
        parent::startup();
        $config = $this->translator->getConfig();
        $this->template->setTranslator($this->translator);
    }

}



$config = $this->translator->getConfig();
$config->translateModalEnable();