diff --git a/controllers/front/AbstractOpcJsonFrontController.php b/controllers/front/AbstractOpcJsonFrontController.php
index 4ea5acf..ec65889 100644
--- a/controllers/front/AbstractOpcJsonFrontController.php
+++ b/controllers/front/AbstractOpcJsonFrontController.php
@@ -1,7 +1,6 @@
false,
'errors' => [
'' => [
- $this->trans('One-page checkout is currently unavailable.', [], ModuleTranslation::SHOP_DOMAIN),
+ $this->trans('One-page checkout is currently unavailable.', [], 'Modules.Onepagecheckout.Shop'),
],
],
];
diff --git a/ps_onepagecheckout.php b/ps_onepagecheckout.php
index 3530b67..55eff4e 100644
--- a/ps_onepagecheckout.php
+++ b/ps_onepagecheckout.php
@@ -16,7 +16,6 @@
use PrestaShop\Module\PsOnePageCheckout\Checkout\OnePageCheckoutAvailability;
use PrestaShop\Module\PsOnePageCheckout\Checkout\OnePageCheckoutProcessProvider;
use PrestaShop\Module\PsOnePageCheckout\Form\BackOfficeConfigurationForm;
-use PrestaShop\Module\PsOnePageCheckout\Translation\ModuleTranslation;
use PrestaShop\PrestaShop\Adapter\Order\Checkout\CheckoutProcessProviderInterface;
class Ps_Onepagecheckout extends Module
@@ -35,7 +34,7 @@ public function __construct()
$tabNames = [];
foreach (Language::getLanguages(true) as $lang) {
- $tabNames[$lang['locale']] = $this->trans('Checkout', [], ModuleTranslation::ADMIN_DOMAIN, $lang['locale']);
+ $tabNames[$lang['locale']] = $this->trans('Checkout', [], 'Modules.Onepagecheckout.Admin', $lang['locale']);
}
$this->tabs = [
[
@@ -44,17 +43,17 @@ public function __construct()
'name' => $tabNames,
'parent_class_name' => 'AdminParentThemes',
'wording' => 'Checkout',
- 'wording_domain' => ModuleTranslation::ADMIN_DOMAIN,
+ 'wording_domain' => 'Modules.Onepagecheckout.Admin',
],
];
parent::__construct();
- $this->displayName = $this->trans('One-page checkout', [], ModuleTranslation::ADMIN_DOMAIN);
+ $this->displayName = $this->trans('One-page checkout', [], 'Modules.Onepagecheckout.Admin');
$this->description = $this->trans(
'Native one-page checkout.',
[],
- ModuleTranslation::ADMIN_DOMAIN
+ 'Modules.Onepagecheckout.Admin'
);
$this->ps_versions_compliancy = ['min' => '9.0.0', 'max' => _PS_VERSION_];
$this->controllers = [
@@ -72,6 +71,11 @@ public function __construct()
];
}
+ public function isUsingNewTranslationSystem(): bool
+ {
+ return true;
+ }
+
public function install()
{
return $this->installInParent()
@@ -292,23 +296,23 @@ public function hookActionFrontControllerSetMedia(): void
),
],
'messages' => [
- 'missingGuestInitUrl' => $this->trans('Unable to initialize checkout customer.', [], ModuleTranslation::SHOP_DOMAIN),
- 'missingAddressFormUrl' => $this->trans('Unable to refresh addresses.', [], ModuleTranslation::SHOP_DOMAIN),
- 'loadCarriersFailed' => $this->trans('Unable to load delivery methods.', [], ModuleTranslation::SHOP_DOMAIN),
- 'missingCarrierSelectionPayload' => $this->trans('Missing delivery option.', [], ModuleTranslation::SHOP_DOMAIN),
- 'selectCarrierFailed' => $this->trans('Unable to select the delivery method.', [], ModuleTranslation::SHOP_DOMAIN),
- 'loadPaymentMethodsFailed' => $this->trans('Unable to load payment methods.', [], ModuleTranslation::SHOP_DOMAIN),
- 'missingPaymentSelectionPayload' => $this->trans('Missing payment selection payload.', [], ModuleTranslation::SHOP_DOMAIN),
- 'selectPaymentFailed' => $this->trans('Unable to select the payment method.', [], ModuleTranslation::SHOP_DOMAIN),
- 'statesLoadFailed' => $this->trans('Unable to load states.', [], ModuleTranslation::SHOP_DOMAIN),
- 'missingSaveAddressUrl' => $this->trans('Unable to save address.', [], ModuleTranslation::SHOP_DOMAIN),
- 'saveAddressFailed' => $this->trans('Unable to save address.', [], ModuleTranslation::SHOP_DOMAIN),
- 'missingDeleteAddressUrl' => $this->trans('Unable to delete address.', [], ModuleTranslation::SHOP_DOMAIN),
- 'deleteAddressFailed' => $this->trans('Unable to delete address.', [], ModuleTranslation::SHOP_DOMAIN),
- 'refreshAddressesFailed' => $this->trans('Unable to refresh addresses.', [], ModuleTranslation::SHOP_DOMAIN),
- 'missingPaymentForm' => $this->trans('Unable to initialize the selected payment method.', [], ModuleTranslation::SHOP_DOMAIN),
- 'missingSubmitUrl' => $this->trans('Unable to submit checkout.', [], ModuleTranslation::SHOP_DOMAIN),
- 'submitFailed' => $this->trans('Unable to submit checkout.', [], ModuleTranslation::SHOP_DOMAIN),
+ 'missingGuestInitUrl' => $this->trans('Unable to initialize checkout customer.', [], 'Modules.Onepagecheckout.Shop'),
+ 'missingAddressFormUrl' => $this->trans('Unable to refresh addresses.', [], 'Modules.Onepagecheckout.Shop'),
+ 'loadCarriersFailed' => $this->trans('Unable to load delivery methods.', [], 'Modules.Onepagecheckout.Shop'),
+ 'missingCarrierSelectionPayload' => $this->trans('Missing delivery option.', [], 'Modules.Onepagecheckout.Shop'),
+ 'selectCarrierFailed' => $this->trans('Unable to select the delivery method.', [], 'Modules.Onepagecheckout.Shop'),
+ 'loadPaymentMethodsFailed' => $this->trans('Unable to load payment methods.', [], 'Modules.Onepagecheckout.Shop'),
+ 'missingPaymentSelectionPayload' => $this->trans('Missing payment selection payload.', [], 'Modules.Onepagecheckout.Shop'),
+ 'selectPaymentFailed' => $this->trans('Unable to select the payment method.', [], 'Modules.Onepagecheckout.Shop'),
+ 'statesLoadFailed' => $this->trans('Unable to load states.', [], 'Modules.Onepagecheckout.Shop'),
+ 'missingSaveAddressUrl' => $this->trans('Unable to save address.', [], 'Modules.Onepagecheckout.Shop'),
+ 'saveAddressFailed' => $this->trans('Unable to save address.', [], 'Modules.Onepagecheckout.Shop'),
+ 'missingDeleteAddressUrl' => $this->trans('Unable to delete address.', [], 'Modules.Onepagecheckout.Shop'),
+ 'deleteAddressFailed' => $this->trans('Unable to delete address.', [], 'Modules.Onepagecheckout.Shop'),
+ 'refreshAddressesFailed' => $this->trans('Unable to refresh addresses.', [], 'Modules.Onepagecheckout.Shop'),
+ 'missingPaymentForm' => $this->trans('Unable to initialize the selected payment method.', [], 'Modules.Onepagecheckout.Shop'),
+ 'missingSubmitUrl' => $this->trans('Unable to submit checkout.', [], 'Modules.Onepagecheckout.Shop'),
+ 'submitFailed' => $this->trans('Unable to submit checkout.', [], 'Modules.Onepagecheckout.Shop'),
],
];
diff --git a/src/Checkout/Ajax/Address/OnePageCheckoutAddressesListHandler.php b/src/Checkout/Ajax/Address/OnePageCheckoutAddressesListHandler.php
index bbbc04f..a740df0 100644
--- a/src/Checkout/Ajax/Address/OnePageCheckoutAddressesListHandler.php
+++ b/src/Checkout/Ajax/Address/OnePageCheckoutAddressesListHandler.php
@@ -2,7 +2,6 @@
namespace PrestaShop\Module\PsOnePageCheckout\Checkout\Ajax;
-use PrestaShop\Module\PsOnePageCheckout\Translation\ModuleTranslation;
use Symfony\Contracts\Translation\TranslatorInterface;
class OnePageCheckoutAddressesListHandler
@@ -35,7 +34,7 @@ public function handle(): array
$customer = $this->customerResolver->resolve();
if (!$customer instanceof \Customer) {
return CheckoutAjaxResponse::error(
- $this->translator->trans('Unable to resolve checkout customer.', [], ModuleTranslation::SHOP_DOMAIN)
+ $this->translator->trans('Unable to resolve checkout customer.', [], 'Modules.Onepagecheckout.Shop')
);
}
diff --git a/src/Checkout/Ajax/Address/OnePageCheckoutDeleteAddressHandler.php b/src/Checkout/Ajax/Address/OnePageCheckoutDeleteAddressHandler.php
index ee64409..ef40148 100644
--- a/src/Checkout/Ajax/Address/OnePageCheckoutDeleteAddressHandler.php
+++ b/src/Checkout/Ajax/Address/OnePageCheckoutDeleteAddressHandler.php
@@ -2,7 +2,6 @@
namespace PrestaShop\Module\PsOnePageCheckout\Checkout\Ajax;
-use PrestaShop\Module\PsOnePageCheckout\Translation\ModuleTranslation;
use Symfony\Contracts\Translation\TranslatorInterface;
class OnePageCheckoutDeleteAddressHandler
@@ -34,14 +33,14 @@ public function handle(array $requestParameters = []): array
$customer = $this->customerResolver->resolve();
if (!$customer instanceof \Customer) {
return CheckoutAjaxResponse::error(
- $this->translator->trans('Unable to resolve checkout customer.', [], ModuleTranslation::SHOP_DOMAIN)
+ $this->translator->trans('Unable to resolve checkout customer.', [], 'Modules.Onepagecheckout.Shop')
);
}
$address = $this->loadOwnedAddress($customer, (int) ($requestParameters['id_address'] ?? 0));
if (!$address instanceof \Address) {
return CheckoutAjaxResponse::error(
- $this->translator->trans('Unable to load the requested address.', [], ModuleTranslation::SHOP_DOMAIN)
+ $this->translator->trans('Unable to load the requested address.', [], 'Modules.Onepagecheckout.Shop')
);
}
@@ -54,7 +53,7 @@ public function handle(array $requestParameters = []): array
if (!$this->buildAddressPersister($customer)->delete($address, \Tools::getToken(true, $this->context))) {
return CheckoutAjaxResponse::error(
- $this->translator->trans('Unable to delete address.', [], ModuleTranslation::SHOP_DOMAIN)
+ $this->translator->trans('Unable to delete address.', [], 'Modules.Onepagecheckout.Shop')
);
}
@@ -75,7 +74,7 @@ public function handle(array $requestParameters = []): array
return [
'success' => true,
'id_address' => $addressId,
- 'message' => $this->translator->trans('Address successfully deleted.', [], ModuleTranslation::SHOP_DOMAIN),
+ 'message' => $this->translator->trans('Address successfully deleted.', [], 'Modules.Onepagecheckout.Shop'),
];
}
diff --git a/src/Checkout/Ajax/Address/OnePageCheckoutSaveAddressHandler.php b/src/Checkout/Ajax/Address/OnePageCheckoutSaveAddressHandler.php
index e7c3cf5..400117d 100644
--- a/src/Checkout/Ajax/Address/OnePageCheckoutSaveAddressHandler.php
+++ b/src/Checkout/Ajax/Address/OnePageCheckoutSaveAddressHandler.php
@@ -4,7 +4,6 @@
use PrestaShop\Module\PsOnePageCheckout\Form\OnePageCheckoutAddressForm;
use PrestaShop\Module\PsOnePageCheckout\Form\OnePageCheckoutAddressFormatter;
-use PrestaShop\Module\PsOnePageCheckout\Translation\ModuleTranslation;
use Symfony\Contracts\Translation\TranslatorInterface;
class OnePageCheckoutSaveAddressHandler
@@ -33,7 +32,7 @@ public function handle(array $requestParameters = []): array
$customerId = $this->customerResolver->resolveId();
if ($customerId <= 0) {
return CheckoutAjaxResponse::error(
- $this->translator->trans('Unable to resolve checkout customer.', [], ModuleTranslation::SHOP_DOMAIN)
+ $this->translator->trans('Unable to resolve checkout customer.', [], 'Modules.Onepagecheckout.Shop')
);
}
@@ -44,7 +43,7 @@ public function handle(array $requestParameters = []): array
if ($addressId > 0 && (!\Validate::isLoadedObject($address) || (int) $address->id_customer !== $customerId)) {
return CheckoutAjaxResponse::error(
- $this->translator->trans('Unable to load the requested address.', [], ModuleTranslation::SHOP_DOMAIN)
+ $this->translator->trans('Unable to load the requested address.', [], 'Modules.Onepagecheckout.Shop')
);
}
@@ -58,7 +57,7 @@ public function handle(array $requestParameters = []): array
if (!$this->buildAddressPersister($customerId)->save($address, \Tools::getToken(true, $this->context))) {
return CheckoutAjaxResponse::error(
- $this->translator->trans('Unable to save address.', [], ModuleTranslation::SHOP_DOMAIN)
+ $this->translator->trans('Unable to save address.', [], 'Modules.Onepagecheckout.Shop')
);
}
@@ -124,8 +123,8 @@ private function hydrateAddressFromForm(
$address->id_customer = $customerId;
$address->alias = trim((string) ($address->alias ?: ($addressType === 'invoice'
- ? $this->translator->trans('Invoice address', [], ModuleTranslation::SHOP_DOMAIN)
- : $this->translator->trans('My Address', [], ModuleTranslation::SHOP_DOMAIN))));
+ ? $this->translator->trans('Invoice address', [], 'Modules.Onepagecheckout.Shop')
+ : $this->translator->trans('My Address', [], 'Modules.Onepagecheckout.Shop'))));
$address->id_country = (int) $address->id_country;
$address->id_state = (int) ($address->id_state ?: 0);
\Hook::exec('actionSubmitCustomerAddressForm', ['address' => &$address]);
diff --git a/src/Checkout/Ajax/Carrier/OnePageCheckoutCarriersHandler.php b/src/Checkout/Ajax/Carrier/OnePageCheckoutCarriersHandler.php
index 12f620a..f6dd324 100644
--- a/src/Checkout/Ajax/Carrier/OnePageCheckoutCarriersHandler.php
+++ b/src/Checkout/Ajax/Carrier/OnePageCheckoutCarriersHandler.php
@@ -2,7 +2,6 @@
namespace PrestaShop\Module\PsOnePageCheckout\Checkout\Ajax;
-use PrestaShop\Module\PsOnePageCheckout\Translation\ModuleTranslation;
use Symfony\Contracts\Translation\TranslatorInterface;
class OnePageCheckoutCarriersHandler
@@ -54,7 +53,7 @@ public function handle(array $requestParameters = []): array
$requestedAddressId = (int) $requestParameters['id_address_delivery'];
if (!$this->isOwnedCheckoutAddress($requestedAddressId)) {
return CheckoutAjaxResponse::error(
- $this->translator->trans('Invalid delivery address.', [], ModuleTranslation::SHOP_DOMAIN),
+ $this->translator->trans('Invalid delivery address.', [], 'Modules.Onepagecheckout.Shop'),
'id_address_delivery'
);
}
diff --git a/src/Checkout/Ajax/Carrier/OnePageCheckoutSelectCarrierHandler.php b/src/Checkout/Ajax/Carrier/OnePageCheckoutSelectCarrierHandler.php
index c6ae7a3..a4babb2 100644
--- a/src/Checkout/Ajax/Carrier/OnePageCheckoutSelectCarrierHandler.php
+++ b/src/Checkout/Ajax/Carrier/OnePageCheckoutSelectCarrierHandler.php
@@ -2,7 +2,6 @@
namespace PrestaShop\Module\PsOnePageCheckout\Checkout\Ajax;
-use PrestaShop\Module\PsOnePageCheckout\Translation\ModuleTranslation;
use Symfony\Contracts\Translation\TranslatorInterface;
class OnePageCheckoutSelectCarrierHandler
@@ -41,14 +40,14 @@ public function handle(array $requestParameters = []): array
$deliveryOption = (string) ($requestParameters['delivery_option'] ?? '');
if ($deliveryOption === '') {
return CheckoutAjaxResponse::error(
- $this->translator->trans('Missing delivery option.', [], ModuleTranslation::SHOP_DOMAIN),
+ $this->translator->trans('Missing delivery option.', [], 'Modules.Onepagecheckout.Shop'),
'delivery_option'
);
}
if (!\Validate::isLoadedObject($this->context->cart)) {
return CheckoutAjaxResponse::error(
- $this->translator->trans('Unable to resolve the current cart.', [], ModuleTranslation::SHOP_DOMAIN)
+ $this->translator->trans('Unable to resolve the current cart.', [], 'Modules.Onepagecheckout.Shop')
);
}
@@ -62,7 +61,7 @@ public function handle(array $requestParameters = []): array
if ($deliveryAddressId <= 0) {
return CheckoutAjaxResponse::error(
- $this->translator->trans('Unable to resolve the current delivery address.', [], ModuleTranslation::SHOP_DOMAIN)
+ $this->translator->trans('Unable to resolve the current delivery address.', [], 'Modules.Onepagecheckout.Shop')
);
}
diff --git a/src/Checkout/Ajax/Customer/OnePageCheckoutGuestInitHandler.php b/src/Checkout/Ajax/Customer/OnePageCheckoutGuestInitHandler.php
index 755480b..7447a3d 100644
--- a/src/Checkout/Ajax/Customer/OnePageCheckoutGuestInitHandler.php
+++ b/src/Checkout/Ajax/Customer/OnePageCheckoutGuestInitHandler.php
@@ -14,7 +14,6 @@
use Db;
use PrestaShop\Module\PsOnePageCheckout\Checkout\ExistingCustomerState;
use PrestaShop\Module\PsOnePageCheckout\Form\OnePageCheckoutForm;
-use PrestaShop\Module\PsOnePageCheckout\Translation\ModuleTranslation;
use PrestaShop\PrestaShop\Core\Util\InternationalizedDomainNameConverter;
use Symfony\Contracts\Translation\TranslatorInterface;
@@ -120,7 +119,7 @@ public function handle(array $requestParameters): array
if (!$this->isOnePageCheckoutEnabled) {
return $this->errorResponse(
self::ERROR_FIELD_GLOBAL,
- $this->translator->trans('One-page checkout is not enabled.', [], ModuleTranslation::SHOP_DOMAIN)
+ $this->translator->trans('One-page checkout is not enabled.', [], 'Modules.Onepagecheckout.Shop')
);
}
@@ -133,7 +132,7 @@ public function handle(array $requestParameters): array
if (!$this->isTokenValid($requestParameters)) {
return $this->errorResponse(
self::ERROR_FIELD_TOKEN,
- $this->translator->trans('Invalid security token.', [], ModuleTranslation::SHOP_DOMAIN),
+ $this->translator->trans('Invalid security token.', [], 'Modules.Onepagecheckout.Shop'),
false
);
}
@@ -473,7 +472,7 @@ private function resolveGuestEmail(string $submittedEmail, ExistingCustomerState
if (!$this->customerPersister->save($existingCustomer, '', '', false)) {
return $this->errorResponse(
self::ERROR_FIELD_EMAIL,
- $this->translator->trans(self::ERROR_GUEST_EMAIL_UPDATE_FAILED, [], ModuleTranslation::SHOP_DOMAIN)
+ $this->translator->trans(self::ERROR_GUEST_EMAIL_UPDATE_FAILED, [], 'Modules.Onepagecheckout.Shop')
);
}
@@ -686,7 +685,7 @@ private function cartSyncErrorResponse(): array
{
return $this->errorResponse(
self::ERROR_FIELD_GLOBAL,
- $this->translator->trans(self::ERROR_CART_CUSTOMER_SYNC_FAILED, [], ModuleTranslation::SHOP_DOMAIN)
+ $this->translator->trans(self::ERROR_CART_CUSTOMER_SYNC_FAILED, [], 'Modules.Onepagecheckout.Shop')
);
}
diff --git a/src/Checkout/Ajax/OrderOptions/OnePageCheckoutGiftWrappingHandler.php b/src/Checkout/Ajax/OrderOptions/OnePageCheckoutGiftWrappingHandler.php
index d21b520..d637582 100644
--- a/src/Checkout/Ajax/OrderOptions/OnePageCheckoutGiftWrappingHandler.php
+++ b/src/Checkout/Ajax/OrderOptions/OnePageCheckoutGiftWrappingHandler.php
@@ -8,7 +8,6 @@
use PrestaShop\Module\PsOnePageCheckout\Checkout\Ajax\OpcTempAddress;
use PrestaShop\Module\PsOnePageCheckout\Checkout\Ajax\TempAddressCarrierSelectionStorage;
use PrestaShop\Module\PsOnePageCheckout\Checkout\Ajax\TempAddressStorage;
-use PrestaShop\Module\PsOnePageCheckout\Translation\ModuleTranslation;
use Symfony\Contracts\Translation\TranslatorInterface;
class OnePageCheckoutGiftWrappingHandler
@@ -39,13 +38,13 @@ public function handle(array $requestParameters = []): array
{
if (!\Validate::isLoadedObject($this->context->cart)) {
return CheckoutAjaxResponse::error(
- $this->translator->trans('Unable to resolve the current cart.', [], ModuleTranslation::SHOP_DOMAIN)
+ $this->translator->trans('Unable to resolve the current cart.', [], 'Modules.Onepagecheckout.Shop')
);
}
if (!(bool) \Configuration::get('PS_GIFT_WRAPPING')) {
return CheckoutAjaxResponse::error(
- $this->translator->trans('Gift wrapping is currently unavailable.', [], ModuleTranslation::SHOP_DOMAIN)
+ $this->translator->trans('Gift wrapping is currently unavailable.', [], 'Modules.Onepagecheckout.Shop')
);
}
diff --git a/src/Checkout/Ajax/Payment/OnePageCheckoutSelectPaymentHandler.php b/src/Checkout/Ajax/Payment/OnePageCheckoutSelectPaymentHandler.php
index 4d40a1a..161d570 100644
--- a/src/Checkout/Ajax/Payment/OnePageCheckoutSelectPaymentHandler.php
+++ b/src/Checkout/Ajax/Payment/OnePageCheckoutSelectPaymentHandler.php
@@ -2,7 +2,6 @@
namespace PrestaShop\Module\PsOnePageCheckout\Checkout\Ajax;
-use PrestaShop\Module\PsOnePageCheckout\Translation\ModuleTranslation;
use Symfony\Contracts\Translation\TranslatorInterface;
class OnePageCheckoutSelectPaymentHandler
@@ -29,7 +28,7 @@ public function handle(array $requestParameters = []): array
if ($this->hasMissingPaymentSelectionPayload($paymentOption, $paymentModule, $paymentSelectionKey)) {
return CheckoutAjaxResponse::error(
- $this->translator->trans('Missing payment selection payload.', [], ModuleTranslation::SHOP_DOMAIN)
+ $this->translator->trans('Missing payment selection payload.', [], 'Modules.Onepagecheckout.Shop')
);
}
diff --git a/src/Checkout/Ajax/Submit/OnePageCheckoutSubmitProcessor.php b/src/Checkout/Ajax/Submit/OnePageCheckoutSubmitProcessor.php
index 7b5c161..6ba6942 100644
--- a/src/Checkout/Ajax/Submit/OnePageCheckoutSubmitProcessor.php
+++ b/src/Checkout/Ajax/Submit/OnePageCheckoutSubmitProcessor.php
@@ -4,7 +4,6 @@
use PrestaShop\Module\PsOnePageCheckout\Checkout\PaymentSelectionKeyBuilder;
use PrestaShop\Module\PsOnePageCheckout\Form\OnePageCheckoutForm;
-use PrestaShop\Module\PsOnePageCheckout\Translation\ModuleTranslation;
use Symfony\Contracts\Translation\TranslatorInterface;
class OnePageCheckoutSubmitProcessor
@@ -133,7 +132,7 @@ private function validateIdentitySection(array $requestParameters): bool
}
$this->validationErrors['identity'] = [
- 'email' => $this->translator->trans('Invalid email format.', [], ModuleTranslation::SHOP_DOMAIN),
+ 'email' => $this->translator->trans('Invalid email format.', [], 'Modules.Onepagecheckout.Shop'),
];
return false;
@@ -171,7 +170,7 @@ private function validateShippingSection(\CheckoutSession $checkoutSession, arra
if ($deliveryOptionKey === '' || empty($deliveryOptions[$deliveryOptionKey])) {
$this->validationErrors['shipping'] = [
- 'delivery_option' => $this->translator->trans('Please select a shipping method.', [], ModuleTranslation::SHOP_DOMAIN),
+ 'delivery_option' => $this->translator->trans('Please select a shipping method.', [], 'Modules.Onepagecheckout.Shop'),
];
return false;
@@ -211,7 +210,7 @@ private function validatePaymentSection(\CheckoutSession $checkoutSession, array
}
$this->validationErrors['payment'] = [
- 'paymentMethod' => $this->translator->trans('Please select a payment method.', [], ModuleTranslation::SHOP_DOMAIN),
+ 'paymentMethod' => $this->translator->trans('Please select a payment method.', [], 'Modules.Onepagecheckout.Shop'),
];
return false;
@@ -235,7 +234,7 @@ private function validateConditionsSection(array $requestParameters): bool
}
$this->validationErrors['conditions'] = [
- 'conditions_to_approve' => $this->translator->trans('Please accept the terms of service.', [], ModuleTranslation::SHOP_DOMAIN),
+ 'conditions_to_approve' => $this->translator->trans('Please accept the terms of service.', [], 'Modules.Onepagecheckout.Shop'),
];
return false;
diff --git a/src/Checkout/CheckoutOnePageStep.php b/src/Checkout/CheckoutOnePageStep.php
index 8963d32..7add484 100644
--- a/src/Checkout/CheckoutOnePageStep.php
+++ b/src/Checkout/CheckoutOnePageStep.php
@@ -29,7 +29,6 @@
use PrestaShop\Module\PsOnePageCheckout\Checkout\Ajax\Submit\OnePageCheckoutSubmitValidationStateStorage;
use PrestaShop\Module\PsOnePageCheckout\Form\OnePageCheckoutForm;
-use PrestaShop\Module\PsOnePageCheckout\Translation\ModuleTranslation;
use PrestaShop\PrestaShop\Adapter\Product\PriceFormatter;
use Symfony\Contracts\Translation\TranslatorInterface;
@@ -193,7 +192,7 @@ public function handleRequest(array $requestParameters = [])
}
$this->setTitle(
- $this->getTranslator()->trans('Checkout', [], ModuleTranslation::SHOP_DOMAIN)
+ $this->getTranslator()->trans('Checkout', [], 'Modules.Onepagecheckout.Shop')
);
}
diff --git a/src/Form/BackOfficeConfigurationForm.php b/src/Form/BackOfficeConfigurationForm.php
index ac85fa1..6d6b77d 100644
--- a/src/Form/BackOfficeConfigurationForm.php
+++ b/src/Form/BackOfficeConfigurationForm.php
@@ -30,7 +30,6 @@
namespace PrestaShop\Module\PsOnePageCheckout\Form;
use PrestaShop\Module\PsOnePageCheckout\Analytics\Analytics;
-use PrestaShop\Module\PsOnePageCheckout\Translation\ModuleTranslation;
use Twig\Environment;
class BackOfficeConfigurationForm
@@ -72,7 +71,7 @@ public function renderBackOfficeConfiguration(): string
if ($isMaintenanceEnabled && !$this->enableMaintenanceMode()) {
return $this->module->displayError(
- $this->trans('Unable to enable maintenance mode. Checkout layout was not changed.', 'Modules.PsOnePageCheckout.Admin')
+ $this->trans('Unable to enable maintenance mode. Checkout layout was not changed.', 'Modules.Onepagecheckout.Admin')
) . $this->renderConfigurationForm();
}
@@ -92,7 +91,7 @@ public function renderBackOfficeConfiguration(): string
if ($this->consumeMaintenanceFlash()) {
$output .= $this->module->displayWarning(
- $this->trans('Checkout layout has been changed. Shop is now in maintenance mode.', 'Modules.PsOnePageCheckout.Admin')
+ $this->trans('Checkout layout has been changed. Shop is now in maintenance mode.', 'Modules.Onepagecheckout.Admin')
);
} elseif ($this->consumeSuccessFlash()) {
$output .= $this->module->displayConfirmation(
@@ -127,8 +126,8 @@ private function renderConfigurationForm(): string
private function buildTemplateVariables(): array
{
$isEnabled = $this->getCurrentConfigurationValue() === 1;
- $onePageLabel = $this->trans('One-page checkout', 'Admin.Design.Feature');
- $fourPageLabel = $this->trans('Four-page checkout', 'Admin.Design.Feature');
+ $onePageLabel = $this->trans('One-page checkout', 'Modules.Onepagecheckout.Admin');
+ $fourPageLabel = $this->trans('Four-page checkout', 'Modules.Onepagecheckout.Admin');
$isMaintenanceEnabled = (int) \Configuration::get('PS_SHOP_ENABLE') === 0;
@@ -143,29 +142,29 @@ private function buildTemplateVariables(): array
'Note that this page is available in a single shop context only. Switch context to work on it.',
'Admin.Notifications.Info'
),
- 'checkout_layout_title' => $this->trans('Checkout layout', 'Admin.Design.Feature'),
+ 'checkout_layout_title' => $this->trans('Checkout layout', 'Modules.Onepagecheckout.Admin'),
'checkout_layout_description' => $this->trans(
'Allow faster checkout for higher conversion and spontaneous purchases.',
- 'Admin.Design.Feature'
+ 'Modules.Onepagecheckout.Admin'
),
'save_button_label' => $this->trans('Save', 'Admin.Actions'),
- 'confirm_modal_title' => $this->trans('Change checkout appearance', 'Modules.PsOnePageCheckout.Admin'),
- 'confirm_modal_compatibility_title' => $this->trans('Check theme compatibility', 'Modules.PsOnePageCheckout.Admin'),
- 'confirm_modal_description' => $this->trans('You\'re about to update the Checkout appearance of your store.', 'Modules.PsOnePageCheckout.Admin'),
- 'confirm_modal_compatibility_description' => $this->trans('One-page checkout layout requires a Bootstrap 5-compatible theme.', 'Modules.PsOnePageCheckout.Admin'),
- 'confirm_modal_checklist_title' => $this->trans('Before you proceed, please make sure that:', 'Modules.PsOnePageCheckout.Admin'),
+ 'confirm_modal_title' => $this->trans('Change checkout appearance', 'Modules.Onepagecheckout.Admin'),
+ 'confirm_modal_compatibility_title' => $this->trans('Check theme compatibility', 'Modules.Onepagecheckout.Admin'),
+ 'confirm_modal_description' => $this->trans('You\'re about to update the Checkout appearance of your store.', 'Modules.Onepagecheckout.Admin'),
+ 'confirm_modal_compatibility_description' => $this->trans('One-page checkout layout requires a Bootstrap 5-compatible theme.', 'Modules.Onepagecheckout.Admin'),
+ 'confirm_modal_checklist_title' => $this->trans('Before you proceed, please make sure that:', 'Modules.Onepagecheckout.Admin'),
'confirm_modal_checklist' => [
- $this->trans('You are NOT using the "Classic" theme: This layout is incompatible with the legacy Classic theme and will break your storefront.', 'Modules.PsOnePageCheckout.Admin'),
- $this->trans('Your theme is compatible with the one-page checkout DOM and Bootstrap 5: Custom or third-party themes must support this new checkout architecture.', 'Modules.PsOnePageCheckout.Admin'),
- $this->trans('Your checkout modules are compatible. Some older modules may not be compatible with a one-page layout.', 'Modules.PsOnePageCheckout.Admin'),
+ $this->trans('You are NOT using the "Classic" theme: This layout is incompatible with the legacy Classic theme and will break your storefront.', 'Modules.Onepagecheckout.Admin'),
+ $this->trans('Your theme is compatible with the one-page checkout DOM and Bootstrap 5: Custom or third-party themes must support this new checkout architecture.', 'Modules.Onepagecheckout.Admin'),
+ $this->trans('Your checkout modules are compatible. Some older modules may not be compatible with a one-page layout.', 'Modules.Onepagecheckout.Admin'),
],
'cancel_button_label' => $this->trans('Cancel', 'Admin.Actions'),
- 'confirm_button_label' => $this->trans('Change checkout appearance', 'Modules.PsOnePageCheckout.Admin'),
+ 'confirm_button_label' => $this->trans('Change checkout appearance', 'Modules.Onepagecheckout.Admin'),
'maintenance_mode_input_name' => self::MAINTENANCE_INPUT_NAME,
- 'maintenance_mode_label' => $this->trans('Maintenance mode', 'Modules.PsOnePageCheckout.Admin'),
+ 'maintenance_mode_label' => $this->trans('Maintenance mode', 'Modules.Onepagecheckout.Admin'),
'maintenance_mode_warning' => $this->trans(
'We strongly recommend enabling Maintenance Mode or testing this in a Staging Environment first to ensure a smooth transition for your customers.',
- 'Modules.PsOnePageCheckout.Admin'
+ 'Modules.Onepagecheckout.Admin'
),
'choices' => [
[
@@ -173,18 +172,18 @@ private function buildTemplateVariables(): array
'value' => 1,
'checked' => $isEnabled,
'label' => $onePageLabel,
- 'badge' => $this->trans('Recommended', 'Admin.Design.Feature'),
+ 'badge' => $this->trans('Recommended', 'Modules.Onepagecheckout.Admin'),
'description' => $this->trans(
'Propose the best checkout experience to your clients with the one-page layout. All the payment steps will be displayed in one page and let you benefit from:',
- 'Admin.Design.Feature'
+ 'Modules.Onepagecheckout.Admin'
),
'features' => [
- $this->trans('Reduced time spent, less clicks & no extra-step', 'Admin.Design.Feature'),
+ $this->trans('Reduced time spent, less clicks & no extra-step', 'Modules.Onepagecheckout.Admin'),
$this->trans(
'Increased conversion with a seamless and frictionless experience',
- 'Admin.Design.Feature'
+ 'Modules.Onepagecheckout.Admin'
),
- $this->trans('Mobile-friendly checkout', 'Admin.Design.Feature'),
+ $this->trans('Mobile-friendly checkout', 'Modules.Onepagecheckout.Admin'),
],
'illustration' => $this->module->getPathUri() . 'views/img/checkout/one-page-checkout.svg',
],
@@ -196,15 +195,15 @@ private function buildTemplateVariables(): array
'badge' => '',
'description' => $this->trans(
'Propose a step-by-step checkout experience. All the usual payment steps will be displayed on different screens. Choose this method if:',
- 'Admin.Design.Feature'
+ 'Modules.Onepagecheckout.Admin'
),
'features' => [
$this->trans(
'You need flexibility for complex or specific information',
- 'Admin.Design.Feature'
+ 'Modules.Onepagecheckout.Admin'
),
- $this->trans('You\'re under regulatory compliance', 'Admin.Design.Feature'),
- $this->trans('You want to integrate upsell & cross-sell strategies', 'Admin.Design.Feature'),
+ $this->trans('You\'re under regulatory compliance', 'Modules.Onepagecheckout.Admin'),
+ $this->trans('You want to integrate upsell & cross-sell strategies', 'Modules.Onepagecheckout.Admin'),
],
'illustration' => $this->module->getPathUri() . 'views/img/checkout/four-page-checkout.svg',
],
@@ -242,7 +241,7 @@ private function registerBackOfficeAssets(): void
);
}
- private function trans(string $message, string $domain = ModuleTranslation::ADMIN_DOMAIN): string
+ private function trans(string $message, string $domain = 'Modules.Onepagecheckout.Admin'): string
{
$translator = \Context::getContext()->getTranslator();
diff --git a/src/Form/OnePageCheckoutForm.php b/src/Form/OnePageCheckoutForm.php
index 60d6267..446bbcc 100644
--- a/src/Form/OnePageCheckoutForm.php
+++ b/src/Form/OnePageCheckoutForm.php
@@ -33,7 +33,6 @@
use Customer;
use PrestaShop\Module\PsOnePageCheckout\Checkout\Ajax\CheckoutCustomerContextResolver;
use PrestaShop\Module\PsOnePageCheckout\Checkout\Ajax\CheckoutCustomerTemplateBuilder;
-use PrestaShop\Module\PsOnePageCheckout\Translation\ModuleTranslation;
use PrestaShop\PrestaShop\Core\Util\InternationalizedDomainNameConverter;
use Symfony\Contracts\Translation\TranslatorInterface;
use Validate;
@@ -312,7 +311,7 @@ public function submit()
);
$deliveryAddress->id_customer = $customer->id;
if (empty($deliveryAddress->alias)) {
- $deliveryAddress->alias = $this->translator->trans('My Address', [], ModuleTranslation::SHOP_DOMAIN);
+ $deliveryAddress->alias = $this->translator->trans('My Address', [], 'Modules.Onepagecheckout.Shop');
}
\Hook::exec('actionSubmitCustomerAddressForm', ['address' => &$deliveryAddress]);
if (!$this->addressPersister->save($deliveryAddress, $token)) {
@@ -338,7 +337,7 @@ public function submit()
'invoice_'
);
$invoiceAddress->id_customer = $customer->id;
- $invoiceAddress->alias = $invoiceAddress->alias ?: $this->translator->trans('Invoice address', [], ModuleTranslation::SHOP_DOMAIN);
+ $invoiceAddress->alias = $invoiceAddress->alias ?: $this->translator->trans('Invoice address', [], 'Modules.Onepagecheckout.Shop');
\Hook::exec('actionSubmitCustomerAddressForm', ['address' => &$invoiceAddress]);
if (!$this->addressPersister->save($invoiceAddress, $token)) {
return false;
@@ -559,7 +558,7 @@ private function isGuestInitEmailValid(): bool
}
$emailField->addError(
- $this->translator->trans('Invalid email format.', [], ModuleTranslation::SHOP_DOMAIN)
+ $this->translator->trans('Invalid email format.', [], 'Modules.Onepagecheckout.Shop')
);
return false;
diff --git a/src/Form/OnePageCheckoutFormatter.php b/src/Form/OnePageCheckoutFormatter.php
index 4529605..e6ceec2 100644
--- a/src/Form/OnePageCheckoutFormatter.php
+++ b/src/Form/OnePageCheckoutFormatter.php
@@ -29,7 +29,6 @@
use Address;
use Country;
-use PrestaShop\Module\PsOnePageCheckout\Translation\ModuleTranslation;
use Symfony\Contracts\Translation\TranslatorInterface;
class OnePageCheckoutFormatter implements \FormFormatterInterface
@@ -152,7 +151,7 @@ public function getFormat()
->setName('use_same_address')
->setType('checkbox')
->setLabel(
- $this->translator->trans('Use the same address for invoice', [], ModuleTranslation::SHOP_DOMAIN)
+ $this->translator->trans('Use the same address for invoice', [], 'Modules.Onepagecheckout.Shop')
)
->setValue(true);
diff --git a/src/Translation/ModuleTranslation.php b/src/Translation/ModuleTranslation.php
deleted file mode 100644
index e42b89c..0000000
--- a/src/Translation/ModuleTranslation.php
+++ /dev/null
@@ -1,9 +0,0 @@
-
+
- {l s='Address details:' d='Shop.Theme.Actions'}
+ {l s='Address details:' d='Modules.Onepagecheckout.Shop'}
{$address.firstname} {$address.lastname}
{$address.address1}{if $address.address2} {$address.address2}{/if}
{$address.postcode} {$address.city}
@@ -51,7 +51,7 @@
class="btn p-0"
data-bs-toggle="dropdown"
aria-expanded="false"
- aria-label="{l s='Address options' d='Shop.Theme.Actions'}"
+ aria-label="{l s='Address options' d='Modules.Onepagecheckout.Shop'}"
>
more_vert
@@ -78,7 +78,7 @@
data-phone="{$address.phone|escape:'html':'UTF-8'}"
data-address="{$address|@json_encode|escape:'htmlall':'UTF-8'}"
>
- {l s='Edit' d='Shop.Theme.Actions'}
+ {l s='Edit' d='Modules.Onepagecheckout.Shop'}