Skip to content

Commit

Permalink
COCO-1 - Change translations
Browse files Browse the repository at this point in the history
  • Loading branch information
JanPalen committed Nov 28, 2024
1 parent 4e72d0a commit 8b492f3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
"license": "MIT",
"require": {
"php": "^8.0",
"sylius/sylius": "~1.12.0 || ~1.13.0",
"symfony/uid": "^7.1"
"sylius/sylius": "~1.12.0 || ~1.13.0"
},
"require-dev": {
"behat/behat": "^3.7",
Expand Down Expand Up @@ -39,6 +38,7 @@
"symfony/debug-bundle": "^5.4 || ^6.0",
"symfony/dotenv": "^5.4 || ^6.0",
"symfony/intl": "^5.4 || ^6.0",
"symfony/uid": "^6.0",
"symfony/web-profiler-bundle": "^5.4 || ^6.0",
"symfony/webpack-encore-bundle": "^1.16",
"vimeo/psalm": "4.27",
Expand Down
7 changes: 6 additions & 1 deletion src/Cart/Context/ShopBasedMultiCartContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use Sylius\Component\Order\Context\CartContextInterface;
use Sylius\Component\Order\Context\CartNotFoundException;
use Sylius\Component\Order\Model\OrderInterface as BaseOrderInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
use Webmozart\Assert\Assert;

final class ShopBasedMultiCartContext implements CartContextInterface
Expand All @@ -36,6 +37,7 @@ public function __construct(
private readonly CartCustomizerInterface $cartCustomizer,
private readonly OrderRepositoryInterface $orderRepository,
private readonly CookieContextInterface $cookieContext,
private readonly TranslatorInterface $translator,
private readonly bool $allowMulticartForAnonymous,
) {
}
Expand All @@ -61,7 +63,10 @@ public function getCart(): BaseOrderInterface
$cart->setCurrencyCode($currency->getCode());
$cart->setLocaleCode($this->shopperContext->getLocaleCode());
} catch (ChannelNotFoundException | CurrencyNotFoundException | LocaleNotFoundException $exception) {
throw new CartNotFoundException('Sylius was not able to prepare the cart.', $exception);
throw new CartNotFoundException(
$this->translator->trans('bitbag_sylius_multicart_plugin.ui.sylius_was_not_able_to_prepare_the_cart'),
$exception
);
}

/** @var CustomerInterface|null $customer */
Expand Down
2 changes: 1 addition & 1 deletion src/Remover/CartRemover.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ private function validateRemovableCart(int $cartNumber, ?int $activeCartNumber):
{
if ($cartNumber === $activeCartNumber) {
throw new UnableToDeleteCartException(
'bitbag_sylius_multicart_plugin.ui.cant_delete_active_cart',
$this->translator->trans('bitbag_sylius_multicart_plugin.ui.cant_delete_active_cart'),
);
}
}
Expand Down
1 change: 1 addition & 0 deletions src/Resources/config/services/decorator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ services:
- '@bitbag_sylius_multi_cart_plugin.customizer.cart_customizer'
- '@sylius.repository.order'
- '@bitbag_sylius_multi_cart_plugin.context.cookie'
- '@translator'
- '%allow_multicart_for_anonymous%'
tags:
- {name: 'kernel.reset', method: 'reset'}
1 change: 1 addition & 0 deletions src/Resources/translations/messages.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ bitbag_sylius_multicart_plugin:
max_cart_number_reached: Max cart number has been reached!
sylius_was_not_able_to_find_the_cart_as_there_is_no_current_channel: Sylius was not able to find the cart, as there is no current channel.
sylius_was_not_able_to_find_the_cart_for_currently_logged_in_user: Sylius was not able to find the cart for currently logged in user.
sylius_was_not_able_to_prepare_the_cart: Sylius was not able to prepare the cart.

0 comments on commit 8b492f3

Please sign in to comment.