From 8abe56458f26169677f2bc014a8a6b7cd86e2b3e Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Thu, 31 Oct 2013 10:02:13 +0100 Subject: [PATCH] retrieve local from session in translator --- core/lib/Thelia/Config/Resources/config.xml | 2 +- core/lib/Thelia/Core/Translation/Translator.php | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/core/lib/Thelia/Config/Resources/config.xml b/core/lib/Thelia/Config/Resources/config.xml index 0cf616126..5574d07bc 100755 --- a/core/lib/Thelia/Config/Resources/config.xml +++ b/core/lib/Thelia/Config/Resources/config.xml @@ -211,7 +211,7 @@ - null + diff --git a/core/lib/Thelia/Core/Translation/Translator.php b/core/lib/Thelia/Core/Translation/Translator.php index 22dc47afd..444604e28 100755 --- a/core/lib/Thelia/Core/Translation/Translator.php +++ b/core/lib/Thelia/Core/Translation/Translator.php @@ -1,18 +1,28 @@ container = $container; // Allow singleton style calls once intanciated. // For this to work, the Translator service has to be instanciated very early. This is done manually // in TheliaHttpKernel, by calling $this->container->get('thelia.translator'); + parent::__construct(null); self::$instance = $this; } @@ -28,6 +38,11 @@ class Translator extends BaseTranslator return self::$instance; } + public function getLocale() + { + return $this->container->get('request')->getSession()->getLang()->getLocale(); + } + /** * {@inheritdoc} *