File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66
77use Symfony \Component \Translation \Loader \MoFileLoader ;
88use Symfony \Component \Translation \Translator ;
9+ use Symfony \Contracts \Translation \TranslatorInterface ;
910
1011class SymfonyTranslationDriver implements TranslationDriverInterface
1112{
@@ -19,9 +20,12 @@ class SymfonyTranslationDriver implements TranslationDriverInterface
1920 */
2021 private $ locale = 'en ' ;
2122
22- public function __construct (?string $ cacheDirectory = null )
23+ /**
24+ * @param string|null $cacheDirectory useful only if the given $translator is null.
25+ */
26+ public function __construct (?string $ cacheDirectory = null , ?TranslatorInterface $ translator = null )
2327 {
24- $ this ->translator = new Translator ($ this ->locale , null , $ cacheDirectory );
28+ $ this ->translator = $ translator ?: new Translator ($ this ->locale , null , $ cacheDirectory );
2529 $ this ->translator ->addLoader ('mo ' , new MoFileLoader ());
2630 }
2731
You can’t perform that action at this time.
0 commit comments