PHP code example of tacoberu / nette-fluent-translator

1. Go to this page and download the library: Download tacoberu/nette-fluent-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/ */

    

tacoberu / nette-fluent-translator example snippets



$translator = $container->getService('translator');

dump($translator->translate('-brand-name'));
// "Foo 3000"

dump($translator->translate('welcome', ['name' => 'Anne']));
// "Welcome, Anne, to Foo 3000!"

dump($translator->translate('greet-by-name', ['name' => 'Anne']));
// "Hello, Anne!"

This means, for example:


$form = new UI\Form($this, $name);
$form->setTranslator($this->context->getByType(Localization\ITranslator::class));
$form->addText('title', 'form-title');