PHP code example of ali-translator / buffered-translation
1. Go to this page and download the library: Download ali-translator/buffered-translation 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/ */
ali-translator / buffered-translation example snippets
use ALI\BufferTranslation\BufferTranslation;
use ALI\Translator\PlainTranslator\PlainTranslator;
use ALI\Translator\Languages\LanguageRepositoryInterface;
/** @var PlainTranslator $plainTranslator */
/** @var LanguageRepositoryInterface $languageRepository */
$bufferTranslation = new BufferTranslation($plainTranslator, $languageRepository);
/**
* @param array|null $columnsForTranslation - null means "all string columns"
* @param bool $isItBufferFragment - Choose whether you want to translate the entire buffer or only the existing keys in the text
*/
$translatedBufferedArray = $bufferTranslation->translateArrayWithBuffers($bufferedArray, $columnsForTrnasl, $columnsForTranslation);