PHP code example of foun10 / deepl

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

    

foun10 / deepl example snippets


use foun10\DeepL\Core\DeepL;
use OxidEsales\Eshop\Core\Registry;

/** @var DeepL $deepL */
$deepL = Registry::get(DeepL::class);

// The language translations are generated from, as configured in the module settings.
$sourceLang = $deepL->getShopLangForLanguageOnDemand()['langIso'];

$title = $deepL->translateText($sourceLang, 'es', $article->oxarticles__oxtitle->value);

// For a field that carries markup, let DeepL keep the tags intact:
$description = $deepL->translateText(
    $sourceLang,
    'es',
    $article->oxarticles__oxlongdesc->value,
    ['tag_handling' => 'html']
);