Add Translator on all controllers & forms text strings
This commit is contained in:
@@ -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',
|
||||
);
|
||||
|
||||
@@ -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',
|
||||
);
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user