diff --git a/core/lib/Thelia/Config/I18n/en_US.php b/core/lib/Thelia/Config/I18n/en_US.php index 0912c6614..b3c312c5a 100755 --- a/core/lib/Thelia/Config/I18n/en_US.php +++ b/core/lib/Thelia/Config/I18n/en_US.php @@ -226,4 +226,6 @@ return array( 'Tax list is not valid JSON' => 'Tax list is not valid JSON', 'Bad tax list JSON' => 'Bad tax list JSON', 'Tax ID not found in tax list JSON' => 'Tax ID not found in tax list JSON', + 'Please check your input: %s' => 'Please check your input: %s', + 'Sorry, an error occured: %s' => 'Sorry, an error occured: %s', ); diff --git a/core/lib/Thelia/Config/I18n/fr_FR.php b/core/lib/Thelia/Config/I18n/fr_FR.php index d3b96167f..ab7492dd6 100755 --- a/core/lib/Thelia/Config/I18n/fr_FR.php +++ b/core/lib/Thelia/Config/I18n/fr_FR.php @@ -225,4 +225,6 @@ return array( 'Tax list is not valid JSON' => 'Le JSON de la liste des taxes n\'est pas valide', 'Bad tax list JSON' => 'Mauvais JSON de la liste des taxes', 'Tax ID not found in tax list JSON' => 'ID de la taxe non trouvé dans le JSON de la liste des taxes', + 'Please check your input: %s' => 'Veuillez vérifier votre saisie: %s', + 'Sorry, an error occured: %s' => 'Désolé, une erreur est survenue: %s', ); diff --git a/core/lib/Thelia/Form/CartAdd.php b/core/lib/Thelia/Form/CartAdd.php index 0d54274ff..7b750b40d 100644 --- a/core/lib/Thelia/Form/CartAdd.php +++ b/core/lib/Thelia/Form/CartAdd.php @@ -109,7 +109,7 @@ class CartAdd extends BaseForm $product = ProductQuery::create()->findPk($value); if (is_null($product) || $product->getVisible() == 0) { - throw new ProductNotFoundException(Translator::getInstance()->trans(sprintf("this product id does not exists : %d", $value))); + throw new ProductNotFoundException(sprintf(Translator::getInstance()->trans("this product id does not exists : %d"), $value)); } } @@ -124,7 +124,7 @@ class CartAdd extends BaseForm ->count(); if ($productSaleElements == 0) { - throw new StockNotFoundException(Translator::getInstance()->trans(sprintf("This product_sale_elements_id does not exists for this product : %d", $value))); + throw new StockNotFoundException(sprintf(Translator::getInstance()->trans("This product_sale_elements_id does not exists for this product : %d"), $value)); } } } diff --git a/core/lib/Thelia/Form/OrderDelivery.php b/core/lib/Thelia/Form/OrderDelivery.php index b727ed189..37172612a 100644 --- a/core/lib/Thelia/Form/OrderDelivery.php +++ b/core/lib/Thelia/Form/OrderDelivery.php @@ -88,7 +88,7 @@ class OrderDelivery extends BaseForm $moduleReflection = new \ReflectionClass($module->getFullNamespace()); if ($moduleReflection->isSubclassOf("Thelia\Module\DeliveryModuleInterface") === false) { $context->addViolation( - Translator::getInstance()->trans(sprintf("delivery module %s is not a Thelia\Module\DeliveryModuleInterface", $module->getCode())) + sprintf(Translator::getInstance()->trans("delivery module %s is not a Thelia\Module\DeliveryModuleInterface"), $module->getCode()) ); } } diff --git a/core/lib/Thelia/Form/OrderPayment.php b/core/lib/Thelia/Form/OrderPayment.php index be02bd0f6..1ae4fa06c 100644 --- a/core/lib/Thelia/Form/OrderPayment.php +++ b/core/lib/Thelia/Form/OrderPayment.php @@ -88,7 +88,7 @@ class OrderPayment extends BaseForm $moduleReflection = new \ReflectionClass($module->getFullNamespace()); if ($moduleReflection->isSubclassOf("Thelia\Module\PaymentModuleInterface") === false) { $context->addViolation( - Translator::getInstance()->trans(sprintf("delivery module %s is not a Thelia\Module\PaymentModuleInterface", $module->getCode())) + sprintf(Translator::getInstance()->trans("delivery module %s is not a Thelia\Module\PaymentModuleInterface"), $module->getCode()) ); } } diff --git a/local/modules/Front/Controller/AddressController.php b/local/modules/Front/Controller/AddressController.php index dac75a195..f8cbde0a4 100644 --- a/local/modules/Front/Controller/AddressController.php +++ b/local/modules/Front/Controller/AddressController.php @@ -26,6 +26,7 @@ use Thelia\Controller\Front\BaseFrontController; use Thelia\Core\Event\Address\AddressCreateOrUpdateEvent; use Thelia\Core\Event\Address\AddressEvent; use Thelia\Core\Event\TheliaEvents; +use Thelia\Core\Translation\Translator; use Thelia\Form\AddressCreateForm; use Thelia\Form\AddressUpdateForm; use Thelia\Form\Exception\FormValidationException; @@ -77,9 +78,9 @@ class AddressController extends BaseFrontController $this->redirectSuccess($addressCreate); } catch (FormValidationException $e) { - $message = sprintf("Please check your input: %s", $e->getMessage()); + $message = sprintf(Translator::getInstance()->trans("Please check your input: %s"), $e->getMessage()); } catch (\Exception $e) { - $message = sprintf("Sorry, an error occured: %s", $e->getMessage()); + $message = sprintf(Translator::getInstance()->trans("Sorry, an error occured: %s"), $e->getMessage()); } if ($message !== false) { @@ -137,9 +138,9 @@ class AddressController extends BaseFrontController $this->redirectSuccess($addressUpdate); } catch (FormValidationException $e) { - $message = sprintf("Please check your input: %s", $e->getMessage()); + $message = sprintf(Translator::getInstance()->trans("Please check your input: %s"), $e->getMessage()); } catch (\Exception $e) { - $message = sprintf("Sorry, an error occured: %s", $e->getMessage()); + $message = sprintf(Translator::getInstance()->trans("Sorry, an error occured: %s"), $e->getMessage()); } $this->getParserContext()->set("address_id", $address_id); if ($message !== false) { diff --git a/local/modules/Front/Controller/CustomerController.php b/local/modules/Front/Controller/CustomerController.php index e66a6e2a8..ec8c83c82 100644 --- a/local/modules/Front/Controller/CustomerController.php +++ b/local/modules/Front/Controller/CustomerController.php @@ -30,6 +30,7 @@ use Thelia\Core\Event\Newsletter\NewsletterEvent; use Thelia\Core\Security\Authentication\CustomerUsernamePasswordFormAuthenticator; use Thelia\Core\Security\Exception\AuthenticationException; use Thelia\Core\Security\Exception\UsernameNotFoundException; +use Thelia\Core\Translation\Translator; use Thelia\Form\CustomerCreateForm; use Thelia\Form\CustomerLogin; use Thelia\Form\CustomerLostPasswordForm; @@ -68,9 +69,9 @@ class CustomerController extends BaseFrontController $this->dispatch(TheliaEvents::LOST_PASSWORD, $event); } catch (FormValidationException $e) { - $message = sprintf("Please check your input: %s", $e->getMessage()); + $message = sprintf(Translator::getInstance()->trans("Please check your input: %s"), $e->getMessage()); } catch (\Exception $e) { - $message = sprintf("Sorry, an error occured: %s", $e->getMessage()); + $message = sprintf(Translator::getInstance()->trans("Sorry, an error occured: %s"), $e->getMessage()); } if ($message !== false) { @@ -132,9 +133,9 @@ class CustomerController extends BaseFrontController $this->redirectSuccess($customerCreation); } } catch (FormValidationException $e) { - $message = sprintf("Please check your input: %s", $e->getMessage()); + $message = sprintf(Translator::getInstance()->trans("Please check your input: %s"), $e->getMessage()); } catch (\Exception $e) { - $message = sprintf("Sorry, an error occured: %s", $e->getMessage()); + $message = sprintf(Translator::getInstance()->trans("Sorry, an error occured: %s"), $e->getMessage()); } if ($message !== false) { @@ -193,9 +194,9 @@ class CustomerController extends BaseFrontController $this->redirectSuccess($customerPasswordUpdateForm); } catch (FormValidationException $e) { - $message = sprintf("Please check your input: %s", $e->getMessage()); + $message = sprintf(Translator::getInstance()->trans("Please check your input: %s"), $e->getMessage()); } catch (\Exception $e) { - $message = sprintf("Sorry, an error occured: %s", $e->getMessage()); + $message = sprintf(Translator::getInstance()->trans("Sorry, an error occured: %s"), $e->getMessage()); } if ($message !== false) { @@ -256,9 +257,9 @@ class CustomerController extends BaseFrontController $this->redirectSuccess($customerProfileUpdateForm); } catch (FormValidationException $e) { - $message = sprintf("Please check your input: %s", $e->getMessage()); + $message = sprintf(Translator::getInstance()->trans("Please check your input: %s"), $e->getMessage()); } catch (\Exception $e) { - $message = sprintf("Sorry, an error occured: %s", $e->getMessage()); + $message = sprintf(Translator::getInstance()->trans("Sorry, an error occured: %s"), $e->getMessage()); } if ($message !== false) { @@ -319,9 +320,9 @@ class CustomerController extends BaseFrontController } } catch (FormValidationException $e) { - $message = sprintf("Please check your input: %s", $e->getMessage()); + $message = sprintf(Translator::getInstance()->trans("Please check your input: %s"), $e->getMessage()); } catch (\Exception $e) { - $message = sprintf("Sorry, an error occured: %s", $e->getMessage()); + $message = sprintf(Translator::getInstance()->trans("Sorry, an error occured: %s"), $e->getMessage()); } if ($message !== false) { diff --git a/local/modules/Front/Controller/OrderController.php b/local/modules/Front/Controller/OrderController.php index e69bf6ea7..4791663f0 100644 --- a/local/modules/Front/Controller/OrderController.php +++ b/local/modules/Front/Controller/OrderController.php @@ -28,6 +28,7 @@ use Thelia\Controller\Front\BaseFrontController; use Thelia\Core\Event\PdfEvent; use Thelia\Core\HttpFoundation\Response; use Thelia\Core\Template\TemplateHelper; +use Thelia\Core\Translation\Translator; use Thelia\Exception\TheliaProcessException; use Thelia\Form\Exception\FormValidationException; use Thelia\Core\Event\Order\OrderEvent; @@ -103,11 +104,11 @@ class OrderController extends BaseFrontController $this->redirectToRoute("order.invoice"); } catch (FormValidationException $e) { - $message = sprintf("Please check your input: %s", $e->getMessage()); + $message = sprintf(Translator::getInstance()->trans("Please check your input: %s"), $e->getMessage()); } catch (PropelException $e) { $this->getParserContext()->setGeneralError($e->getMessage()); } catch (\Exception $e) { - $message = sprintf("Sorry, an error occured: %s", $e->getMessage()); + $message = sprintf(Translator::getInstance()->trans("Sorry, an error occured: %s"), $e->getMessage()); } if ($message !== false) { @@ -159,11 +160,11 @@ class OrderController extends BaseFrontController $this->redirectToRoute("order.payment.process"); } catch (FormValidationException $e) { - $message = sprintf("Please check your input: %s", $e->getMessage()); + $message = sprintf(Translator::getInstance()->trans("Please check your input: %s"), $e->getMessage()); } catch (PropelException $e) { $this->getParserContext()->setGeneralError($e->getMessage()); } catch (\Exception $e) { - $message = sprintf("Sorry, an error occured: %s", $e->getMessage()); + $message = sprintf(Translator::getInstance()->trans("Sorry, an error occured: %s"), $e->getMessage()); } if ($message !== false) {