Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
DeployTranslationsDictionary.php
Go to the documentation of this file.
1 <?php
6 namespace Magento\Deploy\Service;
7 
9 use Magento\Framework\Translate\Js\Config as JsTranslationConfig;
10 use Psr\Log\LoggerInterface;
11 
16 {
20  private $jsTranslationConfig;
21 
25  private $deployStaticFile;
26 
30  private $state;
31 
35  private $logger;
36 
43  public function __construct(
44  JsTranslationConfig $jsTranslationConfig,
45  DeployStaticFile $deployStaticFile,
46  State $state,
47  LoggerInterface $logger
48  ) {
49  $this->jsTranslationConfig = $jsTranslationConfig;
50  $this->deployStaticFile = $deployStaticFile;
51  $this->state = $state;
52  $this->logger = $logger;
53  }
54 
61  public function deploy($area, $theme, $locale)
62  {
63  try {
64  $this->state->emulateAreaCode($area, function () use ($area, $theme, $locale) {
65  $this->deployStaticFile->deployFile(
66  $this->jsTranslationConfig->getDictionaryFileName(),
67  [
68  'fileName' => $this->jsTranslationConfig->getDictionaryFileName(),
69  'area' => $area,
70  'theme' => $theme,
71  'locale' => $locale
72  ]
73  );
74  });
75  } catch (\Exception $e) {
76  $this->logger->error($e->getMessage());
77  }
78  }
79 }
$logger
__construct(JsTranslationConfig $jsTranslationConfig, DeployStaticFile $deployStaticFile, State $state, LoggerInterface $logger)
$theme