Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Config.php
Go to the documentation of this file.
1 <?php
7 
8 use Magento\Framework\Translate\Js\Config as FrameworkJsConfig;
10 
14 class Config extends FrameworkJsConfig
15 {
19  const NO_TRANSLATION = 'none';
20 
24  const EMBEDDED_STRATEGY = 'embedded';
25 
29  const DICTIONARY_STRATEGY = 'dictionary';
30 
34  const XML_PATH_STRATEGY = 'dev/js/translate_strategy';
35 
39  const DICTIONARY_FILE_NAME = 'js-translation.json';
40 
46  protected $scopeConfig;
47 
53  protected $patterns;
54 
60  {
61  $this->scopeConfig = $scopeConfig;
62  $this->patterns = $patterns;
63  parent::__construct(
64  $this->scopeConfig->getValue(self::XML_PATH_STRATEGY) == self::DICTIONARY_STRATEGY,
66  );
67  }
68 
74  public function isEmbeddedStrategy()
75  {
76  return ($this->scopeConfig->getValue(self::XML_PATH_STRATEGY) == self::EMBEDDED_STRATEGY);
77  }
78 
84  public function dictionaryEnabled()
85  {
86  return ($this->scopeConfig->getValue(self::XML_PATH_STRATEGY) == self::DICTIONARY_STRATEGY);
87  }
88 
94  public function getPatterns()
95  {
96  return $this->patterns;
97  }
98 }
__construct(ScopeConfigInterface $scopeConfig, array $patterns)
Definition: Config.php:59