PHP code example of nigo / doc-translator

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

    

nigo / doc-translator example snippets


$generator = new SimpleDocument('lang', 'path_to_save');

$generator->generateByFile('file_for_translate', 'filename');

$generator->generate('text', 'filename');

$this->translator = new LibreTranslator();

public function setNewTranslator(TranslatorAbstract $translator): void
{
    $this->translator = $translator;
}

abstract class TranslatorAbstract
{

}

new LibreTranslator(true);

public function setLogState(bool $state): void
{
    $this->logState = $state;
}

public function setLogStateForTranslator(bool $state): void
{
    $this->translator = new LibreTranslator($state);
}

$generator = new Fb2ParallelDocumentGenerator('lang', 'path_to_save');
$generator->generateByFile('path_to_file', 'filename');

$document = new SimpleFB2('path_to_save');
$document->generateByFile('path_to_file', 'filename');