Skip to content

Commit

Permalink
add translations
Browse files Browse the repository at this point in the history
  • Loading branch information
MartkCz committed May 4, 2022
1 parent 5ed4592 commit 8805d77
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
6 changes: 0 additions & 6 deletions src/Templates/Template/TemplateObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Contributte\Invoice\Templates\Template;

use Contributte\Invoice\Data\Extension\IDiscount;
use Contributte\Invoice\Data\IOrder;
use Contributte\Invoice\Templates\Translator\ITranslator;

Expand Down Expand Up @@ -31,11 +30,6 @@ public function translate(string $message): string
return $this->translator->translate($message);
}

public function formatMoneyCallback(): callable
{
return fn (string $money) => $this->order->getCurrency()->toString($money);
}

protected function prepend(string $prepend, ?string $str): ?string
{
return $str === null ? null : $prepend . $str;
Expand Down
6 changes: 5 additions & 1 deletion src/Templates/Translator/ParaisoTemplateTranslator.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@ final class ParaisoTemplateTranslator extends Translator
public function __construct(string $lang = 'en')
{
$this->addLanguage('en', [
'Invoice' => 'Invoice',
'Invoice' => 'INVOICE',
'Discount' => 'Discount',
'Payment Info' => 'Payment Info',
'Total price' => 'Total price',
'Invoice from' => 'Invoice from',
'Invoice to' => 'Invoice to',
'ID' => 'ID',
'Total' => 'Total',
'Item description' => 'Item description',
'Unit price' => 'Unit price',
'Quantity' => 'Quantity',
'VAT Number' => 'VAT Number',
'Invoice No.' => 'Invoice No.',
'Invoice date' => 'Invoice date',
Expand Down
12 changes: 6 additions & 6 deletions src/Templates/templates/paraiso.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ echo '<?xml version="1.0" encoding="UTF-8"?>';
p { margin: 0; }
</style>
<!-- Header Text -->
<text font-size="136" x="1678" y="206" fill="<?= $this->colors['text'] ?>" font-weight="bold" text-anchor="start"><?= TemplateUtility::escape(strtoupper($template->translate('Invoice'))) ?></text>
<text font-size="136" x="1678" y="206" fill="<?= $this->colors['text'] ?>" font-weight="bold" text-anchor="start"><?= TemplateUtility::escape($template->translate('Invoice')) ?></text>
<!-- / Header Text -->


Expand Down Expand Up @@ -70,10 +70,10 @@ echo '<?xml version="1.0" encoding="UTF-8"?>';

<rect x="0" y="1133" width="2480" height="5" fill="<?= $this->colors['primary'] ?>" />

<text font-size="42" x="176" y="1190" fill="<?= $this->colors['primary'] ?>">Item description</text>
<text font-size="42" x="1231" y="1190" fill="<?= $this->colors['primary'] ?>" text-anchor="middle">Unit price</text>
<text font-size="42" x="1680" y="1190" fill="<?= $this->colors['primary'] ?>" text-anchor="middle">Quantity</text>
<text font-size="42" x="2174" y="1190" fill="<?= $this->colors['primary'] ?>" text-anchor="middle">Total</text>
<text font-size="42" x="176" y="1190" fill="<?= $this->colors['primary'] ?>"><?= TemplateUtility::escape($template->translate('Item description')) ?></text>
<text font-size="42" x="1231" y="1190" fill="<?= $this->colors['primary'] ?>" text-anchor="middle"><?= TemplateUtility::escape($template->translate('Unit price')) ?></text>
<text font-size="42" x="1680" y="1190" fill="<?= $this->colors['primary'] ?>" text-anchor="middle"><?= TemplateUtility::escape($template->translate('Quantity')) ?></text>
<text font-size="42" x="2174" y="1190" fill="<?= $this->colors['primary'] ?>" text-anchor="middle"><?= TemplateUtility::escape($template->translate('Total')) ?></text>

<?php $y = TemplateUtility::multiplier(1278, 29 + 100, false); ?>
<?php foreach ($order->getItems() as $item): ?>
Expand Down Expand Up @@ -130,7 +130,7 @@ echo '<?xml version="1.0" encoding="UTF-8"?>';
<?php endif; ?>

<text font-size="42" x="1593" y="<?= $y; ?>" font-weight="bold" fill="#5f6f73"><?= TemplateUtility::escape($template->translate('Total')) ?></text>
<text font-size="42" x="2250" y="<?= $y; ?>" font-weight="bold" text-anchor="end" fill="#5f6f73">$ 4500.00</text>
<text font-size="42" x="2250" y="<?= $y; ?>" font-weight="bold" text-anchor="end" fill="#5f6f73"><?= TemplateUtility::escape($order->getTotalPrice()) ?></text>

<?php $paymentY = TemplateUtility::multiplier($adjust, 42 + 30); ?>
<?php if ($template->getPaymentInfo()): ?>
Expand Down

0 comments on commit 8805d77

Please sign in to comment.