diff --git a/core/lib/Thelia/Config/I18n/en_US.php b/core/lib/Thelia/Config/I18n/en_US.php index 3dd37c895..b3c312c5a 100755 --- a/core/lib/Thelia/Config/I18n/en_US.php +++ b/core/lib/Thelia/Config/I18n/en_US.php @@ -198,4 +198,34 @@ return array( 'mailing system modification' => 'mailing system modification', 'shipping area name' => 'shipping area name', 'time format' => 'time format', + 'This value should not be blank.' => 'This value should not be blank.', + 'A user already exists with this email address. Please login or if you\'ve forgotten your password, go to Reset Your Password.' => 'A user already exists with this email address. Please login or if you\'ve forgotten your password, go to Reset Your Password.', + 'Administrator ID not found' => 'Administrator ID not found', + 'This login already exists' => 'This login already exists', + 'password confirmation is not the same as password field' => 'password confirmation is not the same as password field', + 'password must be composed of at least 4 characters' => 'password must be composed of at least 4 characters', + 'this product id does not exists : %d' => 'this product id does not exists : %d', + 'This product_sale_elements_id does not exists for this product : %d' => 'This product_sale_elements_id does not exists for this product : %d', + 'quantity value is not valid' => 'quantity value is not valid', + 'Please accept the Terms and conditions in order to register.' => 'Please accept the Terms and conditions in order to register.', + 'This email already exists.' => 'This email already exists.', + 'This email does not exists' => 'This email does not exists', + 'Your current password does not match.' => 'Your current password does not match.', + 'Module ID not found' => 'Module ID not found', + 'You are already registered!' => 'You are already registered!', + 'Address ID not found' => 'Address ID not found', + 'Delivery module ID not found' => 'Delivery module ID not found', + 'delivery module %s is not a Thelia\Module\DeliveryModuleInterface' => 'delivery module %s is not a Thelia\Module\DeliveryModuleInterface', + 'Order address ID not found' => 'Order address ID not found', + 'Title ID not found' => 'Title ID not found', + 'Country ID not found' => 'Country ID not found', + 'Profile `code` already exists' => 'Profile `code` already exists', + 'Profile ID not found' => 'Profile ID not found', + 'The TaxEngine should be passed to this form before using it.' => 'The TaxEngine should be passed to this form before using it.', + 'Tax rule ID not found' => 'Tax rule ID not found', + '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 b38c48c88..ab7492dd6 100755 --- a/core/lib/Thelia/Config/I18n/fr_FR.php +++ b/core/lib/Thelia/Config/I18n/fr_FR.php @@ -197,4 +197,34 @@ return array( 'mailing system modification' => 'Modification du système d\'envoi de mail.', 'shipping area name' => 'Nom de la zone de livraison', 'time format' => 'Format d\'heure', + 'This value should not be blank.' => 'Cette valeur ne doit pas être vide.', + 'A user already exists with this email address. Please login or if you\'ve forgotten your password, go to Reset Your Password.' => 'Un utilisateur existe déjà avec cette adresse email. Connectez-vous ou demandez une réinitialisation de votre mot de passe.', + 'Administrator ID not found' => 'ID de l\'administrateur not trouvé', + 'This login already exists' => 'Cet identifiant existe déjà', + 'password confirmation is not the same as password field' => 'le mot de passe de confirmation n\'est pas le même que le champ mot de passe', + 'password must be composed of at least 4 characters' => 'le mot de passe doit être composé d\'au moins 4 caractères', + 'this product id does not exists : %d' => 'l\'id du produit %d n\'existe pas', + 'This product_sale_elements_id does not exists for this product : %d' => 'Le product_sale_elements_id n\'existe pas pour ce produit : %d', + 'quantity value is not valid' => 'la valeur de la quantité n\'est pas valide', + 'Please accept the Terms and conditions in order to register.' => 'Veuillez accepter les termes et conditions pour vous inscrire.', + 'This email already exists.' => 'Cette adresse email existe déjà', + 'This email does not exists' => 'Cette adresse email n\'existe pas', + 'Your current password does not match.' => 'Votre mot de passe actuel ne correspond pas', + 'Module ID not found' => 'Id du module non trouvé', + 'You are already registered!' => 'Vous êtes déjà enregistré !', + 'Address ID not found' => 'ID de l\'adresse non trouvé', + 'Delivery module ID not found' => 'Id du module de livraison non trouvé', + 'delivery module %s is not a Thelia\Module\DeliveryModuleInterface' => 'le module de livraison %s n\'est pas un Thelia\Module\DeliveryModuleInterface', + 'Order address ID not found' => 'ID de l\'adresse de la commande non trouvé', + 'Title ID not found' => 'ID de la civilité non trouvé', + 'Country ID not found' => 'ID du pays non trouvé', + 'Profile `code` already exists' => 'Le `code` du profil existe déjà', + 'Profile ID not found' => 'ID du profil non trouvé', + 'The TaxEngine should be passed to this form before using it.' => 'Le moteur de taxe doit être passé au formulaire avant d\'être utilisé.', + 'Tax rule ID not found' => 'ID de la règle de taxe non trouvé', + '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/AdministratorModificationForm.php b/core/lib/Thelia/Form/AdministratorModificationForm.php index 7e7a4a845..d9dae7ce4 100644 --- a/core/lib/Thelia/Form/AdministratorModificationForm.php +++ b/core/lib/Thelia/Form/AdministratorModificationForm.php @@ -25,6 +25,7 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; use Symfony\Component\Validator\ExecutionContextInterface; +use Thelia\Core\Translation\Translator; use Thelia\Model\AdminQuery; class AdministratorModificationForm extends AdministratorCreationForm @@ -67,7 +68,7 @@ class AdministratorModificationForm extends AdministratorCreationForm ->findPk($value); if (null === $administrator) { - $context->addViolation("Administrator ID not found"); + $context->addViolation(Translator::getInstance()->trans("Administrator ID not found")); } } @@ -77,7 +78,7 @@ class AdministratorModificationForm extends AdministratorCreationForm $administrator = AdminQuery::create()->findOneByLogin($value); if ($administrator !== null && $administrator->getId() != $data['id']) { - $context->addViolation("This login already exists"); + $context->addViolation(Translator::getInstance()->trans("This login already exists")); } } @@ -86,11 +87,11 @@ class AdministratorModificationForm extends AdministratorCreationForm $data = $context->getRoot()->getData(); if ($data["password"] != $data["password_confirm"]) { - $context->addViolation("password confirmation is not the same as password field"); + $context->addViolation(Translator::getInstance()->trans("password confirmation is not the same as password field")); } if ($data["password"] !== '' && strlen($data["password"]) < 4) { - $context->addViolation("password must be composed of at least 4 characters"); + $context->addViolation(Translator::getInstance()->trans("password must be composed of at least 4 characters")); } } } diff --git a/core/lib/Thelia/Form/CartAdd.php b/core/lib/Thelia/Form/CartAdd.php index 98e12acde..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(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(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)); } } } @@ -142,7 +142,7 @@ class CartAdd extends BaseForm ->findOne(); if ($productSaleElements->getQuantity() < $value && ConfigQuery::checkAvailableStock()) { - $context->addViolation("quantity value is not valid"); + $context->addViolation(Translator::getInstance()->trans("quantity value is not valid")); } } } diff --git a/core/lib/Thelia/Form/CustomerCreateForm.php b/core/lib/Thelia/Form/CustomerCreateForm.php index b1984e8d4..2da01fe48 100644 --- a/core/lib/Thelia/Form/CustomerCreateForm.php +++ b/core/lib/Thelia/Form/CustomerCreateForm.php @@ -100,7 +100,7 @@ class CustomerCreateForm extends AddressCreateForm // Add terms & conditions ->add("agreed", "checkbox", array( "constraints" => array( - new Constraints\True(array("message" => "Please accept the Terms and conditions in order to register.")) + new Constraints\True(array("message" => Translator::getInstance()->trans("Please accept the Terms and conditions in order to register."))) ), "label"=>"Test", "label_attr" => array( @@ -114,7 +114,7 @@ class CustomerCreateForm extends AddressCreateForm $data = $context->getRoot()->getData(); if ($data["password"] != $data["password_confirm"]) { - $context->addViolation("password confirmation is not the same as password field."); + $context->addViolation(Translator::getInstance()->trans("password confirmation is not the same as password field")); } } @@ -122,7 +122,7 @@ class CustomerCreateForm extends AddressCreateForm { $customer = CustomerQuery::getCustomerByEmail($value); if ($customer) { - $context->addViolation("This email already exists."); + $context->addViolation(Translator::getInstance()->trans("This email already exists.")); } } diff --git a/core/lib/Thelia/Form/CustomerLogin.php b/core/lib/Thelia/Form/CustomerLogin.php index cc0c1fd82..eb24e62d0 100644 --- a/core/lib/Thelia/Form/CustomerLogin.php +++ b/core/lib/Thelia/Form/CustomerLogin.php @@ -96,7 +96,7 @@ class CustomerLogin extends BaseForm if (false === $data['password'] || (empty($data['password']) && '0' != $data['password'])) { $context->getViolations()->add(new ConstraintViolation( - 'This value should not be blank.', + Translator::getInstance()->trans('This value should not be blank.'), 'account_password', array(), $context->getRoot(), @@ -117,7 +117,7 @@ class CustomerLogin extends BaseForm if ($data["account"] == 0) { $customer = CustomerQuery::create()->findOneByEmail($value); if ($customer) { - $context->addViolation("A user already exists with this email address. Please login or if you've forgotten your password, go to Reset Your Password."); + $context->addViolation(Translator::getInstance()->trans("A user already exists with this email address. Please login or if you've forgotten your password, go to Reset Your Password.")); } } } diff --git a/core/lib/Thelia/Form/CustomerLostPasswordForm.php b/core/lib/Thelia/Form/CustomerLostPasswordForm.php index 5fdb8af60..ee26fd2c1 100644 --- a/core/lib/Thelia/Form/CustomerLostPasswordForm.php +++ b/core/lib/Thelia/Form/CustomerLostPasswordForm.php @@ -82,7 +82,7 @@ class CustomerLostPasswordForm extends BaseForm { $customer = CustomerQuery::create()->findOneByEmail($value); if (null === $customer) { - $context->addViolation("This email does not exists"); + $context->addViolation(Translator::getInstance()->trans("This email does not exists")); } } diff --git a/core/lib/Thelia/Form/CustomerPasswordUpdateForm.php b/core/lib/Thelia/Form/CustomerPasswordUpdateForm.php index 0a29aeda7..50f49261a 100644 --- a/core/lib/Thelia/Form/CustomerPasswordUpdateForm.php +++ b/core/lib/Thelia/Form/CustomerPasswordUpdateForm.php @@ -81,7 +81,7 @@ class CustomerPasswordUpdateForm extends BaseForm { // Check if value of the old password match the password of the current user if (!password_verify($value, $this->getRequest()->getSession()->getCustomerUser()->getPassword())) { - $context->addViolation("Your current password does not match."); + $context->addViolation(Translator::getInstance()->trans("Your current password does not match.")); } } @@ -90,7 +90,7 @@ class CustomerPasswordUpdateForm extends BaseForm $data = $context->getRoot()->getData(); if ($data["password"] != $data["password_confirm"]) { - $context->addViolation("Password confirmation is not the same as password field."); + $context->addViolation(Translator::getInstance()->trans("password confirmation is not the same as password field")); } } diff --git a/core/lib/Thelia/Form/CustomerProfileUpdateForm.php b/core/lib/Thelia/Form/CustomerProfileUpdateForm.php index 6f44ecc92..9b075abe8 100644 --- a/core/lib/Thelia/Form/CustomerProfileUpdateForm.php +++ b/core/lib/Thelia/Form/CustomerProfileUpdateForm.php @@ -23,6 +23,7 @@ namespace Thelia\Form; use Symfony\Component\Validator\ExecutionContextInterface; +use Thelia\Core\Translation\Translator; use Thelia\Model\CustomerQuery; /** @@ -66,7 +67,7 @@ class CustomerProfileUpdateForm extends CustomerCreateForm $customer = CustomerQuery::getCustomerByEmail($value); // If there is already a customer for this email address and if the customer is different from the current user, do a violation if ($customer && $customer->getId() != $this->getRequest()->getSession()->getCustomerUser()->getId()) { - $context->addViolation("This email already exists."); + $context->addViolation(Translator::getInstance()->trans("This email already exists.")); } } diff --git a/core/lib/Thelia/Form/ModuleModificationForm.php b/core/lib/Thelia/Form/ModuleModificationForm.php index 5b65f5709..2d0e6eea7 100644 --- a/core/lib/Thelia/Form/ModuleModificationForm.php +++ b/core/lib/Thelia/Form/ModuleModificationForm.php @@ -25,6 +25,7 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; use Symfony\Component\Validator\ExecutionContextInterface; +use Thelia\Core\Translation\Translator; use Thelia\Model\ModuleQuery; class ModuleModificationForm extends BaseForm @@ -69,7 +70,7 @@ class ModuleModificationForm extends BaseForm ->findPk($value); if (null === $module) { - $context->addViolation("Module ID not found"); + $context->addViolation(Translator::getInstance()->trans("Module ID not found")); } } } diff --git a/core/lib/Thelia/Form/NewsletterForm.php b/core/lib/Thelia/Form/NewsletterForm.php index 2dc910c1d..aa90138b1 100644 --- a/core/lib/Thelia/Form/NewsletterForm.php +++ b/core/lib/Thelia/Form/NewsletterForm.php @@ -83,7 +83,7 @@ class NewsletterForm extends BaseForm { $customer = NewsletterQuery::create()->findOneByEmail($value); if ($customer) { - $context->addViolation("You are already registered!"); + $context->addViolation(Translator::getInstance()->trans("You are already registered!")); } } diff --git a/core/lib/Thelia/Form/OrderDelivery.php b/core/lib/Thelia/Form/OrderDelivery.php index b7eb4696d..37172612a 100644 --- a/core/lib/Thelia/Form/OrderDelivery.php +++ b/core/lib/Thelia/Form/OrderDelivery.php @@ -24,6 +24,7 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; use Symfony\Component\Validator\ExecutionContextInterface; +use Thelia\Core\Translation\Translator; use Thelia\Model\AddressQuery; use Thelia\Model\ModuleQuery; use Thelia\Module\BaseModule; @@ -68,7 +69,7 @@ class OrderDelivery extends BaseForm ->findPk($value); if (null === $address) { - $context->addViolation("Address ID not found"); + $context->addViolation(Translator::getInstance()->trans("Address ID not found")); } } @@ -81,13 +82,13 @@ class OrderDelivery extends BaseForm ->findOne(); if (null === $module) { - $context->addViolation("Delivery module ID not found"); + $context->addViolation(Translator::getInstance()->trans("Delivery module ID not found")); } $moduleReflection = new \ReflectionClass($module->getFullNamespace()); if ($moduleReflection->isSubclassOf("Thelia\Module\DeliveryModuleInterface") === false) { $context->addViolation( - 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 6a0d6ec61..1ae4fa06c 100644 --- a/core/lib/Thelia/Form/OrderPayment.php +++ b/core/lib/Thelia/Form/OrderPayment.php @@ -24,6 +24,7 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; use Symfony\Component\Validator\ExecutionContextInterface; +use Thelia\Core\Translation\Translator; use Thelia\Model\AddressQuery; use Thelia\Model\ModuleQuery; use Thelia\Module\BaseModule; @@ -68,7 +69,7 @@ class OrderPayment extends BaseForm ->findPk($value); if (null === $address) { - $context->addViolation("Address ID not found"); + $context->addViolation(Translator::getInstance()->trans("Address ID not found")); } } @@ -87,7 +88,7 @@ class OrderPayment extends BaseForm $moduleReflection = new \ReflectionClass($module->getFullNamespace()); if ($moduleReflection->isSubclassOf("Thelia\Module\PaymentModuleInterface") === false) { $context->addViolation( - 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/core/lib/Thelia/Form/OrderUpdateAddress.php b/core/lib/Thelia/Form/OrderUpdateAddress.php index f8aabf628..9c4bfaa37 100644 --- a/core/lib/Thelia/Form/OrderUpdateAddress.php +++ b/core/lib/Thelia/Form/OrderUpdateAddress.php @@ -166,7 +166,7 @@ class OrderUpdateAddress extends BaseForm ->findPk($value); if (null === $address) { - $context->addViolation("Order address ID not found"); + $context->addViolation(Translator::getInstance()->trans("Order address ID not found")); } } @@ -176,7 +176,7 @@ class OrderUpdateAddress extends BaseForm ->findPk($value); if (null === $address) { - $context->addViolation("Title ID not found"); + $context->addViolation(Translator::getInstance()->trans("Title ID not found")); } } @@ -186,7 +186,7 @@ class OrderUpdateAddress extends BaseForm ->findPk($value); if (null === $address) { - $context->addViolation("Country ID not found"); + $context->addViolation(Translator::getInstance()->trans("Country ID not found")); } } } diff --git a/core/lib/Thelia/Form/ProfileCreationForm.php b/core/lib/Thelia/Form/ProfileCreationForm.php index ae32ae5a0..8a70b68bd 100644 --- a/core/lib/Thelia/Form/ProfileCreationForm.php +++ b/core/lib/Thelia/Form/ProfileCreationForm.php @@ -74,7 +74,7 @@ class ProfileCreationForm extends BaseForm ->findOneByCode($value); if (null !== $profile) { - $context->addViolation("Profile `code` already exists"); + $context->addViolation(Translator::getInstance()->trans("Profile `code` already exists")); } } } diff --git a/core/lib/Thelia/Form/ProfileModificationForm.php b/core/lib/Thelia/Form/ProfileModificationForm.php index 711ecea56..9ac186283 100644 --- a/core/lib/Thelia/Form/ProfileModificationForm.php +++ b/core/lib/Thelia/Form/ProfileModificationForm.php @@ -24,6 +24,7 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; use Symfony\Component\Validator\ExecutionContextInterface; +use Thelia\Core\Translation\Translator; use Thelia\Model\ProfileQuery; /** @@ -67,7 +68,7 @@ class ProfileModificationForm extends ProfileCreationForm ->findPk($value); if (null === $profile) { - $context->addViolation("Profile ID not found"); + $context->addViolation(Translator::getInstance()->trans("Profile ID not found")); } } } diff --git a/core/lib/Thelia/Form/ProfileUpdateModuleAccessForm.php b/core/lib/Thelia/Form/ProfileUpdateModuleAccessForm.php index 2f7331cb9..6e1ee9c3e 100644 --- a/core/lib/Thelia/Form/ProfileUpdateModuleAccessForm.php +++ b/core/lib/Thelia/Form/ProfileUpdateModuleAccessForm.php @@ -26,6 +26,7 @@ use Symfony\Component\Validator\Constraints; use Symfony\Component\Validator\ExecutionContextInterface; use Thelia\Core\Security\AccessManager; +use Thelia\Core\Translation\Translator; use Thelia\Model\ProfileQuery; use Thelia\Model\ModuleQuery; @@ -91,7 +92,7 @@ class ProfileUpdateModuleAccessForm extends BaseForm ->findPk($value); if (null === $profile) { - $context->addViolation("Profile ID not found"); + $context->addViolation(Translator::getInstance()->trans("Profile ID not found")); } } } diff --git a/core/lib/Thelia/Form/ProfileUpdateResourceAccessForm.php b/core/lib/Thelia/Form/ProfileUpdateResourceAccessForm.php index f4ce79414..5bd8eeca4 100644 --- a/core/lib/Thelia/Form/ProfileUpdateResourceAccessForm.php +++ b/core/lib/Thelia/Form/ProfileUpdateResourceAccessForm.php @@ -26,6 +26,7 @@ use Symfony\Component\Validator\Constraints; use Symfony\Component\Validator\ExecutionContextInterface; use Thelia\Core\Security\AccessManager; +use Thelia\Core\Translation\Translator; use Thelia\Model\ProfileQuery; use Thelia\Model\ResourceQuery; @@ -91,7 +92,7 @@ class ProfileUpdateResourceAccessForm extends BaseForm ->findPk($value); if (null === $profile) { - $context->addViolation("Profile ID not found"); + $context->addViolation(Translator::getInstance()->trans("Profile ID not found")); } } } diff --git a/core/lib/Thelia/Form/TaxCreationForm.php b/core/lib/Thelia/Form/TaxCreationForm.php index d3483aa4e..539eda8c6 100644 --- a/core/lib/Thelia/Form/TaxCreationForm.php +++ b/core/lib/Thelia/Form/TaxCreationForm.php @@ -51,7 +51,7 @@ class TaxCreationForm extends BaseForm protected function buildForm($change_mode = false) { if ($this->taxEngine == null) { - throw new \LogicException("The TaxEngine should be passed to this form before using it."); + throw new \LogicException(Translator::getInstance()->trans("The TaxEngine should be passed to this form before using it.")); } $types = $this->taxEngine->getTaxTypeList(); diff --git a/core/lib/Thelia/Form/TaxRuleModificationForm.php b/core/lib/Thelia/Form/TaxRuleModificationForm.php index 3ec8e1f87..0a75f810b 100644 --- a/core/lib/Thelia/Form/TaxRuleModificationForm.php +++ b/core/lib/Thelia/Form/TaxRuleModificationForm.php @@ -24,6 +24,7 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; use Symfony\Component\Validator\ExecutionContextInterface; +use Thelia\Core\Translation\Translator; use Thelia\Model\TaxRuleQuery; class TaxRuleModificationForm extends TaxRuleCreationForm @@ -60,7 +61,7 @@ class TaxRuleModificationForm extends TaxRuleCreationForm ->findPk($value); if (null === $taxRule) { - $context->addViolation("Tax rule ID not found"); + $context->addViolation(Translator::getInstance()->trans("Tax rule ID not found")); } } } diff --git a/core/lib/Thelia/Form/TaxRuleTaxListUpdateForm.php b/core/lib/Thelia/Form/TaxRuleTaxListUpdateForm.php index ea2d1f06b..a48dea678 100644 --- a/core/lib/Thelia/Form/TaxRuleTaxListUpdateForm.php +++ b/core/lib/Thelia/Form/TaxRuleTaxListUpdateForm.php @@ -24,6 +24,7 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; use Symfony\Component\Validator\ExecutionContextInterface; +use Thelia\Core\Translation\Translator; use Thelia\Model\CountryQuery; use Thelia\Model\TaxQuery; use Thelia\Model\TaxRuleQuery; @@ -89,7 +90,7 @@ class TaxRuleTaxListUpdateForm extends BaseForm ->findPk($value); if (null === $taxRule) { - $context->addViolation("Tax rule ID not found"); + $context->addViolation(Translator::getInstance()->trans("Tax rule ID not found")); } } @@ -97,7 +98,7 @@ class TaxRuleTaxListUpdateForm extends BaseForm { $jsonType = new JsonType(); if (!$jsonType->isValid($value)) { - $context->addViolation("Tax list is not valid JSON"); + $context->addViolation(Translator::getInstance()->trans("Tax list is not valid JSON")); } $taxList = json_decode($value, true); @@ -108,18 +109,18 @@ class TaxRuleTaxListUpdateForm extends BaseForm if (is_array($taxLevel1)) { foreach ($taxLevel1 as $taxLevel2) { if (is_array($taxLevel2)) { - $context->addViolation("Bad tax list JSON"); + $context->addViolation(Translator::getInstance()->trans("Bad tax list JSON")); } else { $taxModel = TaxQuery::create()->findPk($taxLevel2); if (null === $taxModel) { - $context->addViolation("Tax ID not found in tax list JSON"); + $context->addViolation(Translator::getInstance()->trans("Tax ID not found in tax list JSON")); } } } } else { $taxModel = TaxQuery::create()->findPk($taxLevel1); if (null === $taxModel) { - $context->addViolation("Tax ID not found in tax list JSON"); + $context->addViolation(Translator::getInstance()->trans("Tax ID not found in tax list JSON")); } } } 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) {