1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-07-27 17:28:39 +00:00

Translated first page of exported article

This commit is contained in:
Nicolas Lœuillet 2017-10-08 08:55:30 +02:00 committed by Jeremy Benoist
parent d8dc7372ab
commit b1428a1cf8
No known key found for this signature in database
GPG key ID: BCA73962457ACC3C
14 changed files with 44 additions and 2 deletions

View file

@ -8,6 +8,7 @@ use JMS\Serializer\SerializerBuilder;
use PHPePub\Core\EPub;
use PHPePub\Core\Structure\OPF\DublinCore;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Translation\TranslatorInterface;
use Wallabag\CoreBundle\Entity\Entry;
/**
@ -17,6 +18,7 @@ class EntriesExport
{
private $wallabagUrl;
private $logoPath;
private $translator;
private $title = '';
private $entries = [];
private $author = 'wallabag';
@ -30,10 +32,11 @@ class EntriesExport
* @param string $wallabagUrl Wallabag instance url
* @param string $logoPath Path to the logo FROM THE BUNDLE SCOPE
*/
public function __construct($wallabagUrl, $logoPath)
public function __construct($wallabagUrl, $logoPath, TranslatorInterface $translator)
{
$this->wallabagUrl = $wallabagUrl;
$this->logoPath = $logoPath;
$this->translator = $translator;
}
/**
@ -451,7 +454,9 @@ class EntriesExport
*/
private function getExportInformation($type)
{
$info = str_replace('%EXPORT_METHOD%', $type, $this->footerTemplate);
$info = $this->translator->trans('export.footer_template', [
'%method%' => $type,
]);
if ('tcpdf' === $type) {
return str_replace('%IMAGE%', '<img src="' . $this->logoPath . '" />', $info);